]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[librm] Convert prot_call() to a real-mode near call
authorMichael Brown <mcb30@ipxe.org>
Thu, 18 Feb 2016 16:36:04 +0000 (16:36 +0000)
committerMichael Brown <mcb30@ipxe.org>
Thu, 18 Feb 2016 17:12:16 +0000 (17:12 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
16 files changed:
src/arch/i386/interface/syslinux/comboot_call.c
src/arch/x86/core/dumpregs.c
src/arch/x86/interface/pcbios/bios_console.c
src/arch/x86/interface/pcbios/int13.c
src/arch/x86/interface/pxe/pxe_entry.S
src/arch/x86/prefix/dskprefix.S
src/arch/x86/prefix/exeprefix.S
src/arch/x86/prefix/hdprefix.S
src/arch/x86/prefix/libprefix.S
src/arch/x86/prefix/lkrnprefix.S
src/arch/x86/prefix/nbiprefix.S
src/arch/x86/prefix/pxeprefix.S
src/arch/x86/prefix/romprefix.S
src/arch/x86/prefix/undiloader.S
src/arch/x86/transitions/librm.S
src/arch/x86/transitions/librm_test.c

index 37cba1b77bdf9a17592c00a4b7c8a1568425a28e..277ec447508a001a56694aeb446197b13973385e 100644 (file)
@@ -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"
index d23988d306b96ab26b3143a6146a4dcfc85d601d..9f0b081898cfe25ed20b841f4e754dd291faa67f 100644 (file)
@@ -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" ) : : );
 
index 364c294dac0796cc4c73e19ef4ac1af12995aaeb..72d5b209324cc9b5fbf22092ce5fbd4794672515 100644 (file)
@@ -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"
index 6ba129218009b481ed1400275b93c9d4e402beb6..7fe247b5fbdb926db6fad68e9ba48985ffc3bff3 100644 (file)
@@ -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"
index 84eba1e0683d8d1af24685e5a940b16ccf5a988d..2ce1ced2b26c127bbafb5c12e0f4cf1902218377 100644 (file)
@@ -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
index d716a30f031d81e1f4acb54cd4f69c252f2eb334..041ec4c4cf124030d0b3649ca110b85dad0ebe32 100644 (file)
@@ -371,7 +371,6 @@ start_runtime:
        .section ".text16", "awx", @progbits
 1:
        pushl   $main
-       pushw   %cs
        call    prot_call
 
        /* Uninstall iPXE */
index 35061b152a8f60e35e17e9d987ec230c3fe253e4..9598122bc2b7e52ded362e35b46396e2c03cbd41 100644 (file)
@@ -149,7 +149,6 @@ _exe_start:
 
        /* Run iPXE */
        pushl   $main
-       pushw   %cs
        call    prot_call
 
        /* Uninstall iPXE */
index 9f5752aa8669349aee2c4155cc5d3c760c177f42..6caf12fc05c7afc0211ddc41e1d0691fd68ddd3a 100644 (file)
@@ -100,7 +100,6 @@ start_image:
        .section ".text16", "awx", @progbits
 1:
        pushl   $main
-       pushw   %cs
        call    prot_call
 
        /* Uninstall iPXE */
index 94c32455be7fa57d8741869867e88bb5ab4759ee..7eb1e501f1d30260fb4f95f435bcdec53430d592 100644 (file)
@@ -888,7 +888,6 @@ payload_death_message:
         */
        progress "  relocate\n"
        pushl   $relocate
-       pushw   %cs
        call    prot_call
 
        /* Jump back to .prefix segment */
index 34e2bdc8f556194a10b1fd7eac362ec66f59567e..41a5b46786655e8a58bfefe4aeed84c11b92fef4 100644 (file)
@@ -198,7 +198,6 @@ no_cmd_line:
 
        /* Run iPXE */
        pushl   $main
-       pushw   %cs
        call    prot_call
 
        /* Uninstall iPXE */
index 539b5ebaee9d858102f343faad5fef130ebab8d1..c25c254e5a1f8be2a1a387cd3361143ec882afc1 100644 (file)
@@ -67,7 +67,6 @@ _nbi_start:
        .section ".text16", "awx", @progbits
 1:
        pushl   $main
-       pushw   %cs
        call    prot_call
 
        /* Uninstall iPXE */
index c742add6309f5caaf7dcd3c9704f0c93982456fe..2c6d7abb7f39572447a88381b650149040526988 100644 (file)
@@ -821,7 +821,6 @@ run_ipxe:
 
        /* Run main program */
        pushl   $main
-       pushw   %cs
        call    prot_call
 
        /* Uninstall iPXE */
index 287a986c41b91c5af7496c2e0a4e7892005eb153..941e2ce6bb5c98efe761302ccee7dc9e0a4bb376 100644 (file)
@@ -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 */
index 0376afa889a30c791b321fbaf434827711a60ce9..fb42637c88185450cdcfeb1c968bcf1a21af46b1 100644 (file)
@@ -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 */
index c702c0ccb9d46dba8b1d2e4c8f0ef59a1e920740..46c1ab979dc8fbcdc3903a8b115e15c4783b858a 100644 (file)
@@ -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
index f86584e3f55cd57d9c67d808ed8deda3ba04b5c7..fc318ec7e0dc06d19adc663f0fde1a1fc4044e85 100644 (file)
@@ -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 ),