diff options
| author | Michael Brown | 2006-05-24 11:51:04 +0200 |
|---|---|---|
| committer | Michael Brown | 2006-05-24 11:51:04 +0200 |
| commit | 7a53d070274c847e708673ab504d4a779f611873 (patch) | |
| tree | e43ef20279523a6b581fb9e21ef742f2a2c13255 /src/arch/i386/include | |
| parent | Remove references to obsoleted REAL_CALL from documentation. (diff) | |
| download | ipxe-7a53d070274c847e708673ab504d4a779f611873.tar.gz ipxe-7a53d070274c847e708673ab504d4a779f611873.tar.xz ipxe-7a53d070274c847e708673ab504d4a779f611873.zip | |
Split out REAL_CODE() from REAL_EXEC(), preparatory to removing REAL_EXEC
completely.
Diffstat (limited to 'src/arch/i386/include')
| -rw-r--r-- | src/arch/i386/include/libkir.h | 39 | ||||
| -rw-r--r-- | src/arch/i386/include/librm.h | 27 |
2 files changed, 35 insertions, 31 deletions
diff --git a/src/arch/i386/include/libkir.h b/src/arch/i386/include/libkir.h index d708297d4..0b2178eb5 100644 --- a/src/arch/i386/include/libkir.h +++ b/src/arch/i386/include/libkir.h @@ -213,31 +213,32 @@ virt_to_user ( void * virtual ) { #define BASEMEM_PARAMETER_INIT BASEMEM_PARAMETER_INIT_LIBKIR #define BASEMEM_PARAMETER_DONE BASEMEM_PARAMETER_DONE_LIBKIR +/* REAL_CODE: declare a fragment of code that executes in real mode */ +#define REAL_CODE( asm_code_str ) \ + ".code16\n\t" \ + "pushw %%gs\n\t" \ + "pushw %%fs\n\t" \ + "pushw %%es\n\t" \ + "pushw %%ds\n\t" \ + asm_code_str \ + "popw %%ds\n\t" \ + "popw %%es\n\t" \ + "popw %%fs\n\t" \ + "popw %%gs\n\t" \ + ".code16gcc\n\t" + /* REAL_EXEC: execute some inline assembly code in a way that matches * the interface of librm */ #define OUT_CONSTRAINTS(...) __VA_ARGS__ #define IN_CONSTRAINTS(...) __VA_ARGS__ #define CLOBBER(...) __VA_ARGS__ -#define REAL_EXEC( name, asm_code_str, num_out_constraints, out_constraints, \ - in_constraints, clobber ) \ - __asm__ __volatile__ ( \ - ".code16\n\t" \ - "pushw %%gs\n\t" \ - "pushw %%fs\n\t" \ - "pushw %%es\n\t" \ - "pushw %%ds\n\t" \ - "\n" #name ":\n\t" \ - asm_code_str \ - "popw %%ds\n\t" \ - "popw %%es\n\t" \ - "popw %%fs\n\t" \ - "popw %%gs\n\t" \ - ".code16gcc\n\t" \ - : out_constraints \ - : in_constraints \ - : clobber \ - ); +#define REAL_EXEC( name, asm_code_str, num_out_constraints, \ + out_constraints, in_constraints, clobber ) do { \ + __asm__ __volatile__ ( \ + REAL_CODE ( asm_code_str ) \ + : out_constraints : in_constraints : clobber ); \ + } while ( 0 ) #endif /* ASSEMBLY */ diff --git a/src/arch/i386/include/librm.h b/src/arch/i386/include/librm.h index d2a565966..b1b37b612 100644 --- a/src/arch/i386/include/librm.h +++ b/src/arch/i386/include/librm.h @@ -177,6 +177,20 @@ extern void remove_from_rm_stack ( void *data, size_t size ); #define BASEMEM_PARAMETER_INIT BASEMEM_PARAMETER_INIT_LIBRM #define BASEMEM_PARAMETER_DONE BASEMEM_PARAMETER_DONE_LIBRM +/* REAL_CODE: declare a fragment of code that executes in real mode */ +#define REAL_CODE( asm_code_str ) \ + "pushl $1f\n\t" \ + "call real_call\n\t" \ + "addl $4, %%esp\n\t" \ + ".section \".text16\", \"ax\", @progbits\n\t" \ + ".code16\n\t" \ + ".arch i386\n\t" \ + "\n1:\n\t" \ + asm_code_str "\n\t" \ + "ret\n\t" \ + ".code32\n\t" \ + ".previous\n\t" + /* REAL_EXEC: execute a fragment of code in real mode */ #define OUT_CONSTRAINTS(...) __VA_ARGS__ #define IN_CONSTRAINTS(...) __VA_ARGS__ @@ -184,18 +198,7 @@ extern void remove_from_rm_stack ( void *data, size_t size ); #define REAL_EXEC( name, asm_code_str, num_out_constraints, \ out_constraints, in_constraints, clobber ) do { \ __asm__ __volatile__ ( \ - ".section \".text16\", \"ax\", @progbits\n\t" \ - ".code16\n\t" \ - ".arch i386\n\t" \ - #name ":\n\t" \ - asm_code_str "\n\t" \ - "ret\n\t" \ - ".size " #name ", . - " #name "\n\t" \ - ".code32\n\t" \ - ".previous\n\t" \ - "pushl $" #name "\n\t" \ - "call real_call\n\t" \ - "addl $4, %%esp\n\t" \ + REAL_CODE ( asm_code_str ) \ : out_constraints : in_constraints : clobber ); \ } while ( 0 ) |
