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.
Memory Management
add a location entry in your linker script after the end of bss like so:
in your c code have something like :
the membase pointer should point to the last byte used by the bss segment.
Code: Select all
end_of_bss = .;
Code: Select all
extern char end_of_bss;
void * membase = (void *)&end_of_bss;
Author of COBOS