|
@@ -68,17 +68,16 @@ typedef struct segoff segoff_t;
|
68
|
68
|
*
|
69
|
69
|
* You should place variables in .data16 when they need to be accessed
|
70
|
70
|
* by real-mode code. Real-mode assembly (e.g. as created by
|
71
|
|
- * REAL_EXEC()) can access these variables via the usual data segment.
|
|
71
|
+ * REAL_CODE()) can access these variables via the usual data segment.
|
72
|
72
|
* You can therefore write something like
|
73
|
73
|
*
|
74
|
74
|
* static uint16_t __data16 ( foo );
|
75
|
75
|
* #define foo __use_data16 ( foo )
|
76
|
76
|
*
|
77
|
77
|
* int bar ( void ) {
|
78
|
|
- * REAL_EXEC ( baz,
|
79
|
|
- * "int $0xff\n\t"
|
80
|
|
- * "movw %ax, foo",
|
81
|
|
- * ... );
|
|
78
|
+ * __asm__ __volatile__ ( REAL_CODE ( "int $0xff\n\t"
|
|
79
|
+ * "movw %ax, foo" )
|
|
80
|
+ * : : );
|
82
|
81
|
* return foo;
|
83
|
82
|
* }
|
84
|
83
|
*
|
|
@@ -113,33 +112,15 @@ typedef struct segoff segoff_t;
|
113
|
112
|
*/
|
114
|
113
|
|
115
|
114
|
/*
|
116
|
|
- * REAL_EXEC ( name, asm_code_str, num_out_constraints, out_constraints,
|
117
|
|
- * in_constraints, clobber )
|
118
|
|
- *
|
119
|
|
- * out_constraints must be of the form OUT_CONSTRAINTS(constraints),
|
120
|
|
- * and in_constraints must be of the form IN_CONSTRAINTS(constraints),
|
121
|
|
- * where "constraints" is a constraints list as would be used in an
|
122
|
|
- * inline __asm__()
|
123
|
|
- *
|
124
|
|
- * clobber must be of the form CLOBBER ( clobber_list ), where
|
125
|
|
- * "clobber_list" is a clobber list as would be used in an inline
|
126
|
|
- * __asm__().
|
127
|
|
- *
|
128
|
|
- * These are best illustrated by example. To write a character to the
|
129
|
|
- * console using INT 10, you would do something like:
|
130
|
|
- *
|
131
|
|
- * REAL_EXEC ( rm_test_librm,
|
132
|
|
- * "int $0x10",
|
133
|
|
- * 1,
|
134
|
|
- * OUT_CONSTRAINTS ( "=a" ( discard ) ),
|
135
|
|
- * IN_CONSTRAINTS ( "a" ( 0x0e00 + character ),
|
136
|
|
- * "b" ( 1 ) ),
|
137
|
|
- * CLOBBER ( "ebx", "ecx", "edx", "ebp", "esi", "edi" ) );
|
138
|
|
- *
|
139
|
|
- * IMPORTANT: gcc does not automatically assume that input operands
|
140
|
|
- * get clobbered. The only way to specify that an input operand may
|
141
|
|
- * be modified is to also specify it as an output operand; hence the
|
142
|
|
- * "(discard)" in the above code.
|
|
115
|
+ * REAL_CODE ( asm_code_str )
|
|
116
|
+ *
|
|
117
|
+ * This can be used in inline assembly to create a fragment of code
|
|
118
|
+ * that will execute in real mode. For example: to write a character
|
|
119
|
+ * to the BIOS console using INT 10, you would do something like:
|
|
120
|
+ *
|
|
121
|
+ * __asm__ __volatile__ ( REAL_CODE ( "int $0x16" )
|
|
122
|
+ * : "=a" ( character ) : "a" ( 0x0000 ) );
|
|
123
|
+ *
|
143
|
124
|
*/
|
144
|
125
|
|
145
|
126
|
#endif /* ASSEMBLY */
|