Pager works until end of init_physmem_secondary

This commit is contained in:
Bahadir Balban
2009-08-09 17:22:13 +03:00
parent a45b5676ab
commit 02a3f1ac91
33 changed files with 607 additions and 556 deletions

View File

@@ -0,0 +1,21 @@
#ifndef __BOOTDESC_H__
#define __BOOTDESC_H__
/* Supervisor task at load time. */
struct svc_image {
char name[16];
unsigned int phys_start;
unsigned int phys_end;
} __attribute__((__packed__));
/* Supervisor task descriptor at load time */
struct bootdesc {
int desc_size;
int total_images;
struct svc_image images[];
} __attribute__((__packed__));
struct initdata;
void read_bootdesc(struct initdata *initdata);
#endif /* __BOOTDESC_H__ */

View File

@@ -0,0 +1,9 @@
#ifndef __PAGER_BOOTM_H__
#define __PAGER_BOOTM_H__
#define __initdata SECTION(".init.data")
void *alloc_bootmem(int size, int alignment);
#endif /* __PAGER_BOOTM_H__ */

View File

@@ -0,0 +1,41 @@
/*
* Capability-related operations of the pager.
*
* Copyright (C) 2009 Bahadir Balban
*/
#ifndef __MM0_CAPABILITY_H__
#define __MM0_CAPABILITY_H__
#include <l4lib/types.h>
#include <l4/lib/list.h>
struct cap_list {
int ncaps;
struct link caps;
};
struct capability {
struct link list;
/* Capability identifiers */
l4id_t capid; /* Unique capability ID */
l4id_t resid; /* Targeted resource ID */
l4id_t owner; /* Capability owner ID */
unsigned int type; /* Capability and target resource type */
/* Capability limits/permissions */
u32 access; /* Permitted operations */
/* Limits on the resource */
unsigned long start; /* Resource start value */
unsigned long end; /* Resource end value */
unsigned long size; /* Resource size */
};
extern struct cap_list capability_list;
struct initdata;
int read_kernel_capabilities(struct initdata *);
#endif /* __MM0_CAPABILITY_H__ */

View File

@@ -9,16 +9,19 @@
#include <l4/macros.h>
#include <l4/config.h>
#include <l4/types.h>
#include <l4/generic/physmem.h>
#include INC_PLAT(offsets.h)
#include INC_GLUE(memory.h)
#include INC_GLUE(memlayout.h)
#include INC_ARCH(bootdesc.h)
#include <bootdesc.h>
#include <physmem.h>
#include <vm_area.h>
#include <capability.h>
struct initdata {
struct capability *bootcaps;
struct capability *physmem;
struct bootdesc *bootdesc;
struct page_bitmap page_map;
struct page_bitmap *page_map;
unsigned long pager_utcb_virt;
unsigned long pager_utcb_phys;
struct link boot_file_list;
@@ -26,9 +29,9 @@ struct initdata {
extern struct initdata initdata;
int request_initdata(struct initdata *i);
void init_pager(void);
void initialise(void);
/* TODO: Remove this stuff from here. */
int init_devzero(void);
struct vm_file *get_devzero(void);
int init_boot_files(struct initdata *initdata);

View File

@@ -33,12 +33,19 @@ SECTIONS
{
*(.data)
}
. = ALIGN(4K);
_start_init = .;
.init : AT (ADDR(.init) - offset) { *(.init.stack) }
. = ALIGN(8);
__stack = .; /* This is the preallocated boot stack */
_end_init = .;
.bss : AT (ADDR(.bss) - offset) { *(.bss) }
. = ALIGN(4K);
. += 0x2000; /* BSS doesnt increment link counter??? */
/* Below part is to be discarded after boot */
_start_init = .;
.init : AT (ADDR(.init) - offset)
{
*(.init.data)
*(.init.bootmem)
*(.init.stack)
}
_end_init = .;
__stack = .; /* This is the preallocated boot stack */
_end_init = .;
_end = .;
}

View File

@@ -8,14 +8,7 @@
#include <vm_area.h>
#include <init.h>
struct membank {
unsigned long start;
unsigned long end;
unsigned long free;
struct page *page_array;
};
extern struct membank membank[];
#include <physmem.h>
void init_mm_descriptors(struct page_bitmap *page_map,
struct bootdesc *bootdesc, struct membank *membank);

View File

@@ -0,0 +1,45 @@
/*
* Physical memory descriptors
*
* Copyright (C) 2007 - 2009 Bahadir Balban
*/
#ifndef __PAGER_PHYSMEM_H__
#define __PAGER_PHYSMEM_H__
/* A compact memory descriptor to determine used/unused pages in the system */
struct page_bitmap {
unsigned long pfn_start;
unsigned long pfn_end;
unsigned int map[];
};
/* Describes a portion of physical memory. */
struct memdesc {
unsigned int start;
unsigned int end;
unsigned int free_cur;
unsigned int free_end;
unsigned int numpages;
};
struct membank {
unsigned long start;
unsigned long end;
unsigned long free;
struct page *page_array;
};
extern struct membank membank[];
/* Describes bitmap of used/unused state for all physical pages */
extern struct page_bitmap page_map;
extern struct memdesc physmem;
/* Sets the global page map as used/unused. Aligns input when needed. */
int set_page_map(struct page_bitmap *pmap, unsigned long start,
int numpages, int val);
struct initdata;
void init_physmem_primary(struct initdata *initdata);
void init_physmem_secondary(struct initdata *initdata, struct membank *membank);
#endif /* __PAGER_PHYSMEM_H__ */