Fixed a bug with page_map size by dynamically allocating it.

This commit is contained in:
Bahadir Balban
2009-08-10 23:47:58 +03:00
parent 15b659eaf0
commit 4f4532210a
2 changed files with 22 additions and 12 deletions

View File

@@ -404,6 +404,10 @@ void init_finalize(struct kernel_container *kcont)
*/ */
free_bootmem(); free_bootmem();
/*
* Set up KIP UTCB ref
*/
kip.utcb = (u32)current->utcb_address;
/* /*
* Start the scheduler, jumping to task * Start the scheduler, jumping to task
*/ */

View File

@@ -17,18 +17,18 @@
#include <stdio.h> #include <stdio.h>
#include <init.h> #include <init.h>
#include <physmem.h> #include <physmem.h>
#include <bootm.h>
struct page_bitmap page_map; /* Bitmap of used/unused pages at bootup */
struct memdesc physmem; /* Initial, primitive memory descriptor */ struct memdesc physmem; /* Initial, primitive memory descriptor */
struct membank membank[1]; /* The memory bank */ struct membank membank[1]; /* The memory bank */
struct page *page_array; /* The physical page array based on mem bank */ struct page *page_array; /* The physical page array based on mem bank */
static void init_page_map(unsigned long pfn_start, unsigned long pfn_end) static void init_page_map(struct page_bitmap *pmap, unsigned long pfn_start, unsigned long pfn_end)
{ {
page_map.pfn_start = pfn_start; pmap->pfn_start = pfn_start;
page_map.pfn_end = pfn_end; pmap->pfn_end = pfn_end;
set_page_map(&page_map, pfn_start, pfn_end - pfn_start, 0); set_page_map(pmap, pfn_start, pfn_end - pfn_start, 0);
} }
/* /*
@@ -143,20 +143,26 @@ void init_physmem_primary(struct initdata *initdata)
unsigned long pfn_start, pfn_end, pfn_images_end = 0; unsigned long pfn_start, pfn_end, pfn_images_end = 0;
struct bootdesc *bootdesc = initdata->bootdesc; struct bootdesc *bootdesc = initdata->bootdesc;
/* Initialise page map from physmem capability */ /* Allocate page map structure */
init_page_map(initdata->physmem->start, initdata->page_map = alloc_bootmem(sizeof(struct page_bitmap) +
initdata->physmem->end); ((initdata->physmem->end -
initdata->physmem->start)
>> 5) + 1, 0);
/* Set initdata pointer to initialized page map */ /* Initialise page map from physmem capability */
initdata->page_map = &page_map; init_page_map(initdata->page_map,
initdata->physmem->start,
initdata->physmem->end);
/* Mark pager and other boot task areas as used */ /* Mark pager and other boot task areas as used */
for (int i = 0; i < bootdesc->total_images; i++) { for (int i = 0; i < bootdesc->total_images; i++) {
pfn_start = __pfn(page_align_up(bootdesc->images[i].phys_start)); pfn_start =
__pfn(page_align_up(bootdesc->images[i].phys_start));
pfn_end = __pfn(page_align_up(bootdesc->images[i].phys_end)); pfn_end = __pfn(page_align_up(bootdesc->images[i].phys_end));
if (pfn_end > pfn_images_end) if (pfn_end > pfn_images_end)
pfn_images_end = pfn_end; pfn_images_end = pfn_end;
set_page_map(&page_map, pfn_start, pfn_end - pfn_start, 1); set_page_map(initdata->page_map, pfn_start,
pfn_end - pfn_start, 1);
} }
physmem.start = initdata->physmem->start; physmem.start = initdata->physmem->start;