X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Farch%2Fx86%2Fproc.asm;h=944b24dd4d5cd16cdd825515b5b8ca365df7a8fd;hb=3764c294f21229bdf700f436fa4884f5e76e0d3a;hp=a07bdad840809b7e71c24a104b196dbe0cbb7c1d;hpb=8a998da38a4eecface76749701079c833d64a7d8;p=tpg%2Facess2.git diff --git a/Kernel/arch/x86/proc.asm b/Kernel/arch/x86/proc.asm index a07bdad8..944b24dd 100644 --- a/Kernel/arch/x86/proc.asm +++ b/Kernel/arch/x86/proc.asm @@ -74,6 +74,10 @@ SchedulerBase: push fs push gs + pushf + and BYTE [esp+1], 0xFE ; Clear Trap Flag + popf + mov eax, dr0 push eax ; Debug Register 0, Current Thread @@ -92,8 +96,10 @@ SchedulerBase: %endif call Proc_Scheduler +[global scheduler_return] +scheduler_return: ; Used by some hackery in Proc_DumpThreadCPUState - add esp, 4 ; Remove Argument + add esp, 4 ; Remove CPU Number (thread is poped later) %if USE_MP test ebx, ebx @@ -119,7 +125,7 @@ SchedulerBase: pop ds popa - add esp, 4 ; CPU ID + add esp, 4*2 ; CPU ID + Dummy error code ; No Error code / int num iret @@ -140,9 +146,10 @@ SpawnTask: ; 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 @@ -235,7 +242,7 @@ Proc_ReturnToUser: .justKillIt: xor eax, eax xor ebx, ebx - dec ebx + dec ebx ; EBX = -1 int 0xAC [global GetCPUNum] @@ -247,6 +254,15 @@ GetCPUNum: ; TODO: Store in debug registers 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