|
@@ -177,6 +177,20 @@ extern void remove_from_rm_stack ( void *data, size_t size );
|
177
|
177
|
#define BASEMEM_PARAMETER_INIT BASEMEM_PARAMETER_INIT_LIBRM
|
178
|
178
|
#define BASEMEM_PARAMETER_DONE BASEMEM_PARAMETER_DONE_LIBRM
|
179
|
179
|
|
|
180
|
+/* REAL_CODE: declare a fragment of code that executes in real mode */
|
|
181
|
+#define REAL_CODE( asm_code_str ) \
|
|
182
|
+ "pushl $1f\n\t" \
|
|
183
|
+ "call real_call\n\t" \
|
|
184
|
+ "addl $4, %%esp\n\t" \
|
|
185
|
+ ".section \".text16\", \"ax\", @progbits\n\t" \
|
|
186
|
+ ".code16\n\t" \
|
|
187
|
+ ".arch i386\n\t" \
|
|
188
|
+ "\n1:\n\t" \
|
|
189
|
+ asm_code_str "\n\t" \
|
|
190
|
+ "ret\n\t" \
|
|
191
|
+ ".code32\n\t" \
|
|
192
|
+ ".previous\n\t"
|
|
193
|
+
|
180
|
194
|
/* REAL_EXEC: execute a fragment of code in real mode */
|
181
|
195
|
#define OUT_CONSTRAINTS(...) __VA_ARGS__
|
182
|
196
|
#define IN_CONSTRAINTS(...) __VA_ARGS__
|
|
@@ -184,18 +198,7 @@ extern void remove_from_rm_stack ( void *data, size_t size );
|
184
|
198
|
#define REAL_EXEC( name, asm_code_str, num_out_constraints, \
|
185
|
199
|
out_constraints, in_constraints, clobber ) do { \
|
186
|
200
|
__asm__ __volatile__ ( \
|
187
|
|
- ".section \".text16\", \"ax\", @progbits\n\t" \
|
188
|
|
- ".code16\n\t" \
|
189
|
|
- ".arch i386\n\t" \
|
190
|
|
- #name ":\n\t" \
|
191
|
|
- asm_code_str "\n\t" \
|
192
|
|
- "ret\n\t" \
|
193
|
|
- ".size " #name ", . - " #name "\n\t" \
|
194
|
|
- ".code32\n\t" \
|
195
|
|
- ".previous\n\t" \
|
196
|
|
- "pushl $" #name "\n\t" \
|
197
|
|
- "call real_call\n\t" \
|
198
|
|
- "addl $4, %%esp\n\t" \
|
|
201
|
+ REAL_CODE ( asm_code_str ) \
|
199
|
202
|
: out_constraints : in_constraints : clobber ); \
|
200
|
203
|
} while ( 0 )
|
201
|
204
|
|