Page 1 of 1

James Molloy Paging Problem?

Posted: Sun Aug 03, 2014 8:43 am
by colcsky
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? :?

Re: James Molloy Paging Problem ?

Posted: Sun Aug 03, 2014 12:44 pm
by Synon
Doesn't the kmalloc in the tutorial have a parameter that controls whether to page-align things?

Re: James Molloy Paging Problem ?

Posted: Sun Aug 03, 2014 12:53 pm
by colcsky
Excuse me. allocation. :)

Re: James Molloy Paging Problem?

Posted: Mon Aug 04, 2014 5:17 pm
by sortie
I'm on a phone, can somebody link this guy to the James Molloy tutorial errata on the wiki?

Re: James Molloy Paging Problem?

Posted: Mon Aug 04, 2014 6:09 pm
by FallenAvatar
sortie wrote:I'm on a phone, can somebody link this guy to the James Molloy tutorial errata on the wiki?
Sure thing. OP, please see http://wiki.osdev.org/James_Molloy%27s_ ... Known_Bugs

- Monk