diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2008-03-29 14:28:00 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2008-03-29 14:28:00 -0400 |
commit | 46df61c21d72b122606a2a744809002059544568 (patch) | |
tree | 820931e63959ad2158ee678f4feff598a255a2da | |
parent | 840c5349f552512a6e9b7c39d55cc1661dbbc5ed (diff) | |
download | seabios-46df61c21d72b122606a2a744809002059544568.tar.gz |
Fix bugs in GET/SET_FARPTR macros.
-rw-r--r-- | src/farptr.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/farptr.h b/src/farptr.h index cc8cd68e..c70c8e04 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) |