xref: /haiku/src/system/libroot/posix/arch/x86/siglongjmp.S (revision d3d8b26997fac34a84981e6d2b649521de2cc45a)
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
7#include "setjmp_internal.h"
8
9
10/**	This is a BeOS compatible siglongjmp() implementation;
11 *	longjmp() and _longjmp() are both calling this function.
12 */
13
14
15/* int __siglongjmp(jmp_buf buffer, int value) */
16FUNCTION(siglongjmp):
17FUNCTION(longjmp):
18FUNCTION(_longjmp):
19	mov		4(%esp), %ecx
20	mov		8(%esp), %eax
21
22	// restore registers
23	mov		JMP_REGS_EBX(%ecx), %ebx
24	mov		JMP_REGS_ESI(%ecx), %esi
25	mov		JMP_REGS_EDI(%ecx), %edi
26	mov		JMP_REGS_EBP(%ecx), %ebp
27	mov		JMP_REGS_ESP(%ecx), %esp
28
29	// jump back to the old program location
30	mov		JMP_REGS_PC(%ecx), %edx
31	jmp		*%edx
32
33#pragma weak longjmp=siglongjmp
34