From 818fc0125e7d73fdf4f1a94f178254e5d05c9831 Mon Sep 17 00:00:00 2001 From: rsc Date: Tue, 28 Aug 2007 12:48:33 +0000 Subject: replace setjmp/longjmp with swtch --- setjmp.S | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 setjmp.S (limited to 'setjmp.S') diff --git a/setjmp.S b/setjmp.S deleted file mode 100644 index 3fe23c5..0000000 --- a/setjmp.S +++ /dev/null @@ -1,49 +0,0 @@ -# int setjmp(struct jmpbuf *jmp); -# void longjmp(struct jmpbuf *jmp); -# -# Setjmp saves its stack environment in jmp for later use by longjmp. -# It returns 0. -# -# Longjmp restores the environment saved by the last call of setjmp. -# It then causes execution to continue as if the call of setjmp -# had just returned 1. -# -# The caller of setjmp must not itself have returned in the interim. -# All accessible data have values as of the time longjmp was called. -# -# [Description, but not code, borrowed from Plan 9.] - -.globl setjmp -setjmp: - movl 4(%esp), %eax - - movl %ebx, 0(%eax) - movl %ecx, 4(%eax) - movl %edx, 8(%eax) - movl %esi, 12(%eax) - movl %edi, 16(%eax) - movl %esp, 20(%eax) - movl %ebp, 24(%eax) - pushl 0(%esp) # %eip - popl 28(%eax) - - movl $0, %eax # return value - ret - -.globl longjmp -longjmp: - movl 4(%esp), %eax - - movl 0(%eax), %ebx - movl 4(%eax), %ecx - movl 8(%eax), %edx - movl 12(%eax), %esi - movl 16(%eax), %edi - movl 20(%eax), %esp - movl 24(%eax), %ebp - - addl $4, %esp # pop and discard %eip - pushl 28(%eax) # push new %eip - - movl $1, %eax # return value (appears to come from setjmp!) - ret -- cgit v1.2.3