diff options
-rw-r--r-- | src/arch/i386/include/librm.h | 11 | ||||
-rw-r--r-- | src/arch/i386/include/realmode.h | 45 | ||||
-rw-r--r-- | src/arch/i386/transitions/librm.S | 2 |
3 files changed, 14 insertions, 44 deletions
diff --git a/src/arch/i386/include/librm.h b/src/arch/i386/include/librm.h index b1b37b61..8b0169ed 100644 --- a/src/arch/i386/include/librm.h +++ b/src/arch/i386/include/librm.h @@ -191,17 +191,6 @@ extern void remove_from_rm_stack ( void *data, size_t size ); ".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__ -#define CLOBBER(...) __VA_ARGS__ -#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 */ #endif /* LIBRM_H */ diff --git a/src/arch/i386/include/realmode.h b/src/arch/i386/include/realmode.h index 4c519ff6..5d3ddf50 100644 --- a/src/arch/i386/include/realmode.h +++ b/src/arch/i386/include/realmode.h @@ -68,17 +68,16 @@ typedef struct segoff segoff_t; * * You should place variables in .data16 when they need to be accessed * by real-mode code. Real-mode assembly (e.g. as created by - * REAL_EXEC()) can access these variables via the usual data segment. + * REAL_CODE()) can access these variables via the usual data segment. * You can therefore write something like * * static uint16_t __data16 ( foo ); * #define foo __use_data16 ( foo ) * * int bar ( void ) { - * REAL_EXEC ( baz, - * "int $0xff\n\t" - * "movw %ax, foo", - * ... ); + * __asm__ __volatile__ ( REAL_CODE ( "int $0xff\n\t" + * "movw %ax, foo" ) + * : : ); * return foo; * } * @@ -113,33 +112,15 @@ typedef struct segoff segoff_t; */ /* - * REAL_EXEC ( name, asm_code_str, num_out_constraints, out_constraints, - * in_constraints, clobber ) - * - * out_constraints must be of the form OUT_CONSTRAINTS(constraints), - * and in_constraints must be of the form IN_CONSTRAINTS(constraints), - * where "constraints" is a constraints list as would be used in an - * inline __asm__() - * - * clobber must be of the form CLOBBER ( clobber_list ), where - * "clobber_list" is a clobber list as would be used in an inline - * __asm__(). - * - * These are best illustrated by example. To write a character to the - * console using INT 10, you would do something like: - * - * REAL_EXEC ( rm_test_librm, - * "int $0x10", - * 1, - * OUT_CONSTRAINTS ( "=a" ( discard ) ), - * IN_CONSTRAINTS ( "a" ( 0x0e00 + character ), - * "b" ( 1 ) ), - * CLOBBER ( "ebx", "ecx", "edx", "ebp", "esi", "edi" ) ); - * - * IMPORTANT: gcc does not automatically assume that input operands - * get clobbered. The only way to specify that an input operand may - * be modified is to also specify it as an output operand; hence the - * "(discard)" in the above code. + * REAL_CODE ( asm_code_str ) + * + * This can be used in inline assembly to create a fragment of code + * that will execute in real mode. For example: to write a character + * to the BIOS console using INT 10, you would do something like: + * + * __asm__ __volatile__ ( REAL_CODE ( "int $0x16" ) + * : "=a" ( character ) : "a" ( 0x0000 ) ); + * */ #endif /* ASSEMBLY */ diff --git a/src/arch/i386/transitions/librm.S b/src/arch/i386/transitions/librm.S index ee0cb004..7d59c466 100644 --- a/src/arch/i386/transitions/librm.S +++ b/src/arch/i386/transitions/librm.S @@ -421,7 +421,7 @@ prot_call: * callee to preserve. Gate A20 will be re-enabled in case the * real-mode routine disabled it. * - * librm.h defines a convenient macro REAL_EXEC() for using real_call. + * librm.h defines a convenient macro REAL_CODE() for using real_call. * See librm.h and realmode.h for details and examples. * * Parameters: |