diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2009-09-09 11:34:39 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2009-09-09 11:34:39 -0400 |
commit | 9f985427ffeb877f6eb6531a61c0d51250bdf7f3 (patch) | |
tree | 6c4ef72950230409e2a3e4f9de2463894c83458b /src/farptr.h | |
parent | 372e071ed4b6a66fb371cf13b6f6d14ddd00837a (diff) | |
download | seabios-9f985427ffeb877f6eb6531a61c0d51250bdf7f3.tar.gz |
Replace common segment/offset pairs with struct segoff_s.
Introduce 'struct segoff_s' to more places.
Diffstat (limited to 'src/farptr.h')
-rw-r--r-- | src/farptr.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/farptr.h b/src/farptr.h index 1f3df9d2..acc9d596 100644 --- a/src/farptr.h +++ b/src/farptr.h @@ -190,4 +190,23 @@ extern void __force_link_error__only_in_16bit() __attribute__ ((noreturn)); #endif +// Definition for common 16bit segment/offset pointers. +struct segoff_s { + union { + struct { + u16 offset; + u16 seg; + }; + u32 segoff; + }; +}; +#define SEGOFF(s,o) ({struct segoff_s __so; __so.offset=(o); __so.seg=(s); __so;}) + +static inline struct segoff_s FLATPTR_TO_SEGOFF(void *p) { + return SEGOFF(FLATPTR_TO_SEG(p), FLATPTR_TO_OFFSET(p)); +} +static inline void *SEGOFF_TO_FLATPTR(struct segoff_s so) { + return MAKE_FLATPTR(so.seg, so.offset); +} + #endif // farptr.h |