X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Farch%2Fx86%2Fproc.asm;h=5a9ad0aa8acefdc72def6291f772054b461708bd;hb=17aac974ab83a3521f2b49b8de33ae05a00fbe07;hp=944b24dd4d5cd16cdd825515b5b8ca365df7a8fd;hpb=54bf151b1a05b74debdb5f3baec02c18406b74d1;p=tpg%2Facess2.git diff --git a/Kernel/arch/x86/proc.asm b/Kernel/arch/x86/proc.asm index 944b24dd..5a9ad0aa 100644 --- a/Kernel/arch/x86/proc.asm +++ b/Kernel/arch/x86/proc.asm @@ -8,6 +8,26 @@ KERNEL_BASE equ 0xC0000000 KSTACK_USERSTATE_SIZE equ (4+8+1+5)*4 ; SRegs, GPRegs, CPU, IRET [section .text] + +[global NewTaskHeader] +NewTaskHeader: + mov eax, [esp] + mov dr0, eax + xchg bx, bx + + sti + ; TODO: SMP + mov al, 0x20 + out 0x20, al + + mov eax, [esp+4] + add esp, 12 ; Thread, Function, Args + call eax + + push eax ; Ret val + push 0 ; 0 = This Thread + call Threads_Exit + %if USE_MP [extern giMP_TimerCount] [extern gpMP_LocalAPIC] @@ -135,7 +155,7 @@ scheduler_return: ; Used by some hackery in Proc_DumpThreadCPUState SpawnTask: ; Call Proc_Clone with Flags=0 xor eax, eax - push eax +; push eax push eax call Proc_Clone add esp, 8 ; Remove arguments from stack @@ -186,14 +206,10 @@ Proc_ReturnToUser: ; Validate user ESP ; - Page Table mov edx, [eax+KSTACK_USERSTATE_SIZE-12] ; User ESP is at top of kstack - 3*4 - %if USE_PAE - %error PAE Support - %else mov ecx, edx shr ecx, 22 test BYTE [0xFC3F0000+ecx*4], 1 jnz .justKillIt - %endif ; - Page mov ecx, edx shr ecx, 12 @@ -202,13 +218,10 @@ Proc_ReturnToUser: ; Adjust sub edx, 8 ; - Page Table - %if USE_PAE - %else mov ecx, edx shr ecx, 22 test BYTE [0xFC3F0000+ecx*4], 1 jnz .justKillIt - %endif ; - Page mov ecx, edx shr ecx, 12