Skip to content

Commit

Permalink
attempt to get setjmp and longjmp assembly working in MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
tkelman committed Mar 25, 2014
1 parent dc6d167 commit e97ef83
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/support/_longjmp.win32.S
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@

#ifndef _MSC_VER
.intel_syntax
ENTRY(jl_longjmp)
#else
.model small,C
.code
jl_longjmp proc
#endif
ENTRY(jl_longjmp)
mov edx,DWORD PTR [esp+4]
mov eax,DWORD PTR [esp+8]
mov ebp,DWORD PTR [edx+0]
Expand All @@ -70,4 +72,7 @@ ENTRY(jl_longjmp)
inc eax
a: mov DWORD PTR [esp],ecx
ret
#ifdef _MSC_VER
jl_longjmp endp
#endif
END(jl_longjmp)
8 changes: 7 additions & 1 deletion src/support/_longjmp.win64.S
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

#ifndef _MSC_VER
.intel_syntax noprefix
#endif
ENTRY(jl_longjmp)
#else
.code
jl_longjmp proc
#endif
mov rbx,QWORD PTR [rcx+8]
mov rsp,QWORD PTR [rcx+16]
mov rbp,QWORD PTR [rcx+24]
Expand All @@ -30,4 +33,7 @@ ENTRY(jl_longjmp)
inc eax
a: mov QWORD PTR [rsp],r8
ret
#ifdef _MSC_VER
jl_longjmp endp
#endif
END(jl_longjmp)
7 changes: 6 additions & 1 deletion src/support/_setjmp.win32.S
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@

#ifndef _MSC_VER
.intel_syntax
ENTRY(jl_setjmp)
#else
.model small,C
.code
jl_setjmp proc
#endif
ENTRY(jl_setjmp)
mov eax,DWORD PTR [esp+4]
mov edx,DWORD PTR [esp+0]
mov DWORD PTR [eax+0],ebp /* rta */
Expand All @@ -67,4 +69,7 @@ ENTRY(jl_setjmp)
mov DWORD PTR [eax+20],edx
xor eax,eax
ret
#ifdef _MSC_VER
jl_setjmp endp
#endif
END(jl_setjmp)
8 changes: 7 additions & 1 deletion src/support/_setjmp.win64.S
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

#ifndef _MSC_VER
.intel_syntax noprefix
#endif
ENTRY(jl_setjmp)
#else
.code
jl_setjmp proc
#endif
mov rdx,QWORD PTR [rsp]
mov QWORD PTR [rcx],0
mov QWORD PTR [rcx+8],rbx
Expand All @@ -29,4 +32,7 @@ ENTRY(jl_setjmp)
movaps XMMWORD PTR [rcx+240],xmm15
xor rax,rax
ret
#ifdef _MSC_VER
jl_setjmp endp
#endif
END(jl_setjmp)

0 comments on commit e97ef83

Please sign in to comment.