Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
colcsky
Posts: 2 Joined: Sun Aug 03, 2014 8:20 am
Post
by colcsky » Sun Aug 03, 2014 8:43 am
kmalloc() (1 * sz) byte allocation.
Code: Select all
u32int kmalloc(u32int sz)
{
u32int tmp = placement_address;
placement_address += sz;
return tmp;
}
I think, (u32int*)kmalloc(INDEX_FROM_BIT(nframes * 4)) should be
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));
...
}
help me?
Last edited by
colcsky on Sun Aug 03, 2014 5:11 pm, edited 3 times in total.
Synon
Member
Posts: 169 Joined: Sun Sep 06, 2009 3:54 am
Location: Brighton, United Kingdom
Post
by Synon » Sun Aug 03, 2014 12:44 pm
Doesn't the kmalloc in the tutorial have a parameter that controls whether to page-align things?
colcsky
Posts: 2 Joined: Sun Aug 03, 2014 8:20 am
Post
by colcsky » Sun Aug 03, 2014 12:53 pm
Excuse me. allocation.
sortie
Member
Posts: 931 Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie
Post
by sortie » Mon Aug 04, 2014 5:17 pm
I'm on a phone, can somebody link this guy to the James Molloy tutorial errata on the wiki?