From b9c4c2676bf8e3851eebaf22930512bbae9d5612 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 16 Feb 2016 15:48:03 +0000 Subject: [PATCH] [libc] Split rmsetjmp() and rmlongjmp() into a separate rmsetjmp.h Signed-off-by: Michael Brown --- src/arch/i386/include/comboot.h | 2 +- src/arch/i386/include/pxe_call.h | 2 +- src/arch/i386/include/rmsetjmp.h | 28 +++++++++++++++++++ src/arch/i386/include/setjmp.h | 20 ------------- src/arch/i386/interface/pxe/pxe_call.c | 2 +- src/arch/i386/interface/pxe/pxe_preboot.c | 2 +- .../i386/interface/syslinux/comboot_call.c | 2 +- 7 files changed, 33 insertions(+), 25 deletions(-) create mode 100644 src/arch/i386/include/rmsetjmp.h diff --git a/src/arch/i386/include/comboot.h b/src/arch/i386/include/comboot.h index 2d2f04fe1..5cb1ba54c 100644 --- a/src/arch/i386/include/comboot.h +++ b/src/arch/i386/include/comboot.h @@ -10,7 +10,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include -#include +#include #include /** Segment used for COMBOOT PSP and image */ diff --git a/src/arch/i386/include/pxe_call.h b/src/arch/i386/include/pxe_call.h index cbd548318..2ad0a9505 100644 --- a/src/arch/i386/include/pxe_call.h +++ b/src/arch/i386/include/pxe_call.h @@ -10,7 +10,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #include #include -#include +#include struct net_device; diff --git a/src/arch/i386/include/rmsetjmp.h b/src/arch/i386/include/rmsetjmp.h new file mode 100644 index 000000000..3470be477 --- /dev/null +++ b/src/arch/i386/include/rmsetjmp.h @@ -0,0 +1,28 @@ +#ifndef _RMSETJMP_H +#define _RMSETJMP_H + +FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); + +#include +#include + +/** 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 */ diff --git a/src/arch/i386/include/setjmp.h b/src/arch/i386/include/setjmp.h index fe1a9ef4d..98566696a 100644 --- a/src/arch/i386/include/setjmp.h +++ b/src/arch/i386/include/setjmp.h @@ -4,7 +4,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #include -#include /** A jump buffer */ typedef struct { @@ -22,29 +21,10 @@ typedef struct { uint32_t ebp; } jmp_buf[1]; -/** A real-mode-extended jump buffer */ -typedef struct { - /** Jump buffer */ - jmp_buf env; - /** Real-mode stack pointer */ - segoff_t rm_stack; -} rmjmp_buf[1]; - extern int __asmcall __attribute__ (( returns_twice )) setjmp ( jmp_buf env ); extern void __asmcall __attribute__ (( noreturn )) longjmp ( jmp_buf env, int val ); -#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 /* _SETJMP_H */ diff --git a/src/arch/i386/interface/pxe/pxe_call.c b/src/arch/i386/interface/pxe/pxe_call.c index ed17a96a1..414b356d5 100644 --- a/src/arch/i386/interface/pxe/pxe_call.c +++ b/src/arch/i386/interface/pxe/pxe_call.c @@ -27,7 +27,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #include #include #include -#include +#include #include #include #include diff --git a/src/arch/i386/interface/pxe/pxe_preboot.c b/src/arch/i386/interface/pxe/pxe_preboot.c index cc9c052ed..09e721b34 100644 --- a/src/arch/i386/interface/pxe/pxe_preboot.c +++ b/src/arch/i386/interface/pxe/pxe_preboot.c @@ -33,7 +33,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #include #include #include -#include #include #include #include @@ -44,6 +43,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #include #include #include +#include #include "pxe.h" #include "pxe_call.h" diff --git a/src/arch/i386/interface/syslinux/comboot_call.c b/src/arch/i386/interface/syslinux/comboot_call.c index 69d94c407..d70340c65 100644 --- a/src/arch/i386/interface/syslinux/comboot_call.c +++ b/src/arch/i386/interface/syslinux/comboot_call.c @@ -32,7 +32,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include #include #include -#include +#include #include #include #include