diff options
author | Michael Brown | 2016-02-18 17:36:04 +0100 |
---|---|---|
committer | Michael Brown | 2016-02-18 18:12:16 +0100 |
commit | 196f0f2551a4f82d2968c6e3a50aaa54a45ec779 (patch) | |
tree | a253528f9e3c0851e348f7f57f0241bb3450fa4a | |
parent | [prefix] Standardise calls to prot_call() (diff) | |
download | ipxe-196f0f2551a4f82d2968c6e3a50aaa54a45ec779.tar.gz ipxe-196f0f2551a4f82d2968c6e3a50aaa54a45ec779.tar.xz ipxe-196f0f2551a4f82d2968c6e3a50aaa54a45ec779.zip |
[librm] Convert prot_call() to a real-mode near call
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r-- | src/arch/i386/interface/syslinux/comboot_call.c | 3 | ||||
-rw-r--r-- | src/arch/x86/core/dumpregs.c | 1 | ||||
-rw-r--r-- | src/arch/x86/interface/pcbios/bios_console.c | 1 | ||||
-rw-r--r-- | src/arch/x86/interface/pcbios/int13.c | 1 | ||||
-rw-r--r-- | src/arch/x86/interface/pxe/pxe_entry.S | 1 | ||||
-rw-r--r-- | src/arch/x86/prefix/dskprefix.S | 1 | ||||
-rw-r--r-- | src/arch/x86/prefix/exeprefix.S | 1 | ||||
-rw-r--r-- | src/arch/x86/prefix/hdprefix.S | 1 | ||||
-rw-r--r-- | src/arch/x86/prefix/libprefix.S | 1 | ||||
-rw-r--r-- | src/arch/x86/prefix/lkrnprefix.S | 1 | ||||
-rw-r--r-- | src/arch/x86/prefix/nbiprefix.S | 1 | ||||
-rw-r--r-- | src/arch/x86/prefix/pxeprefix.S | 1 | ||||
-rw-r--r-- | src/arch/x86/prefix/romprefix.S | 1 | ||||
-rw-r--r-- | src/arch/x86/prefix/undiloader.S | 1 | ||||
-rw-r--r-- | src/arch/x86/transitions/librm.S | 12 | ||||
-rw-r--r-- | src/arch/x86/transitions/librm_test.c | 1 |
16 files changed, 6 insertions, 23 deletions
diff --git a/src/arch/i386/interface/syslinux/comboot_call.c b/src/arch/i386/interface/syslinux/comboot_call.c index 37cba1b7..277ec447 100644 --- a/src/arch/i386/interface/syslinux/comboot_call.c +++ b/src/arch/i386/interface/syslinux/comboot_call.c @@ -661,7 +661,6 @@ void hook_comboot_interrupts ( ) { __asm__ __volatile__ ( TEXT16_CODE ( "\nint20_wrapper:\n\t" "pushl %0\n\t" - "pushw %%cs\n\t" "call prot_call\n\t" "clc\n\t" "call patch_cf\n\t" @@ -673,7 +672,6 @@ void hook_comboot_interrupts ( ) { __asm__ __volatile__ ( TEXT16_CODE ( "\nint21_wrapper:\n\t" "pushl %0\n\t" - "pushw %%cs\n\t" "call prot_call\n\t" "clc\n\t" "call patch_cf\n\t" @@ -685,7 +683,6 @@ void hook_comboot_interrupts ( ) { __asm__ __volatile__ ( TEXT16_CODE ( "\nint22_wrapper:\n\t" "pushl %0\n\t" - "pushw %%cs\n\t" "call prot_call\n\t" "clc\n\t" "call patch_cf\n\t" diff --git a/src/arch/x86/core/dumpregs.c b/src/arch/x86/core/dumpregs.c index d23988d3..9f0b0818 100644 --- a/src/arch/x86/core/dumpregs.c +++ b/src/arch/x86/core/dumpregs.c @@ -7,7 +7,6 @@ void __asmcall _dump_regs ( struct i386_all_regs *ix86 ) { TEXT16_CODE ( ".globl dump_regs\n\t" "\ndump_regs:\n\t" "pushl $_dump_regs\n\t" - "pushw %%cs\n\t" "call prot_call\n\t" "ret\n\t" ) : : ); diff --git a/src/arch/x86/interface/pcbios/bios_console.c b/src/arch/x86/interface/pcbios/bios_console.c index 364c294d..72d5b209 100644 --- a/src/arch/x86/interface/pcbios/bios_console.c +++ b/src/arch/x86/interface/pcbios/bios_console.c @@ -534,7 +534,6 @@ static void bios_inject_startup ( void ) { "cmpb $0, %%cs:bios_inject_lock\n\t" "jnz 1f\n\t" "pushl %0\n\t" - "pushw %%cs\n\t" "call prot_call\n\t" "\n1:\n\t" "popfw\n\t" diff --git a/src/arch/x86/interface/pcbios/int13.c b/src/arch/x86/interface/pcbios/int13.c index 6ba12921..7fe247b5 100644 --- a/src/arch/x86/interface/pcbios/int13.c +++ b/src/arch/x86/interface/pcbios/int13.c @@ -1481,7 +1481,6 @@ static void int13_hook_vector ( void ) { "orb $0, %%al\n\t" "stc\n\t" "pushl %0\n\t" - "pushw %%cs\n\t" "call prot_call\n\t" /* Chain if OF not set */ "jo 1f\n\t" diff --git a/src/arch/x86/interface/pxe/pxe_entry.S b/src/arch/x86/interface/pxe/pxe_entry.S index 84eba1e0..2ce1ced2 100644 --- a/src/arch/x86/interface/pxe/pxe_entry.S +++ b/src/arch/x86/interface/pxe/pxe_entry.S @@ -121,7 +121,6 @@ pxenv_null_entry: .code16 pxenv_entry: pushl $pxe_api_call - pushw %cs call prot_call lret .size pxenv_entry, . - pxenv_entry diff --git a/src/arch/x86/prefix/dskprefix.S b/src/arch/x86/prefix/dskprefix.S index d716a30f..041ec4c4 100644 --- a/src/arch/x86/prefix/dskprefix.S +++ b/src/arch/x86/prefix/dskprefix.S @@ -371,7 +371,6 @@ start_runtime: .section ".text16", "awx", @progbits 1: pushl $main - pushw %cs call prot_call /* Uninstall iPXE */ diff --git a/src/arch/x86/prefix/exeprefix.S b/src/arch/x86/prefix/exeprefix.S index 35061b15..9598122b 100644 --- a/src/arch/x86/prefix/exeprefix.S +++ b/src/arch/x86/prefix/exeprefix.S @@ -149,7 +149,6 @@ _exe_start: /* Run iPXE */ pushl $main - pushw %cs call prot_call /* Uninstall iPXE */ diff --git a/src/arch/x86/prefix/hdprefix.S b/src/arch/x86/prefix/hdprefix.S index 9f5752aa..6caf12fc 100644 --- a/src/arch/x86/prefix/hdprefix.S +++ b/src/arch/x86/prefix/hdprefix.S @@ -100,7 +100,6 @@ start_image: .section ".text16", "awx", @progbits 1: pushl $main - pushw %cs call prot_call /* Uninstall iPXE */ diff --git a/src/arch/x86/prefix/libprefix.S b/src/arch/x86/prefix/libprefix.S index 94c32455..7eb1e501 100644 --- a/src/arch/x86/prefix/libprefix.S +++ b/src/arch/x86/prefix/libprefix.S @@ -888,7 +888,6 @@ payload_death_message: */ progress " relocate\n" pushl $relocate - pushw %cs call prot_call /* Jump back to .prefix segment */ diff --git a/src/arch/x86/prefix/lkrnprefix.S b/src/arch/x86/prefix/lkrnprefix.S index 34e2bdc8..41a5b467 100644 --- a/src/arch/x86/prefix/lkrnprefix.S +++ b/src/arch/x86/prefix/lkrnprefix.S @@ -198,7 +198,6 @@ no_cmd_line: /* Run iPXE */ pushl $main - pushw %cs call prot_call /* Uninstall iPXE */ diff --git a/src/arch/x86/prefix/nbiprefix.S b/src/arch/x86/prefix/nbiprefix.S index 539b5eba..c25c254e 100644 --- a/src/arch/x86/prefix/nbiprefix.S +++ b/src/arch/x86/prefix/nbiprefix.S @@ -67,7 +67,6 @@ _nbi_start: .section ".text16", "awx", @progbits 1: pushl $main - pushw %cs call prot_call /* Uninstall iPXE */ diff --git a/src/arch/x86/prefix/pxeprefix.S b/src/arch/x86/prefix/pxeprefix.S index c742add6..2c6d7abb 100644 --- a/src/arch/x86/prefix/pxeprefix.S +++ b/src/arch/x86/prefix/pxeprefix.S @@ -821,7 +821,6 @@ run_ipxe: /* Run main program */ pushl $main - pushw %cs call prot_call /* Uninstall iPXE */ diff --git a/src/arch/x86/prefix/romprefix.S b/src/arch/x86/prefix/romprefix.S index 287a986c..941e2ce6 100644 --- a/src/arch/x86/prefix/romprefix.S +++ b/src/arch/x86/prefix/romprefix.S @@ -808,7 +808,6 @@ exec: /* Set %ds = %cs */ /* Call main() */ pushl $main - pushw %cs call prot_call /* Set up flat real mode for return to BIOS */ diff --git a/src/arch/x86/prefix/undiloader.S b/src/arch/x86/prefix/undiloader.S index 0376afa8..fb42637c 100644 --- a/src/arch/x86/prefix/undiloader.S +++ b/src/arch/x86/prefix/undiloader.S @@ -46,7 +46,6 @@ undiloader: 1: /* Call UNDI loader C code */ pushl $pxe_loader_call - pushw %cs call prot_call 1: /* Restore registers and return */ diff --git a/src/arch/x86/transitions/librm.S b/src/arch/x86/transitions/librm.S index c702c0cc..46c1ab97 100644 --- a/src/arch/x86/transitions/librm.S +++ b/src/arch/x86/transitions/librm.S @@ -132,7 +132,6 @@ init_librm: /* Initialise IDT */ pushl $init_idt - pushw %cs call prot_call /* Restore registers */ @@ -358,7 +357,7 @@ rm_gdtr: .long 0 /* Base */ /**************************************************************************** - * prot_call (real-mode far call, 16-bit real-mode far return address) + * prot_call (real-mode near call, 16-bit real-mode near return address) * * Call a specific C function in the protected-mode code. The * prototype of the C function must be @@ -384,7 +383,6 @@ rm_gdtr: * * Example usage: * pushl $pxe_api_call - * pushw %cs * call prot_call * to call in to the C function * void pxe_api_call ( struct i386_all_regs *ix86 ); @@ -394,7 +392,8 @@ rm_gdtr: PC_OFFSET_GDT: .space 6 PC_OFFSET_IDT: .space 6 PC_OFFSET_IX86: .space SIZEOF_I386_ALL_REGS -PC_OFFSET_RETADDR: .space 4 +PC_OFFSET_PADDING: .space 2 /* for alignment */ +PC_OFFSET_RETADDR: .space 2 PC_OFFSET_FUNCTION: .space 4 PC_OFFSET_END: .previous @@ -404,6 +403,7 @@ PC_OFFSET_END: .globl prot_call prot_call: /* Preserve registers, flags and GDT on external RM stack */ + pushfw /* padding */ pushfl pushal pushw %gs @@ -455,7 +455,8 @@ pc_rmode: */ addr32 movl -20(%esp), %esp popfl - lret $4 + popfw /* padding */ + ret $4 /**************************************************************************** * real_call (protected-mode near call, 32-bit virtual return address) @@ -554,7 +555,6 @@ flatten_real_mode: movb $0x8f, real_ds + 6 /* Call dummy protected-mode function */ pushl $flatten_dummy - pushw %cs call prot_call /* Restore GDT */ movb $0x00, real_cs + 6 diff --git a/src/arch/x86/transitions/librm_test.c b/src/arch/x86/transitions/librm_test.c index f86584e3..fc318ec7 100644 --- a/src/arch/x86/transitions/librm_test.c +++ b/src/arch/x86/transitions/librm_test.c @@ -106,7 +106,6 @@ static void librm_test_exec ( void ) { __asm__ __volatile__ ( REAL_CODE ( "rdtsc\n\t" "movl %k0, %k2\n\t" "pushl %k3\n\t" - "pushw %%cs\n\t" "call prot_call\n\t" "rdtsc\n\t" ) : "=a" ( stopped ), "=d" ( discard_d ), |