1/* setjmp and longjmp. Use of these functions is deprecated. */ 2 3FILE_LICENCE ( GPL2_OR_LATER ) 4 5 .text 6 .arch i386 7 .code32 8 9/************************************************************************** 10SETJMP - Save stack context for non-local goto 11**************************************************************************/ 12 .globl setjmp 13setjmp: 14 movl 4(%esp),%ecx /* jmpbuf */ 15 movl 0(%esp),%edx /* return address */ 16 movl %edx,0(%ecx) 17 movl %ebx,4(%ecx) 18 movl %esp,8(%ecx) 19 movl %ebp,12(%ecx) 20 movl %esi,16(%ecx) 21 movl %edi,20(%ecx) 22 movl $0,%eax 23 ret 24 25/************************************************************************** 26LONGJMP - Non-local jump to a saved stack context 27**************************************************************************/ 28 .globl longjmp 29longjmp: 30 movl 4(%esp),%edx /* jumpbuf */ 31 movl 8(%esp),%eax /* result */ 32 movl 0(%edx),%ecx 33 movl 4(%edx),%ebx 34 movl 8(%edx),%esp 35 movl 12(%edx),%ebp 36 movl 16(%edx),%esi 37 movl 20(%edx),%edi 38 cmpl $0,%eax 39 jne 1f 40 movl $1,%eax 411: movl %ecx,0(%esp) 42 ret 43