iPXE
rmsetjmp.h
Go to the documentation of this file.
00001 #ifndef _RMSETJMP_H
00002 #define _RMSETJMP_H
00003 
00004 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00005 
00006 #include <setjmp.h>
00007 #include <realmode.h>
00008 
00009 /** A real-mode-extended jump buffer */
00010 typedef struct {
00011         /** Jump buffer */
00012         jmp_buf env;
00013         /** Real-mode stack pointer */
00014         segoff_t rm_stack;
00015 } rmjmp_buf[1];
00016 
00017 #define rmsetjmp( _env ) ( {                                    \
00018         (_env)->rm_stack.segment = rm_ss;                       \
00019         (_env)->rm_stack.offset = rm_sp;                        \
00020         setjmp ( (_env)->env ); } )                             \
00021 
00022 #define rmlongjmp( _env, _val ) do {                            \
00023         rm_ss = (_env)->rm_stack.segment;                       \
00024         rm_sp = (_env)->rm_stack.offset;                        \
00025         longjmp ( (_env)->env, (_val) );                        \
00026         } while ( 0 )
00027 
00028 #endif /* _RMSETJMP_H */