James Molloy Paging Problem?
Posted: Sun Aug 03, 2014 8:43 am
kmalloc() (1 * sz) byte allocation.
I think, (u32int*)kmalloc(INDEX_FROM_BIT(nframes * 4)) should be
help me?
Code: Select all
u32int kmalloc(u32int sz)
{
u32int tmp = placement_address;
placement_address += sz;
return tmp;
}
Code: Select all
void initialise_paging()
{
/*
* 0x1000000 = 16777216 Byte = 16384 KiB
*/
u32int mem_end_page = 0x1000000; // 16777216 byte
nframes = mem_end_page / 0x1000; // (16777216 byte) / (4096 byte page/frame size) = 4096 page/frame
/*
* nframes = 4096
* --> INDEX_FROM_BIT(nframes) = 128 byte . kmalloc() 1 byte allocation.
*
* frames bitmap = 4096 bits should be ,because frame count is 4096.
*
* 128 byte from kmalloc() , 128 byte * (1 byte = 8 bit) = total bit is 1024.
*
* (u32int*)kmalloc(INDEX_FROM_BIT(nframes)) = false
* I think, (u32int*)kmalloc(INDEX_FROM_BIT(nframes * 4)) should be
*/
frames = (u32int*)kmalloc(INDEX_FROM_BIT(nframes));
memset(frames, 0, INDEX_FROM_BIT(nframes));
...
}