aboutsummaryrefslogtreecommitdiff
path: root/src/farptr.h
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2008-03-29 14:28:00 -0400
committerKevin O'Connor <kevin@koconnor.net>2008-03-29 14:28:00 -0400
commit46df61c21d72b122606a2a744809002059544568 (patch)
tree820931e63959ad2158ee678f4feff598a255a2da /src/farptr.h
parent840c5349f552512a6e9b7c39d55cc1661dbbc5ed (diff)
downloadseabios-hppa-46df61c21d72b122606a2a744809002059544568.zip
seabios-hppa-46df61c21d72b122606a2a744809002059544568.tar.gz
seabios-hppa-46df61c21d72b122606a2a744809002059544568.tar.bz2
Fix bugs in GET/SET_FARPTR macros.
Diffstat (limited to 'src/farptr.h')
-rw-r--r--src/farptr.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/farptr.h b/src/farptr.h
index cc8cd68..c70c8e0 100644
--- a/src/farptr.h
+++ b/src/farptr.h
@@ -85,11 +85,13 @@ extern void __force_link_error__unknown_type();
// automatically update the %es segment, break the pointer into
// segment/offset, and then make the access.)
#define __GET_FARPTR(ptr) ({ \
- typeof (&(ptr)) __ptr = (ptr); \
- GET_FARVAR(PTR_TO_SEG(__ptr), *(typeof __ptr)PTR_TO_OFFSET(__ptr)); })
+ typeof(&(ptr)) __ptr = &(ptr); \
+ GET_FARVAR(FARPTR_TO_SEG(__ptr) \
+ , *(typeof(__ptr))FARPTR_TO_OFFSET(__ptr)); })
#define __SET_FARPTR(ptr, val) do { \
- typeof (&(ptr)) __ptr = (ptr); \
- SET_FARVAR(PTR_TO_SEG(__ptr), *(typeof __ptr)PTR_TO_OFFSET(__ptr) \
+ typeof (&(ptr)) __ptr = &(ptr); \
+ SET_FARVAR(FARPTR_TO_SEG(__ptr) \
+ , *(typeof(__ptr))FARPTR_TO_OFFSET(__ptr) \
, (val)); \
} while (0)
@@ -149,7 +151,7 @@ static inline void outsl_far(u16 port, void *farptr, u16 count) {
#define SET_SEG(SEG, value) ((void)(value))
#define GET_SEG(SEG) 0
#define GET_FARPTR(ptr) (ptr)
-#define SET_FARPTR(ptr, val) do { (var) = (val); } while (0)
+#define SET_FARPTR(ptr, val) do { (ptr) = (val); } while (0)
#define insb_far(port, farptr, count) insb(port, farptr, count)
#define insw_far(port, farptr, count) insw(port, farptr, count)