push fs
push gs
+ pushf
+ and BYTE [esp+1], 0xFE ; Clear Trap Flag
+ popf
+
mov eax, dr0
push eax ; Debug Register 0, Current Thread
pop ds
popa
- add esp, 4 ; CPU ID
+ add esp, 4*2 ; CPU ID + Dummy error code
; No Error code / int num
iret
; In child, so now set up stack frame
mov ebx, [esp+4] ; Child Function
mov edx, [esp+8] ; Argument
- ; Child
+ ; Child Function
push edx ; Argument
call ebx ; Function
+ ; Kill thread once done
push eax ; Exit Code
push 0 ; Kill this thread
call Threads_Exit ; Kill Thread
.justKillIt:
xor eax, eax
xor ebx, ebx
- dec ebx
+ dec ebx ; EBX = -1
int 0xAC
[global GetCPUNum]
mov eax, dr1
ret
+[extern GetEIP]
+[global GetEIP_Sched]
+[global GetEIP_Sched_ret]
+GetEIP_Sched_ret equ GetEIP_Sched.ret
+GetEIP_Sched:
+ call GetEIP
+GetEIP_Sched.ret:
+ ret
+
; Usermode code exported by the kernel
[section .usertext]
; Export a place for the user to jump to to call a syscall