aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/include/setjmp.h
blob: a7597e028746d32c05ce83572287516c96d09234 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
 * PSn00bSDK standard library
 * (C) 2023 spicyjpeg - MPL licensed
 *
 * This setjmp() implementation is compatible with the one in the BIOS, making
 * it possible to pass a jmp_buf structure as-is to BIOS functions such as
 * HookEntryInt().
 */

#pragma once

#include <stdint.h>

typedef struct {
	uint32_t ra, sp, fp;
	uint32_t s0, s1, s2, s3, s4, s5, s6, s7;
	uint32_t gp;
} JumpBuffer;

typedef JumpBuffer jmp_buf[1];

#ifdef __cplusplus
extern "C" {
#endif

int setjmp(jmp_buf buf);
void longjmp(jmp_buf buf, int value);

#ifdef __cplusplus
}
#endif