1/*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * William Jolitz. 7 * 8 * %sccs.include.redist.c% 9 */ 10 11#if defined(LIBC_SCCS) && !defined(lint) 12 .asciz "@(#)setjmp.s 5.1 (Berkeley) 04/23/90" 13#endif /* LIBC_SCCS and not lint */ 14 15/* 16 * C library -- _setjmp, _longjmp 17 * 18 * longjmp(a,v) 19 * will generate a "return(v)" from the last call to 20 * setjmp(a) 21 * by restoring registers from the stack. 22 * The previous signal state is restored. 23 */ 24 25#include "DEFS.h" 26 27ENTRY(setjmp) 28 pushl $0 29 call _sigblock 30 popl %edx 31 movl 4(%esp),%ecx 32 movl 0(%esp),%edx 33 movl %edx, 0(%ecx) 34 movl %ebx, 4(%ecx) 35 movl %esp, 8(%ecx) 36 movl %ebp,12(%ecx) 37 movl %esi,16(%ecx) 38 movl %edi,20(%ecx) 39 movl %eax,24(%ecx) 40 movl $0,%eax 41 ret 42 43ENTRY(longjmp) 44 movl 4(%esp),%edx 45 pushl 24(%edx) 46 call _sigsetmask 47 popl %eax 48 movl 4(%esp),%edx 49 movl 8(%esp),%eax 50 movl 0(%edx),%ecx 51 movl 4(%edx),%ebx 52 movl 8(%edx),%esp 53 movl 12(%edx),%ebp 54 movl 16(%edx),%esi 55 movl 20(%edx),%edi 56 cmpl $0,%eax 57 jne 1f 58 movl $1,%eax 591: movl %ecx,0(%esp) 60 ret 61