scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit 097cb6692dd6ec81b8101b3800550c09077cc6c4
parent 48dd8628d8c5a4570782375bf69c2220317cc5eb
Author: zerous Naveen Narayanan <zerous@nocebo.space>
Date:   Sat, 16 Nov 2019 13:43:45 +0100

Update setjmp.s and longjmp.s for i386/linux

This version respects %ecx unlike the last one.

Diffstat:
Msrc/libc/arch/i386/longjmp.s | 20+++++++++++---------
Msrc/libc/arch/i386/setjmp.s | 23++++++++++++-----------
2 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/src/libc/arch/i386/longjmp.s b/src/libc/arch/i386/longjmp.s @@ -1,19 +1,21 @@ .file "longjmp.s" .text - .globl _longjmp + .globl longjmp,_longjmp _longjmp: +longjmp: mov 4(%esp),%edx mov 8(%esp),%eax test %eax,%eax 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 diff --git 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