|
@@ -25,7 +25,7 @@ extern char *text16;
|
25
|
25
|
|
26
|
26
|
#define __text16( variable ) \
|
27
|
27
|
_text16_ ## variable __asm__ ( #variable ) \
|
28
|
|
- __attribute__ (( section ( ".text16" ) ))
|
|
28
|
+ __attribute__ (( section ( ".text16.data" ) ))
|
29
|
29
|
|
30
|
30
|
#define __use_data16( variable ) \
|
31
|
31
|
( * ( ( typeof ( _data16_ ## variable ) * ) \
|
|
@@ -35,6 +35,14 @@ extern char *text16;
|
35
|
35
|
( * ( ( typeof ( _text16_ ## variable ) * ) \
|
36
|
36
|
& ( text16 [ ( size_t ) & ( _text16_ ## variable ) ] ) ) )
|
37
|
37
|
|
|
38
|
+#define __from_data16( variable ) \
|
|
39
|
+ ( * ( ( typeof ( variable ) * ) \
|
|
40
|
+ ( ( ( void * ) &(variable) ) - ( ( void * ) data16 ) ) ) )
|
|
41
|
+
|
|
42
|
+#define __from_text16( variable ) \
|
|
43
|
+ ( * ( ( typeof ( variable ) * ) \
|
|
44
|
+ ( ( ( void * ) &(variable) ) - ( ( void * ) text16 ) ) ) )
|
|
45
|
+
|
38
|
46
|
/* Variables in librm.S, present in the normal data segment */
|
39
|
47
|
extern uint16_t rm_sp;
|
40
|
48
|
extern uint16_t rm_ss;
|
|
@@ -58,13 +66,14 @@ extern void gateA20_set ( void );
|
58
|
66
|
#define VIRTUAL(x,y) ( phys_to_virt ( ( ( x ) << 4 ) + ( y ) ) )
|
59
|
67
|
|
60
|
68
|
/* Copy to/from base memory */
|
61
|
|
-static inline void copy_to_real_librm ( uint16_t dest_seg, uint16_t dest_off,
|
62
|
|
- void *src, size_t n ) {
|
|
69
|
+static inline __attribute__ (( always_inline )) void
|
|
70
|
+copy_to_real_librm ( unsigned int dest_seg, unsigned int dest_off,
|
|
71
|
+ void *src, size_t n ) {
|
63
|
72
|
memcpy ( VIRTUAL ( dest_seg, dest_off ), src, n );
|
64
|
73
|
}
|
65
|
|
-static inline void copy_from_real_librm ( void *dest,
|
66
|
|
- uint16_t src_seg, uint16_t src_off,
|
67
|
|
- size_t n ) {
|
|
74
|
+static inline __attribute__ (( always_inline )) void
|
|
75
|
+copy_from_real_librm ( void *dest, unsigned int src_seg,
|
|
76
|
+ unsigned int src_off, size_t n ) {
|
68
|
77
|
memcpy ( dest, VIRTUAL ( src_seg, src_off ), n );
|
69
|
78
|
}
|
70
|
79
|
#define put_real_librm( var, dest_seg, dest_off ) \
|