summaryrefslogtreecommitdiff
path: root/src/libc/setjmp.h
blob: 5f987f103e8441d9bf28bc3181a199cb13369681 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#ifndef SETJMP_H
#define SETJMP_H

#include <stdint.h>

// C99 states this should be an array so we can address it without
// the & operator, see prototypes of setjmp and longjmp
// eax, ecx and edx are scratch registers, save the others
// also store the jump address (eip)
typedef struct {
	uint32_t ebx;
	uint32_t esp;
	uint32_t ebp;
	uint32_t esi;
	uint32_t edi;
	uint32_t eip;
} jmp_buf[1];

int setjmp( jmp_buf env );

void longjmp( jmp_buf env, int val );

#endif // SETJMP_H