[contrib] Allow Network Protocol header to display in rom-o-matic
[gpxe.git] / src / arch / i386 / include / setjmp.h
blob5d3c11b69b086995dedd8eed6d83d178f7781eae
1 #ifndef ETHERBOOT_SETJMP_H
2 #define ETHERBOOT_SETJMP_H
4 FILE_LICENCE ( GPL2_OR_LATER );
6 #include <stdint.h>
7 #include <realmode.h>
9 /** A jump buffer */
10 typedef struct {
11 uint32_t retaddr;
12 uint32_t ebx;
13 uint32_t esp;
14 uint32_t ebp;
15 uint32_t esi;
16 uint32_t edi;
17 } jmp_buf[1];
19 /** A real-mode-extended jump buffer */
20 typedef struct {
21 jmp_buf env;
22 uint16_t rm_ss;
23 uint16_t rm_sp;
24 } rmjmp_buf[1];
26 extern int __asmcall setjmp ( jmp_buf env );
27 extern void __asmcall longjmp ( jmp_buf env, int val );
29 #define rmsetjmp( _env ) ( { \
30 (_env)->rm_ss = rm_ss; \
31 (_env)->rm_sp = rm_sp; \
32 setjmp ( (_env)->env ); } ) \
34 #define rmlongjmp( _env, _val ) do { \
35 rm_ss = (_env)->rm_ss; \
36 rm_sp = (_env)->rm_sp; \
37 longjmp ( (_env)->env, (_val) ); \
38 } while ( 0 )
40 #endif /* ETHERBOOT_SETJMP_H */