Merge remote-tracking branch 'redux/master' into sh4-pool
[tamarin-stm.git] / platform / win32 / win64setjmp.asm
blob07738f78096b8d346f9b7be707cdec96c16c310f
2 PUBLIC longjmp64
3 PUBLIC _setjmp3
4 PUBLIC modInternal
6 .data?
8 .code
10 _setjmp3 : ; proc jmp_buf : qword arg : qword
12 ; RCX = jmp_buf structure
13 ; RDX = addr to jump back to
15 mov qword ptr [rcx],rdx
16 mov qword ptr [rcx+8],rbx
17 mov qword ptr [rcx+18h],rbp
18 mov qword ptr [rcx+20h],rsi
19 mov qword ptr [rcx+28h],rdi
20 mov qword ptr [rcx+30h],r12
21 mov qword ptr [rcx+38h],r13
22 mov qword ptr [rcx+40h],r14
23 mov qword ptr [rcx+48h],r15
24 lea r8,[rsp+8]
25 mov qword ptr [rcx+10h],r8
26 mov r8,qword ptr [rsp]
27 mov qword ptr [rcx+50h],r8
28 stmxcsr dword ptr [rcx+58h]
29 fnstcw word ptr [rcx+5Ch]
30 movdqu xmmword ptr [rcx+60h],xmm6
31 movdqu xmmword ptr [rcx+70h],xmm7
32 movdqu xmmword ptr [rcx+80h],xmm8
33 movdqu xmmword ptr [rcx+90h],xmm9
34 movdqu xmmword ptr [rcx+0A0h],xmm10
35 movdqu xmmword ptr [rcx+0B0h],xmm11
36 movdqu xmmword ptr [rcx+0C0h],xmm12
37 movdqu xmmword ptr [rcx+0D0h],xmm13
38 movdqu xmmword ptr [rcx+0E0h],xmm14
39 movdqu xmmword ptr [rcx+0F0h],xmm15
40 xor eax,eax
41 ret
45 longjmp64: ; proc jmp_buf : qword result qword)
47 mov rax,rdx
49 mov rbx,qword ptr [rcx+8]
50 ; rsp see below
51 ; rbp see below
52 mov rsi,qword ptr [rcx+20h]
53 mov rdi,qword ptr [rcx+28h]
54 mov r12,qword ptr [rcx+30h]
55 mov r13,qword ptr [rcx+38h]
56 mov r14,qword ptr [rcx+40h]
57 mov r15,qword ptr [rcx+48h]
58 ; rip see below
60 ldmxcsr dword ptr [rcx+58h] ; spare?
61 fnclex
62 fldcw word ptr [rcx+5Ch]
64 movdqu xmm6,xmmword ptr [rcx+60h]
65 movdqu xmm7,xmmword ptr [rcx+70h]
66 movdqu xmm8,xmmword ptr [rcx+80h]
67 movdqu xmm9,xmmword ptr [rcx+90h]
68 movdqu xmm10,xmmword ptr [rcx+0A0h]
69 movdqu xmm11,xmmword ptr [rcx+0B0h]
70 movdqu xmm12,xmmword ptr [rcx+0C0h]
71 movdqu xmm13,xmmword ptr [rcx+0D0h]
72 movdqu xmm14,xmmword ptr [rcx+0E0h]
73 movdqu xmm15,xmmword ptr [rcx+0F0h]
75 mov rdx,qword ptr [rcx+50h] ; rip
76 mov rbp,qword ptr [rcx+18h]
77 mov rsp,qword ptr [rcx+10h]
78 jmp rdx
82 modInternal:
84 emms
86 sub rsp,28h
87 movsd mmword ptr [rsp+10h],xmm1
88 movsd mmword ptr [rsp+20h],xmm0
89 fld qword ptr [rsp+10h]
90 fld qword ptr [rsp+20h]
92 ModLoop:
93 fprem
94 wait
95 fnstsw ax
96 test ax,400h
97 jne ModLoop
99 fstp qword ptr [rsp]
100 movlpd xmm0,qword ptr [rsp]
102 add rsp,28h
103 ret