diff --git a/src/arch/i386/include/libkir.h b/src/arch/i386/include/libkir.h index 44cb75e2..28db8308 100644 --- a/src/arch/i386/include/libkir.h +++ b/src/arch/i386/include/libkir.h @@ -10,9 +10,11 @@ * */ -/* Access to variables in .data16, in a way compatible with librm */ +/* Access to variables in .data16 and .text16 in a way compatible with librm */ #define __data16( variable ) variable +#define __text16( variable ) variable #define __use_data16( variable ) variable +#define __use_text16( variable ) variable /* Copy to/from base memory */ diff --git a/src/arch/i386/include/librm.h b/src/arch/i386/include/librm.h index b4970c02..3a5d9468 100644 --- a/src/arch/i386/include/librm.h +++ b/src/arch/i386/include/librm.h @@ -15,17 +15,26 @@ * */ -/* Access to variables in .data16 */ +/* Access to variables in .data16 and .text16 */ extern char *data16; +extern char *text16; #define __data16( variable ) \ _data16_ ## variable __asm__ ( #variable ) \ __attribute__ (( section ( ".data16" ) )) +#define __text16( variable ) \ + _text16_ ## variable __asm__ ( #variable ) \ + __attribute__ (( section ( ".text16" ) )) + #define __use_data16( variable ) \ ( * ( ( typeof ( _data16_ ## variable ) * ) \ & ( data16 [ ( size_t ) & ( _data16_ ## variable ) ] ) ) ) +#define __use_text16( variable ) \ + ( * ( ( typeof ( _text16_ ## variable ) * ) \ + & ( text16 [ ( size_t ) & ( _text16_ ## variable ) ] ) ) ) + /* Variables in librm.S, present in the normal data segment */ extern uint16_t rm_sp; extern uint16_t rm_ss; diff --git a/src/arch/i386/include/realmode.h b/src/arch/i386/include/realmode.h index b7f0dc9d..fa8c7863 100644 --- a/src/arch/i386/include/realmode.h +++ b/src/arch/i386/include/realmode.h @@ -80,6 +80,9 @@ typedef struct { * return foo; * } * + * Variables may also be placed in .text16 using __text16 and + * __use_text16. Some variables (e.g. chained interrupt vectors) fit + * most naturally in .text16; most should be in .data16. */ /*