aboutsummaryrefslogtreecommitdiffstats
path: root/src/arch/i386/include
diff options
context:
space:
mode:
authorMichael Brown <mcb30@etherboot.org>2008-06-30 18:52:13 -0700
committerMichael Brown <mcb30@etherboot.org>2008-06-30 18:52:13 -0700
commit4fbbf651d7cb91983801904f5ed2b07d15566c1d (patch)
tree36e8d2ecd24b17a0fd4cbe9dfd7c0143bb0d578f /src/arch/i386/include
parentd51d80f7854be874c7f60c6fda40d073cdfe717d (diff)
downloadipxe-4fbbf651d7cb91983801904f5ed2b07d15566c1d.tar.gz
[i386] Change semantics of __from_data16 and __from_text16
__from_data16 and __from_text16 now take a pointer to a .data16/.text16 variable, and return the real-mode offset within the appropriate segment. This matches the use case for every occurrence of these macros, and prevents potential future bugs such as that fixed in commit d51d80f. (The bug arose essentially because "&pointer" is still syntactically valid.)
Diffstat (limited to 'src/arch/i386/include')
-rw-r--r--src/arch/i386/include/libkir.h4
-rw-r--r--src/arch/i386/include/librm.h12
2 files changed, 8 insertions, 8 deletions
diff --git a/src/arch/i386/include/libkir.h b/src/arch/i386/include/libkir.h
index 5f67a56d..1f5b1350 100644
--- a/src/arch/i386/include/libkir.h
+++ b/src/arch/i386/include/libkir.h
@@ -19,8 +19,8 @@
#define __text16_array( variable,array ) variable array
#define __use_data16( variable ) variable
#define __use_text16( variable ) variable
-#define __from_data16( variable ) variable
-#define __from_text16( variable ) variable
+#define __from_data16( pointer ) pointer
+#define __from_text16( pointer ) pointer
/* Real-mode data and code segments */
static inline __attribute__ (( always_inline )) unsigned int _rm_cs ( void ) {
diff --git a/src/arch/i386/include/librm.h b/src/arch/i386/include/librm.h
index 31b50979..413f0362 100644
--- a/src/arch/i386/include/librm.h
+++ b/src/arch/i386/include/librm.h
@@ -51,13 +51,13 @@ extern char *text16;
( * ( ( typeof ( _text16_ ## variable ) * ) \
& ( text16 [ ( size_t ) & ( _text16_ ## variable ) ] ) ) )
-#define __from_data16( variable ) \
- ( * ( ( typeof ( variable ) * ) \
- ( ( ( void * ) &(variable) ) - ( ( void * ) data16 ) ) ) )
+#define __from_data16( pointer ) \
+ ( ( unsigned int ) \
+ ( ( ( void * ) (pointer) ) - ( ( void * ) data16 ) ) )
-#define __from_text16( variable ) \
- ( * ( ( typeof ( variable ) * ) \
- ( ( ( void * ) &(variable) ) - ( ( void * ) text16 ) ) ) )
+#define __from_text16( pointer ) \
+ ( ( unsigned int ) \
+ ( ( ( void * ) (pointer) ) - ( ( void * ) text16 ) ) )
/* Variables in librm.S, present in the normal data segment */
extern uint16_t __data16 ( rm_cs );