setjmp.h

Go to the documentation of this file.
00001 #ifndef ETHERBOOT_SETJMP_H
00002 #define ETHERBOOT_SETJMP_H
00003 
00004 FILE_LICENCE ( GPL2_OR_LATER );
00005 
00006 #include <stdint.h>
00007 #include <realmode.h>
00008 
00009 /** A jump buffer */
00010 typedef struct {
00011         uint32_t retaddr;
00012         uint32_t ebx;
00013         uint32_t esp;
00014         uint32_t ebp;
00015         uint32_t esi;
00016         uint32_t edi;
00017 } jmp_buf[1];
00018 
00019 /** A real-mode-extended jump buffer */
00020 typedef struct {
00021         jmp_buf env;
00022         uint16_t rm_ss;
00023         uint16_t rm_sp;
00024 } rmjmp_buf[1];
00025 
00026 extern int __asmcall setjmp ( jmp_buf env );
00027 extern void __asmcall longjmp ( jmp_buf env, int val );
00028 
00029 #define rmsetjmp( _env ) ( {                    \
00030         (_env)->rm_ss = rm_ss;                  \
00031         (_env)->rm_sp = rm_sp;                  \
00032         setjmp ( (_env)->env ); } )             \
00033 
00034 #define rmlongjmp( _env, _val ) do {            \
00035         rm_ss = (_env)->rm_ss;                  \
00036         rm_sp = (_env)->rm_sp;                  \
00037         longjmp ( (_env)->env, (_val) );        \
00038         } while ( 0 )
00039 
00040 #endif /* ETHERBOOT_SETJMP_H */

Generated on Tue Apr 6 20:00:50 2010 for gPXE by  doxygen 1.5.7.1