Page 1 of 1

Memory Management

Posted: Wed May 16, 2007 4:01 am
by pcmattman
OK, I've found a serious problem in my kernel, and have been debating whether or not to bring it here. In the end, I decided I may as well ask for help because I'm getting nowhere.

Now I'm implementing FAT32, I'm needing to allocate large amounts of memory (ie. 8192 bytes and above). If I preallocate these buffers, I have no problem at all. However, I dislike preallocating such buffers as they are extremely un-portable.

The problem is, my memory manager at the moment is really quite useless. I just need something that doesn't worry about paging but partitions and allocates space from the end of the kernel's BSS section (btw, how do I find this out?) and then to the top of physical RAM.

Any ideas, links, tutorials or code? This problem has been chasing me for a couple of months now, I've just chosen to doge it. Hint to those who are dodging problems - don't.

Posted: Wed May 16, 2007 4:30 am
by os64dev
add a location entry in your linker script after the end of bss like so:

Code: Select all

end_of_bss = .;
in your c code have something like :

Code: Select all

extern char end_of_bss;
void * membase = (void *)&end_of_bss;
the membase pointer should point to the last byte used by the bss segment.

Posted: Wed May 16, 2007 4:31 pm
by pcmattman
Thanks for that, I was wondering why it didn't work earlier (I didn't realize it didn't actually have a value!).