|
From: Manish R. <reg...@gm...> - 2005-09-16 17:45:57
|
Hi,
In manrix, pmap_pre_init() (asm/pmap.c) creates mapping for first 4 MB. The=
=20
first 1 MB is unused. grub loads kernel and modules in 1MB+ and the rest (<=
=20
3MB) is free to use. The rest of the memory cannot be used unless the memor=
y=20
subsystem is initialized properly.=20
ManRiX virtual memory manager keeps information about each page on a=20
structure called "struct page" which is 34 bytes. So just to store per page=
=20
structure the system needs 4.25 MB for 512 MB memory.
Your system tried to use memory >4MB. so, you got page fault. The page faul=
t=20
handler tried to create a mapping but the the memory subsystem was not=20
initialized. so the system paniced and halted.=20
We need to devise a workaround for this issue.
1) create additional mapping according to tatal memory.=20
2) ???
replace asm/pmap.c: pmap_pre_init() with this and give a second try.
=20
void pmap_pre_init()
{
extern u8 _text_start[], _end[], _text_end[];
vm_offset_t addr;
int i;
pde_t *pte, *pte2;
pde_t *pde;
kernel_map.pdbr =3D (pde_t *) get_next_frame();
pte =3D (pde_t *) get_next_frame();
pde =3D kernel_map.pdbr;
for(i=3D0 ; i < NTABLES ; i++)
kernel_map.pdbr[i] =3D 0;
/* we initialize one page directory entries only. It is
* enough to hold 4 MB memory.
*/
pde[KTABLE_START] =3D (addr_to_pte((vm_offset_t)pte)) | PAGE_PRESENT |=20
PAGE_RW;
/*
* create mapping for more memory. Needed if the system has more
* physical memory than 256MB. Used for per page structure if it exceeds 4mb=
=20
limit.
*/
if(ending_mem >=3D 0x10000000)
{
pte2 =3D (pde_t *) get_next_frame();
pde[KTABLE_START + 1] =3D (addr_to_pte((vm_offset_t)pte2)) | PAGE_PRESENT |=
=20
PAGE_RW;
}
/* temp mapping only */
pde[0] =3D (addr_to_pte((vm_offset_t)pte)) | PAGE_PRESENT | PAGE_RW ;
for(i =3D 0 ; i < NTABLES ; i++)
{
addr =3D i*PAGE_SIZE ;
if (addr >=3D 0xa0000 && addr <=3D 0xbffff)
pte[i] =3D (addr_to_pte(addr)) | PAGE_PRESENT | PAGE_RW ;
if((addr >=3D (vm_offset_t)_text_start) && (addr <=3D (vm_offset_t)_end))
{
if((addr >=3D (vm_offset_t)_text_start) && (addr <=3D (vm_offset_t)_text_en=
d))
pte[i] =3D (addr_to_pte(addr)) | PAGE_PRESENT|PAGE_RW;
else
pte[i] =3D (addr_to_pte(addr)) | PAGE_PRESENT | PAGE_RW;
}
else if((addr >=3D (vm_offset_t)pte) && (addr <=3D ((vm_offset_t)pte +=20
PAGE_SIZE)))
pte[i] =3D (addr_to_pte(addr)) | PAGE_PRESENT | PAGE_RW ;
else if((addr >=3D (vm_offset_t)pde) && (addr <=3D ((vm_offset_t)pde +=20
PAGE_SIZE)))
pte[i] =3D (addr_to_pte(addr)) | PAGE_PRESENT | PAGE_RW ;
else
pte[i] =3D 0 /*(addr_to_pte(addr)) | PAGE_PRESENT | PAGE_RW */;
}
invlpg((void *)addr);
list_init(&pmap_object.page);
pmap_object.size =3D ending_mem - starting_mem;
}
Regards=20
Manish Regmi
|