[libc] Split rmsetjmp() and rmlongjmp() into a separate rmsetjmp.h

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2016-02-16 16:06:25 +00:00
parent 7ecfe7159f
commit b9c4c2676b
7 changed files with 33 additions and 25 deletions
+28
View File
@@ -0,0 +1,28 @@
#ifndef _RMSETJMP_H
#define _RMSETJMP_H
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <setjmp.h>
#include <realmode.h>
/** A real-mode-extended jump buffer */
typedef struct {
/** Jump buffer */
jmp_buf env;
/** Real-mode stack pointer */
segoff_t rm_stack;
} rmjmp_buf[1];
#define rmsetjmp( _env ) ( { \
(_env)->rm_stack.segment = rm_ss; \
(_env)->rm_stack.offset = rm_sp; \
setjmp ( (_env)->env ); } ) \
#define rmlongjmp( _env, _val ) do { \
rm_ss = (_env)->rm_stack.segment; \
rm_sp = (_env)->rm_stack.offset; \
longjmp ( (_env)->env, (_val) ); \
} while ( 0 )
#endif /* _RMSETJMP_H */