Skip to contentSkip to conversation

mini-os: sbrk() doesn't allocate pages?

DISCUSSION Gerd Hoffmann 2 participants 3 messages Aug 14, 2008

lore
Share & tools
lore
#0 lore raw

Hi,

I'm wondering how the mini-os heap allocater work. The sbrk() function in mm.c seems to *not* allocate pages for the heap. Instead it uses the zero page and maps it into the heap space when a new page is needed ...

I can't believe is is supposed to work that way. Is that a bug? Did I miss some logic somewhere in the code?

wondering,
Gerd

Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
#1 lore raw
Quoted 8 lines · Gerd Hoffmann

Hi,

I'm wondering how the mini-os heap allocater work. The sbrk() function in mm.c seems to *not* allocate pages for the heap. Instead it uses the zero page and maps it into the heap space when a new page is needed ...

I can't believe is is supposed to work that way. Is that a bug? Did I miss some logic somewhere in the code?

Oh, cow in the pagefault handler, that is the missing bit ...

cheers,
Gerd

Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
#2 lore raw
In reply to Gerd Hoffmann
Quoted 1 line · Gerd Hoffmann, le Thu 14 Aug 2008 10:04:31 +0200, a écrit :

I can't believe is is supposed to work that way.

That's how it usually works in unix environments :)

Samuel