diff options
author | Helge Deller <deller@gmx.de> | 2021-02-10 18:59:54 +0100 |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2021-09-24 11:10:17 +0200 |
commit | 51106fce17164374d8180dd507426306269f4c25 (patch) | |
tree | 6cb2349025c3b9ff6cc6928d24b7b64734180275 | |
parent | 56661143167304dfd180b9eeb9cfb917274fff39 (diff) | |
download | seabios-hppa-51106fce17164374d8180dd507426306269f4c25.zip seabios-hppa-51106fce17164374d8180dd507426306269f4c25.tar.gz seabios-hppa-51106fce17164374d8180dd507426306269f4c25.tar.bz2 |
biosvar.h: Add accessors for various BIOS data areas
This patch adds or adjust the existing accessors to the various data
areas in a x86 BIOS for usage with a PA-RISC BIOS.
On PA-RISC the x86 areas are emulated as normal variables, stored in
normal RAM and can be accessed directly.
GET_IVT() and SET_IVT() are emulated by a static ivt_table[] array.
Introduce a get_bda_ptr() inline function to return the address of the
Bios Data Area (BDA).
GET_BDA() and SET_BDA() are used to directly access variables from the
BDA.
GET_GLOBAL() is used to access variables directly.
Signed-off-by: Helge Deller <deller@gmx.de>
-rw-r--r-- | src/biosvar.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/biosvar.h b/src/biosvar.h index f61fb6a..ab1d0fd 100644 --- a/src/biosvar.h +++ b/src/biosvar.h @@ -6,6 +6,7 @@ #ifndef __BIOSVAR_H #define __BIOSVAR_H +#include "autoconf.h" // CONFIG_* #include "config.h" // SEG_BDA #include "farptr.h" // GET_FARVAR #include "memmap.h" // SYMBOL @@ -16,6 +17,7 @@ * Interrupt vector table ****************************************************************/ +#if CONFIG_X86 #define GET_IVT(vector) \ GET_FARVAR(SEG_IVT, ((struct rmode_IVT *)0)->ivec[vector]) #define SET_IVT(vector, segoff) \ @@ -26,17 +28,41 @@ extern void func (void); \ SEGOFF(SEG_BIOS, (u32)func - BUILD_BIOS_ADDR); \ }) +#elif CONFIG_PARISC +extern struct segoff_s ivt_table[256]; + +#define GET_IVT(vector) ivt_table[vector] +#define SET_IVT(vector, segoff) ivt_table[vector] = (segoff) + +#define FUNC16(func) ({ SEGOFF(0, 0); }) +#endif /**************************************************************** * Bios Data Area (BDA) ****************************************************************/ +static inline struct bios_data_area_s * +get_bda_ptr(void) +{ +#if CONFIG_X86 + return MAKE_FLATPTR(SEG_BDA, 0); +#elif CONFIG_PARISC + extern struct bios_data_area_s bios_data_area; + return &bios_data_area; +#endif +} + // Accessor functions +#if CONFIG_X86 #define GET_BDA(var) \ GET_FARVAR(SEG_BDA, ((struct bios_data_area_s *)0)->var) #define SET_BDA(var, val) \ SET_FARVAR(SEG_BDA, ((struct bios_data_area_s *)0)->var, (val)) +#elif CONFIG_PARISC +#define GET_BDA(var) get_bda_ptr()->var +#define SET_BDA(var, val) get_bda_ptr()->var = (val) +#endif // Helper function to set the bits of the equipment_list_flags variable. static inline void set_equipment_flags(u16 clear, u16 set) { @@ -97,9 +123,14 @@ static inline u32 __attribute_const get_global_offset(void) { static inline u16 get_global_seg(void) { return GET_SEG(GLOBAL_SEGREG); } +#if CONFIG_X86 #define GET_GLOBAL(var) \ GET_VAR(GLOBAL_SEGREG, *(typeof(&(var)))((void*)&(var) \ + get_global_offset())) +#elif CONFIG_PARISC +#define GET_GLOBAL(var) (var) +#endif + #if MODESEGMENT #define GLOBALFLAT2GLOBAL(var) ((typeof(var))((void*)(var) - BUILD_BIOS_ADDR)) #else |