Kernel heap malloc not working properly

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
Crazed123

Kernel heap malloc not working properly

Post by Crazed123 »

Hi, I'm at the point of testing out my basic functionality before going onwards. GDT is good, printing strings to screen is good, using the GRUB memory map is good, however, it would appear that my KMalloc is NOT good. This bug shows its face when I try to perform a simple SetLength function on a string that was set to a constant in order to make it a few characters shorter before displaying the result to show it can do this. SetLength is an RTL function, I've programmed the RTL to hook into my own allocation functions and checked the hooks, they work fine. And I would trust tried and true Object Pascal RTL code to the end of all computers. So it must be my KMalloc function (the one that gets hooked into) that isn't working. It doesn't return an error (ie: nil), so it thinks it's allocating new memory when it isn't. There might also be trouble with KFree, as both are used in the process of reallocating a string. The entire source file for the memory manager is enclosed. Any global variables that aren't set there are set up just fine in the Bootup module. Can anyone help me figure this out?
Post Reply