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