summaryrefslogtreecommitdiffstats
path: root/src/arch/i386/include/librm.h
diff options
context:
space:
mode:
authorMichael Brown2006-05-13 13:11:55 +0200
committerMichael Brown2006-05-13 13:11:55 +0200
commitf7b963da5141578c3769a89d0fa55b0155822e86 (patch)
tree8678c1229a5c532ea023f059dcaa227f04249247 /src/arch/i386/include/librm.h
parent(Redoing check-in lost by SourceForge's failure.) (diff)
downloadipxe-f7b963da5141578c3769a89d0fa55b0155822e86.tar.gz
ipxe-f7b963da5141578c3769a89d0fa55b0155822e86.tar.xz
ipxe-f7b963da5141578c3769a89d0fa55b0155822e86.zip
(Redoing check-in lost by SourceForge's failure.)
Use .text16.data section with "aw" attributes, to avoid section type conflicts when placing both code and data into .text16. Add __from_{text16,data16}.
Diffstat (limited to 'src/arch/i386/include/librm.h')
-rw-r--r--src/arch/i386/include/librm.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/arch/i386/include/librm.h b/src/arch/i386/include/librm.h
index 3a5d9468..4301ff52 100644
--- a/src/arch/i386/include/librm.h
+++ b/src/arch/i386/include/librm.h
@@ -25,7 +25,7 @@ extern char *text16;
#define __text16( variable ) \
_text16_ ## variable __asm__ ( #variable ) \
- __attribute__ (( section ( ".text16" ) ))
+ __attribute__ (( section ( ".text16.data" ) ))
#define __use_data16( variable ) \
( * ( ( typeof ( _data16_ ## variable ) * ) \
@@ -35,6 +35,14 @@ extern char *text16;
( * ( ( typeof ( _text16_ ## variable ) * ) \
& ( text16 [ ( size_t ) & ( _text16_ ## variable ) ] ) ) )
+#define __from_data16( variable ) \
+ ( * ( ( typeof ( variable ) * ) \
+ ( ( ( void * ) &(variable) ) - ( ( void * ) data16 ) ) ) )
+
+#define __from_text16( variable ) \
+ ( * ( ( typeof ( variable ) * ) \
+ ( ( ( void * ) &(variable) ) - ( ( void * ) text16 ) ) ) )
+
/* Variables in librm.S, present in the normal data segment */
extern uint16_t rm_sp;
extern uint16_t rm_ss;
@@ -58,13 +66,14 @@ extern void gateA20_set ( void );
#define VIRTUAL(x,y) ( phys_to_virt ( ( ( x ) << 4 ) + ( y ) ) )
/* Copy to/from base memory */
-static inline void copy_to_real_librm ( uint16_t dest_seg, uint16_t dest_off,
- void *src, size_t n ) {
+static inline __attribute__ (( always_inline )) void
+copy_to_real_librm ( unsigned int dest_seg, unsigned int dest_off,
+ void *src, size_t n ) {
memcpy ( VIRTUAL ( dest_seg, dest_off ), src, n );
}
-static inline void copy_from_real_librm ( void *dest,
- uint16_t src_seg, uint16_t src_off,
- size_t n ) {
+static inline __attribute__ (( always_inline )) void
+copy_from_real_librm ( void *dest, unsigned int src_seg,
+ unsigned int src_off, size_t n ) {
memcpy ( dest, VIRTUAL ( src_seg, src_off ), n );
}
#define put_real_librm( var, dest_seg, dest_off ) \