summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/setjmp/nt32/longjmp.s18
-rw-r--r--src/setjmp/nt32/setjmp.s14
2 files changed, 31 insertions, 1 deletions
diff --git a/src/setjmp/nt32/longjmp.s b/src/setjmp/nt32/longjmp.s
index 73b2e61..045b93d 100644
--- a/src/setjmp/nt32/longjmp.s
+++ b/src/setjmp/nt32/longjmp.s
@@ -10,7 +10,23 @@
___longjmp:
__longjmp:
_longjmp:
- test %edx, %edx # is val zero?
+ movl 4(%esp), %ecx # jump buffer
+ movl 8(%esp), %eax # val
+
+ test %eax, %eax # is val zero?
+ jne 1f # no: return val
+ xor $1, %eax # yes: return one
+
+1:
+ movl 20(%ecx), %esi # restore regs
+ movl 16(%ecx), %edi
+ movl 12(%ecx), %ebp
+ movl 8(%ecx), %ebx
+
+ movl 4(%ecx), %esp # original stack pointer
+
+ movl (%ecx), %edx # original return address
+ jmp *%edx
.section .got$longjmp
.global __imp__longjmp
diff --git a/src/setjmp/nt32/setjmp.s b/src/setjmp/nt32/setjmp.s
index 7ef6485..d00fba0 100644
--- a/src/setjmp/nt32/setjmp.s
+++ b/src/setjmp/nt32/setjmp.s
@@ -10,6 +10,20 @@
___setjmp:
__setjmp:
_setjmp:
+ movl 4(%esp), %edx # jump buffer
+
+ movl (%esp), %eax # return address
+ movl %eax, (%edx)
+
+ leal 4(%esp), %ecx # caller's stack pointer
+ movl %ecx, 4(%edx)
+
+ movl %ebx, 8(%edx)
+ movl %ebp, 12(%edx)
+ movl %edi, 16(%edx)
+ movl %esi, 20(%edx)
+
+ xor %eax,%eax
ret
.section .got$setjmp,"r"