ref: f55a034c33fd1a5b6b35f78abeef23741cb6f65f
parent: f436bcd36fc219ba013384977c368019c3bc91a7
author: zerous Naveen Narayanan <[email protected]>
date: Sat Nov 16 08:43:45 EST 2019
Update setjmp.s and longjmp.s for i386/linux This version respects %ecx unlike the last one.
--- a/src/libc/arch/i386/longjmp.s
+++ b/src/libc/arch/i386/longjmp.s
@@ -1,8 +1,9 @@
.file "longjmp.s"
.text
- .globl _longjmp
+ .globl longjmp,_longjmp
_longjmp:
+longjmp:
mov 4(%esp),%edx
mov 8(%esp),%eax
test %eax,%eax
@@ -9,11 +10,12 @@
jnz 1f
inc %eax
1:
- mov (%edx),%ebx
- mov 4(%edx),%esi
- mov 8(%edx),%edi
- mov 12(%edx),%ebp
- mov 16(%edx),%ecx
- mov %ecx,%esp
- mov 20(%edx),%ecx
- jmp *%ecx
+ movl (%edx),%ebx
+ movl 4(%edx),%ecx
+ movl 8(%edx),%esi
+ movl 12(%edx),%edi
+ movl 16(%edx),%ebp
+ movl 20(%edx),%esp
+ pushl 24(%edx)
+ popl %edx
+ jmp *%edx
--- a/src/libc/arch/i386/setjmp.s
+++ b/src/libc/arch/i386/setjmp.s
@@ -1,16 +1,17 @@
.file "setjmp.s"
.text
- .globl _setjmp
+ .globl setjmp,_setjmp
_setjmp:
- mov 4(%esp),%eax
- mov %ebx,(%eax)
- mov %esi,4(%eax)
- mov %edi,8(%eax)
- mov %ebp,12(%eax)
- lea 4(%esp),%ecx
- mov %ecx,16(%eax)
- mov (%esp),%ecx
- mov %ecx,20(%eax)
- xor %eax,%eax
+setjmp:
+ movl 4(%esp),%eax
+ movl %ebx,(%eax)
+ movl %ecx,4(%eax)
+ movl %esi,8(%eax)
+ movl %edi,12(%eax)
+ movl %ebp,16(%eax)
+ movl %esp,20(%eax)
+ pushl (%esp)
+ popl 24(%eax)
+ xor %eax,%eax
ret