4 %include "arch/x86_64/include/common.inc.asm"
15 [global NewTaskHeader]
18 ; [rsp+0x08]: Function
19 ; [rsp+0x10]: Argument
23 add rsp, 0x10 ; Reclaim stack space (thread/fcn)
27 ; Quit thread with RAX as the return code
36 [extern MM_DumpTables]
37 [global Proc_CloneInt]
44 mov rsi, [rsp+0x30] ; Saved version of RSI
52 ; mov rsi, 0x800000000000
66 ; Return RSI as the RSP value
76 mov rsp, [rsp-0x60] ; Restore RSP from the saved value
77 mov [rsp], rax ; Restore return address
83 ; rsi = Old RSP save loc
85 ; rcx = Old RIP save loc
90 ; Save state RIP and RSP
91 lea rax, [rel .restore]
95 ; Change CR3 if requested
100 ; Make sure the stack is valid before jumping
110 ; Restore point for saved state
113 xor eax, eax ; Return zero
116 [global Proc_InitialiseSSE]
119 or ax, (1 << 9)|(1 << 10) ; Set OSFXSR and OSXMMEXCPT
122 and ax, ~(1 << 2) ; Clear EM
123 or rax, (1 << 1) ; Set MP
126 [global Proc_DisableSSE]
129 or ax, 1 << 3 ; Set TS
132 [global Proc_EnableSSE]
135 and ax, ~(1 << 3) ; Clear TS
139 [global Proc_SaveSSE]
143 [global Proc_RestoreSSE]