James Molloy Paging Problem?

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.
Post Reply
colcsky
Posts: 2
Joined: Sun Aug 03, 2014 8:20 am

James Molloy Paging Problem?

Post 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? :?
Last edited by colcsky on Sun Aug 03, 2014 5:11 pm, edited 3 times in total.
Synon
Member
Member
Posts: 169
Joined: Sun Sep 06, 2009 3:54 am
Location: Brighton, United Kingdom

Re: James Molloy Paging Problem ?

Post by Synon »

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

Re: James Molloy Paging Problem ?

Post by colcsky »

Excuse me. allocation. :)
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: James Molloy Paging Problem?

Post by sortie »

I'm on a phone, can somebody link this guy to the James Molloy tutorial errata on the wiki?
FallenAvatar
Member
Member
Posts: 283
Joined: Mon Jan 03, 2011 6:58 pm

Re: James Molloy Paging Problem?

Post 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
Post Reply