Browse Source

Allow access to variables in .text16 as well as .data16. Chained

interrupt vectors, for example, will be easiest to handle if placed in
.text16.
tags/v0.9.3
Michael Brown 19 years ago
parent
commit
f8e087767b

+ 3
- 1
src/arch/i386/include/libkir.h View File

10
  *
10
  *
11
  */
11
  */
12
 
12
 
13
-/* Access to variables in .data16, in a way compatible with librm */
13
+/* Access to variables in .data16 and .text16 in a way compatible with librm */
14
 #define __data16( variable ) variable
14
 #define __data16( variable ) variable
15
+#define __text16( variable ) variable
15
 #define __use_data16( variable ) variable
16
 #define __use_data16( variable ) variable
17
+#define __use_text16( variable ) variable
16
 
18
 
17
 /* Copy to/from base memory */
19
 /* Copy to/from base memory */
18
 
20
 

+ 10
- 1
src/arch/i386/include/librm.h View File

15
  *
15
  *
16
  */
16
  */
17
 
17
 
18
-/* Access to variables in .data16 */
18
+/* Access to variables in .data16 and .text16 */
19
 extern char *data16;
19
 extern char *data16;
20
+extern char *text16;
20
 
21
 
21
 #define __data16( variable )						\
22
 #define __data16( variable )						\
22
 	_data16_ ## variable __asm__ ( #variable )			\
23
 	_data16_ ## variable __asm__ ( #variable )			\
23
 	__attribute__ (( section ( ".data16" ) ))
24
 	__attribute__ (( section ( ".data16" ) ))
24
 
25
 
26
+#define __text16( variable )						\
27
+	_text16_ ## variable __asm__ ( #variable )			\
28
+	__attribute__ (( section ( ".text16" ) ))
29
+
25
 #define __use_data16( variable )					\
30
 #define __use_data16( variable )					\
26
 	( * ( ( typeof ( _data16_ ## variable ) * )			\
31
 	( * ( ( typeof ( _data16_ ## variable ) * )			\
27
 	      & ( data16 [ ( size_t ) & ( _data16_ ## variable ) ] ) ) )
32
 	      & ( data16 [ ( size_t ) & ( _data16_ ## variable ) ] ) ) )
28
 
33
 
34
+#define __use_text16( variable )					\
35
+	( * ( ( typeof ( _text16_ ## variable ) * )			\
36
+	      & ( text16 [ ( size_t ) & ( _text16_ ## variable ) ] ) ) )
37
+
29
 /* Variables in librm.S, present in the normal data segment */
38
 /* Variables in librm.S, present in the normal data segment */
30
 extern uint16_t rm_sp;
39
 extern uint16_t rm_sp;
31
 extern uint16_t rm_ss;
40
 extern uint16_t rm_ss;

+ 3
- 0
src/arch/i386/include/realmode.h View File

80
  *     return foo;
80
  *     return foo;
81
  *   }
81
  *   }
82
  *
82
  *
83
+ * Variables may also be placed in .text16 using __text16 and
84
+ * __use_text16.  Some variables (e.g. chained interrupt vectors) fit
85
+ * most naturally in .text16; most should be in .data16.
83
  */
86
  */
84
 
87
 
85
 /*
88
 /*

Loading…
Cancel
Save