Going Paranoid
Posted: Sun May 24, 2009 8:48 am
After countless hours of long work, I've finally managed to get a stable heap and everything seems to work fine. Seemed is the better word. I'm encountering very strange situations. For example: I create a vector (using a custom version) of a custom structure (lets name it 'foo'), everything works fine. I used my vector class countless times before, it worked fine, all tests succeed, no errors, etc... Then suddenly, I add this call:
somewhere and BOOM, everything crashes. I traced the bug to magically occur inside the paging code where paging is enabled with the first paging directory created. The weird thing is, the vector call is placed AFTER the paging initialization code and the vector code is never reached. Yet, if I remove the call, it works fine again. What makes it even more strange is that if I place the same code-line I placed above in another function, it suddenly works fine and nothing crashes!
At first I thought it was the heap again, but that's probably impossible since the heap isn't used, the crash occurs before anything ever gets to the heap or the vector class. So I'm thinking it's the linker script, but it's worked fine with me for a long time. Have any of you encountered something similar before? I really don't know what's going on or have any idea on how to fix this. I'm also using C++ for my kernel but have (I think) sufficient support for it (using information from on the wiki).
Could it be the linker in any way?
EDIT: While doing more experiments with placing the code somewhere else, Bochs gave me an error similar to 'Bochs vetoed redirect' and 'getHostMem violation' once.
Thanks in advance.
Creature
Code: Select all
Vector<char> v;
At first I thought it was the heap again, but that's probably impossible since the heap isn't used, the crash occurs before anything ever gets to the heap or the vector class. So I'm thinking it's the linker script, but it's worked fine with me for a long time. Have any of you encountered something similar before? I really don't know what's going on or have any idea on how to fix this. I'm also using C++ for my kernel but have (I think) sufficient support for it (using information from on the wiki).
Could it be the linker in any way?
Code: Select all
ENTRY(BootEntry)
OUTPUT(../bin/Dynamix.bin)
OUTPUT_FORMAT("elf32-i386")
SECTIONS
{
.text 0x100000 :
{
LdCode = .;
*(.text)
. = ALIGN(4096);
}
.data :
{
/* Constructor and destructor variables. */
LdConstrStart = .;
*(.ctor*)
LdConstrEnd = .;
LdDestrStart = .;
*(.dtor*)
LdDestrEnd = .;
LdData = .;
*(.data)
*(.rodata)
. = ALIGN(4096);
}
.bss :
{
LdBss = .;
*(.bss)
*(.sbss)
. = ALIGN(4096);
}
LdEnd = .;
}
INPUT
(
Boot.obj
CPUID.obj
Process.obj
Interrupts.obj
Compiler.o
clib.o
CPU.o
Kernel.o
Interrupts.o
Keyboard.o
IO.o
Paging.o
Heap.o
Multitasking.o
Main.o
)
Thanks in advance.
Creature