Heap management problems
Posted: Mon Oct 06, 2008 4:56 am
Hi,
I am trying to get heap management and paging going in my OS, and I am working from JamesM's tutorials (and porting it to C++). The problem I am having is that when I try to create my heap, I get a general protection fault - but only when I run in Bochs or on a real PC. In virtualbox or QEMU though, it runs perfectly. As far as I can tell, paging is working fine, but when I try to make an index to keep track of the allocated memory, it crashes. This happens after I try to clear the memory at the start of the heap (line 84 or paging.cc, called from create_heap at line 42, which is called after paging is enabled). In Bochs, I get a write beyond limit, but it works in every other emulator I've tried...
Here are the relevant source files:
kheap.cc
kheap.h
paging.cc
paging.h
Note that instead of making a general ordered array like in the tutorial, I just made it specific to the heap management because I'm going to implement a std::vector - which I would use for this, but it requires heap management to work!
Now, I'm probably just missing something really simple and obvious, but I've been trying to fix this for a while now and haven't made any progress...
Thanks for any help.
Steve
I am trying to get heap management and paging going in my OS, and I am working from JamesM's tutorials (and porting it to C++). The problem I am having is that when I try to create my heap, I get a general protection fault - but only when I run in Bochs or on a real PC. In virtualbox or QEMU though, it runs perfectly. As far as I can tell, paging is working fine, but when I try to make an index to keep track of the allocated memory, it crashes. This happens after I try to clear the memory at the start of the heap (line 84 or paging.cc, called from create_heap at line 42, which is called after paging is enabled). In Bochs, I get a write beyond limit, but it works in every other emulator I've tried...
Here are the relevant source files:
kheap.cc
kheap.h
paging.cc
paging.h
Note that instead of making a general ordered array like in the tutorial, I just made it specific to the heap management because I'm going to implement a std::vector - which I would use for this, but it requires heap management to work!
Now, I'm probably just missing something really simple and obvious, but I've been trying to fix this for a while now and haven't made any progress...
Thanks for any help.
Steve