1 ; AcessOS Microkernel Version
6 KERNEL_BASE equ 0xC0000000
8 KSTACK_USERSTATE_SIZE equ (4+8+1+5)*4 ; SRegs, GPRegs, CPU, IRET
14 [extern Proc_Scheduler]
15 [global SchedulerBase]
29 mov eax, [esp+12*4] ; CPU Number
30 push eax ; Pus as argument
34 add esp, 4 ; Remove Argument
46 ; No Error code / int num
53 ; Call Proc_Clone with Flags=0
58 add esp, 8 ; Remove arguments from stack
63 ; In child, so now set up stack frame
64 mov ebx, [esp+4] ; Child Function
65 mov edx, [esp+8] ; Argument
69 call Threads_Exit ; Kill Thread
75 ; Calls a user fault handler
77 [global Proc_AlterUserReturnAddr]
78 [extern Proc_GetCurThread]
79 Proc_AlterUserReturnAddr:
80 ; EBP is the handler to use
82 call Proc_GetCurThread
85 ; EAX is the current thread
87 mov eax, [ebx+40] ; Get Kernel Stack
88 sub eax, KSTACK_USERSTATE_SIZE
91 ; NOTE: This can cause corruption if the signal happens while the user
92 ; has called a kernel operation.
93 ; Good thing this can only be called on a user fault.
96 ; Get and alter User SP
97 mov ecx, [eax+KSTACK_USERSTATE_SIZE-12]
98 mov edx, [ebx+60] ; Get Signal Number
100 mov [ecx-8], DWORD User_Syscall_RetAndExit
103 ; Restore Segment Registers
112 push 0x202 ; EFLAGS (IP and Rsvd)
120 User_Syscall_RetAndExit:
122 call User_Syscall_Exit