My kernel is a 64-bit higher-half kernel. I use a secondary loader to load my kernel into higher-half. If my loader does not zeroize the bss section, the kernel will get triple fault. After hours of debugging I get the root cause of the triple fault:
G++ put some static variables into .bss.* sections. The C++ standard says all static variables will be initialized to zero(If I am not wrong). If the loader doesn't zeroize the the bss section, the assumption that static variables will be initialized to zero made by G++ will be broken, so unexpected things happen and the kernel get triple fault.
My loader just reads the section table and loads sections needed into memory.
This is part of my ld script.
Code: Select all
.bss : {
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(ALIGNMENT);
}
Thanks in advance
torshie