1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
| .CODE
st_swap: lea rax , [rsp + 8] lea rsp , [rcx + 112] push rax push rbx push rcx push rdx push QWORD PTR [rax - 8] push rsi push rdi push rbp push r8 push r9 push r12 push r13 push r14 push r15 ; load NT_TIB mov r10, gs:[030h] ; save fiber local storage mov rax, [r10+020h] mov QWORD PTR [rcx + 112], rax ; save current deallocation stack mov rax, [r10+01478h] mov QWORD PTR [rcx + 112 + 8], rax ; save current stack limit mov rax, [r10+010h] mov QWORD PTR [rcx + 112 + 8 * 2], rax ; save current stack base mov rax, [r10+08h] mov QWORD PTR [rcx + 112 + 8 * 3], rax ; restore fiber local storage mov rax, QWORD PTR [rdx + 112] mov [r10+020h], rax ; restore current deallocation stack mov rax, QWORD PTR [rdx + 112 + 8] mov [r10+01478h], rax ; restore current stack limit mov rax, QWORD PTR [rdx + 112 + 8 * 2] mov [r10+010h], rax ; restore current stack base mov rax, QWORD PTR [rdx + 112 + 8 * 3] mov [r10+08h], rax mov rsp,rdx pop r15 pop r14 pop r13 pop r12 pop r9 pop r8 pop rbp pop rdi pop rsi pop rax pop rdx pop rcx pop rbx pop rsp push rax xor eax,eax ret
st_save_fpu: add rcx,15 and rcx,0fffffffffffffff0h fxsave [rcx] xor eax,eax ret
st_restore_fpu: add rcx,15 and rcx,0fffffffffffffff0h fxrstor [rcx] xor eax,eax ret
public st_swap, st_save_fpu, st_restore_fpu
END
|