Ok, I tracked down the issue. You see, in
task.c I have a variable named
CPUSaveState* g_saveStateToRestore = NULL; that I use in
RestoreKernelTask. Using a debugging tool I have I can find that the address is
.bss:29F978. Then I make reference of it in
ktask.asm (I use NASM to compile asm files) and the code looks something like this:
Code:
extern g_saveStateToRestore
OnStartedNewTask:
OnStartedNewKernelTask:
;cli
; restore the registers now
mov esp, [g_saveStateToRestore]
The problem is that the value used by the asm's
g_saveStateToRestore does NOT have the same address as the one inside the C file. Instead it's been moved
0x100 bytes forward to
.bss:29FA78. It's really strange.
FYI: The dumps:
Code:
.bss:0029F978 ; CPUSaveState_0 *g_saveStateToRestore
.bss:0029F978 g_saveStateToRestore dd ? ; DATA XREF: RestoreKernelTask+6↑w
.bss:0029F978 ; RestoreStandardTask+C↑w
... (0x100 bytes later)
.bss:0029FA78 dword_29FA78 dd ? ; DATA XREF: OnStartedNewTask↑r