Obviously, my "multitasking" code is pretty much based off the code from the tutorial.
Unfortunately once tasking is initialized (but nothing yet forked), the second call to kthread_switch causes a triple fault.
The code for kthread_switch: http://pastebin.com/zf7YRJfX
Upon stepping through the code in GDB (Qemu), it is apparent that in the second call to kthread_switch() the if statement is the problem.
Code: Select all
if(!current_thread) return;
Code: Select all
mov eax, dword ptr ds:0xC002101C
test eax, eax
jz 0xC000172B
mov ebx, esp
mov dword ptr ss:[ebp-12],ebx
I find it odd that it is only at the JZ instruction, the "mov ebx, esp" never executes, but somehow ESP is being trashed?
Its always at the second call to kthread_switch and I cant understand why the jump would cause this?
Anyone notice something I dont? I would very much appreciate any input or advice.