scc

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

commit fe20c94e63837f6864cdc001e746027fcb19eac0
parent b5aa89ba22f93e3fe5d5edbe35badce27ab37a1f
Author: zerous Naveen Narayanan <zerous@nocebo.space>
Date:   Wed,  4 Sep 2019 00:20:50 +0200

Add setjmp.s and longjmp.s for i386

Diffstat:
Msrc/libc/arch/i386/Makefile | 1+
Asrc/libc/arch/i386/longjmp.s | 19+++++++++++++++++++
Asrc/libc/arch/i386/setjmp.s | 16++++++++++++++++
3 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/src/libc/arch/i386/Makefile b/src/libc/arch/i386/Makefile @@ -3,6 +3,7 @@ PROJECTDIR =../../../.. include $(PROJECTDIR)/scripts/rules.mk include ../../rules.mk +OBJS = longjmp.o setjmp.o DIRS = netbsd openbsd dragonfly linux darwin all: $(OBJS) $(SYS) diff --git a/src/libc/arch/i386/longjmp.s b/src/libc/arch/i386/longjmp.s @@ -0,0 +1,19 @@ + .file "longjmp.s" + + .text + .globl _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 diff --git a/src/libc/arch/i386/setjmp.s b/src/libc/arch/i386/setjmp.s @@ -0,0 +1,16 @@ + .file "setjmp.s" + + .text + .globl _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 + ret