1/* 2** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 3** Distributed under the terms of the Haiku License. 4*/ 5 6#include "setjmp_internal.h" 7 8 9/** This is a BeOS compatible siglongjmp() implementation; 10 * longjmp() and _longjmp() are both calling this function. 11 */ 12 13 14/* int __siglongjmp(jmp_buf buffer, int value) */ 15FUNCTION(siglongjmp): 16FUNCTION(longjmp): 17FUNCTION(_longjmp): 18 mov 4(%esp), %ecx 19 mov 8(%esp), %eax 20 21 // restore registers 22 mov JMP_REGS_EBX(%ecx), %ebx 23 mov JMP_REGS_ESI(%ecx), %esi 24 mov JMP_REGS_EDI(%ecx), %edi 25 mov JMP_REGS_EBP(%ecx), %ebp 26 mov JMP_REGS_ESP(%ecx), %esp 27 28 // prepare the stack so that we will return to the setjmp() program location 29 mov JMP_REGS_PC(%ecx), %edx 30 push %edx // return address 31 32 // let __setjmp_save_sigs deal with the signal mask and the return value 33 push %eax // value 34 push %ecx // buffer 35 call __longjmp_return 36 add $8, %esp 37 38 ret 39 40 41#pragma weak longjmp=siglongjmp 42