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]
42 ; Call MM_Clone (with bNoUserCopy flag)
46 mov rsi, [rsp+0x30] ; Saved version of RSI
54 ; mov rsi, 0x800000000000
68 ; Return RSI as the RSP value
78 mov rsp, [rsp-0x60] ; Restore RSP from the saved value
79 mov [rsp], rax ; Restore return address
85 ; rsi = Old RSP save loc
87 ; rcx = Old RIP save loc
92 ; Save state RIP and RSP
93 lea rax, [rel .restore]
97 ; Change CR3 if requested
102 ; Make sure the stack is valid before jumping
112 ; Restore point for saved state
115 xor eax, eax ; Return zero
118 [global Proc_InitialiseSSE]
121 or ax, (1 << 9)|(1 << 10) ; Set OSFXSR and OSXMMEXCPT
124 and ax, ~(1 << 2) ; Clear EM
125 or rax, (1 << 1) ; Set MP
128 [global Proc_DisableSSE]
131 or ax, 1 << 3 ; Set TS
134 [global Proc_EnableSSE]
137 and ax, ~(1 << 3) ; Clear TS
141 [global Proc_SaveSSE]
145 [global Proc_RestoreSSE]