Skip to content

Commit

Permalink
WINDOWS: replace setjmp/longjmp with their equivalent in Intel syntax…
Browse files Browse the repository at this point in the history
… per the objdump disassembler
  • Loading branch information
vtjnash committed Jan 15, 2014
1 parent 4efb1f5 commit 202668d
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 74 deletions.
26 changes: 13 additions & 13 deletions src/support/_longjmp.win32.S
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@
* The previous signal state is NOT restored.
*/

.intel_syntax
ENTRY(jl_longjmp)
movl 4(%esp),%edx
movl 8(%esp),%eax
movl 0(%edx),%ebp
movl 4(%edx),%ebx
movl 8(%edx),%edi
movl 12(%edx),%esi
movl 16(%edx),%esp
movl 20(%edx),%ecx
testl %eax,%eax
jnz 1f
incl %eax
1: movl %ecx,0(%esp)
mov edx,DWORD PTR [esp+0x04]
mov eax,DWORD PTR [esp+0x08]
mov ebp,DWORD PTR [edx+0x00]
mov ebx,DWORD PTR [edx+0x04]
mov edi,DWORD PTR [edx+0x08]
mov esi,DWORD PTR [edx+0x0c]
mov esp,DWORD PTR [edx+0x10]
mov ecx,DWORD PTR [edx+0x14]
test eax,eax
jne 1f
inc eax
1: mov DWORD PTR [esp],ecx
ret
END(jl_longjmp)

52 changes: 26 additions & 26 deletions src/support/_longjmp.win64.S
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
#include "../../deps/openlibm/amd64/bsd_asm.h"

.intel_syntax noprefix
ENTRY(jl_longjmp)
movq 8(%rcx),%rbx
movq 16(%rcx),%rsp
movq 24(%rcx),%rbp
movq 32(%rcx),%rsi
movq 40(%rcx),%rdi
movq 48(%rcx),%r12
movq 56(%rcx),%r13
movq 64(%rcx),%r14
movq 72(%rcx),%r15
movq 80(%rcx),%r8
movaps 96(%rcx),%xmm6
movaps 112(%rcx),%xmm7
movaps 128(%rcx),%xmm8
movaps 144(%rcx),%xmm9
movaps 160(%rcx),%xmm10
movaps 176(%rcx),%xmm11
movaps 192(%rcx),%xmm12
movaps 208(%rcx),%xmm13
movaps 224(%rcx),%xmm14
movaps 240(%rcx),%xmm15

movl %edx,%eax
testl %eax,%eax
jnz 1f
incl %eax
1: movq %r8,0(%rsp)
mov rbx,QWORD PTR [rcx+0x08]
mov rsp,QWORD PTR [rcx+0x10]
mov rbp,QWORD PTR [rcx+0x18]
mov rsi,QWORD PTR [rcx+0x20]
mov rdi,QWORD PTR [rcx+0x28]
mov r12,QWORD PTR [rcx+0x30]
mov r13,QWORD PTR [rcx+0x38]
mov r14,QWORD PTR [rcx+0x40]
mov r15,QWORD PTR [rcx+0x48]
mov r8, QWORD PTR [rcx+0x50]
movaps xmm6,XMMWORD PTR [rcx+0x60]
movaps xmm7,XMMWORD PTR [rcx+0x70]
movaps xmm8,XMMWORD PTR [rcx+0x80]
movaps xmm9,XMMWORD PTR [rcx+0x90]
movaps xmm10,XMMWORD PTR [rcx+0xa0]
movaps xmm11,XMMWORD PTR [rcx+0xb0]
movaps xmm12,XMMWORD PTR [rcx+0xc0]
movaps xmm13,XMMWORD PTR [rcx+0xd0]
movaps xmm14,XMMWORD PTR [rcx+0xe0]
movaps xmm15,XMMWORD PTR [rcx+0xf0]
mov eax,edx
test eax,eax
jne 1f
inc eax
1: mov QWORD PTR [rsp],r8
ret
END(jl_longjmp)
20 changes: 10 additions & 10 deletions src/support/_setjmp.win32.S
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@
* The previous signal state is NOT restored.
*/

.intel_syntax
ENTRY(jl_setjmp)
movl 4(%esp),%eax
movl 0(%esp),%edx
movl %ebp, 0(%eax) /* rta */
movl %ebx, 4(%eax)
movl %edi, 8(%eax)
movl %esi,12(%eax)
movl %esp,16(%eax)
movl %edx,20(%eax)
xorl %eax,%eax
mov eax,DWORD PTR [esp+0x04]
mov edx,DWORD PTR [esp+0x00]
mov DWORD PTR [eax+0x00],ebp /* rta */
mov DWORD PTR [eax+0x04],ebx
mov DWORD PTR [eax+0x08],edi
mov DWORD PTR [eax+0x0c],esi
mov DWORD PTR [eax+0x10],esp
mov DWORD PTR [eax+0x14],edx
xor eax,eax
ret
END(jl_setjmp)

50 changes: 25 additions & 25 deletions src/support/_setjmp.win64.S
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
#include "../../deps/openlibm/amd64/bsd_asm.h"

.intel_syntax noprefix
ENTRY(jl_setjmp)
movq 0(%rsp),%rdx
movq $0,0(%rcx)
movq %rbx,8(%rcx)
movq %rsp,16(%rcx)
movq %rbp,24(%rcx)
movq %rsi,32(%rcx)
movq %rdi,40(%rcx)
movq %r12,48(%rcx)
movq %r13,56(%rcx)
movq %r14,64(%rcx)
movq %r15,72(%rcx)
movq %rdx,80(%rcx)
movq $0,88(%rcx)
movaps %xmm6,96(%rcx)
movaps %xmm7,112(%rcx)
movaps %xmm8,128(%rcx)
movaps %xmm9,144(%rcx)
movaps %xmm10,160(%rcx)
movaps %xmm11,176(%rcx)
movaps %xmm12,192(%rcx)
movaps %xmm13,208(%rcx)
movaps %xmm14,224(%rcx)
movaps %xmm15,240(%rcx)

xorq %rax,%rax
mov rdx,QWORD PTR [rsp]
mov QWORD PTR [rcx],0x0
mov QWORD PTR [rcx+0x08],rbx
mov QWORD PTR [rcx+0x10],rsp
mov QWORD PTR [rcx+0x18],rbp
mov QWORD PTR [rcx+0x20],rsi
mov QWORD PTR [rcx+0x28],rdi
mov QWORD PTR [rcx+0x30],r12
mov QWORD PTR [rcx+0x38],r13
mov QWORD PTR [rcx+0x40],r14
mov QWORD PTR [rcx+0x48],r15
mov QWORD PTR [rcx+0x50],rdx
mov QWORD PTR [rcx+0x58],0x0
movaps XMMWORD PTR [rcx+0x60],xmm6
movaps XMMWORD PTR [rcx+0x70],xmm7
movaps XMMWORD PTR [rcx+0x80],xmm8
movaps XMMWORD PTR [rcx+0x90],xmm9
movaps XMMWORD PTR [rcx+0xa0],xmm10
movaps XMMWORD PTR [rcx+0xb0],xmm11
movaps XMMWORD PTR [rcx+0xc0],xmm12
movaps XMMWORD PTR [rcx+0xd0],xmm13
movaps XMMWORD PTR [rcx+0xe0],xmm14
movaps XMMWORD PTR [rcx+0xf0],xmm15
xor rax,rax
ret
END(jl_setjmp)

0 comments on commit 202668d

Please sign in to comment.