1/*
2 * Copyright 2005, Ingo Weinhold <bonefish@cs.tu-berlin.de>. All rights
3 * reserved. Distributed under the terms of the Haiku License.
4 */
5
6#include <asm_defs.h>
7
8#include "setjmp_internal.h"
9
10/* int __siglongjmp(jmp_buf buffer, int value) */
11FUNCTION(siglongjmp):
12FUNCTION(longjmp):
13FUNCTION(_longjmp):
14	// a0: buffer, d0: saveMask
15	move.l	(4,%a7),%a0
16	move.l	(8,%a7),%d0
17
18	// restore non-volatile general purpose registers
19	movem.l	(%a0),%d2-%d7/%a2-%a7
20
21	// restore special registers (link, condition)
22	move.w	(JMP_REGS_CCR,%a0),%d0
23	move	%d0,%ccr
24	move.l	(JMP_REGS_PC,%a0),(%a7)
25
26	jmp	__longjmp_return
27FUNCTION_END(siglongjmp)
28FUNCTION_END(longjmp)
29FUNCTION_END(_longjmp)
30
31#pragma weak longjmp=siglongjmp
32