17 mov rax, start64.himem
22 mov rax, 0x1F201F201F201F20 ; Set the screen to White on blue, space (4 characters)
28 mov rsp, gInitialKernelStack
46 mov al, [gs:104] ; End of TSS
49 KSTACK_USERSTATE_SIZE equ (16+1+5)*8 ; GPRegs, CPU, IRET
50 [global Proc_ReturnToUser]
51 [extern Proc_GetCurThread]
53 ; RBP is the handler to use
55 call Proc_GetCurThread
57 ; EAX is the current thread
59 mov rax, [rbx+40] ; Get Kernel Stack
60 sub rax, KSTACK_USERSTATE_SIZE
63 ; NOTE: This can cause corruption if the signal happens while the user
64 ; has called a kernel operation.
65 ; Good thing this can only be called on a user fault.
68 ; Get and alter User SP
69 mov rcx, [rax+KSTACK_USERSTATE_SIZE-3*8]
70 mov rdx, [rbx+60] ; Get Signal Number
72 mov rax, User_Syscall_RetAndExit
76 ; Restore Segment Registers
83 push 0x202 ; RFLAGS (IF and Rsvd)
89 ; int CallWithArgArray(void *Ptr, int NArgs, Uint *Args)
90 ; Call a function passing the array as arguments
91 [global CallWithArgArray]
95 mov rcx, [rbp+3*8] ; Get NArgs
99 mov rax, [rdx+rcx*8-8]
110 User_Syscall_RetAndExit:
112 jmp User_Syscall_Exit
119 [global gInitialKernelStack]