x86/efistub: Call mixed mode boot services on the firmware's stack
[sfrench/cifs-2.6.git] / arch / x86 / boot / compressed / efi_mixed.S
index f4e22ef774ab6b4a0702d0e608007a994cec3fbe..719e939050cbfa0b9d574b326d46c4791a0a3eed 100644 (file)
@@ -49,6 +49,11 @@ SYM_FUNC_START(startup_64_mixed_mode)
        lea     efi32_boot_args(%rip), %rdx
        mov     0(%rdx), %edi
        mov     4(%rdx), %esi
+
+       /* Switch to the firmware's stack */
+       movl    efi32_boot_sp(%rip), %esp
+       andl    $~7, %esp
+
 #ifdef CONFIG_EFI_HANDOVER_PROTOCOL
        mov     8(%rdx), %edx           // saved bootparams pointer
        test    %edx, %edx
@@ -254,6 +259,9 @@ SYM_FUNC_START_LOCAL(efi32_entry)
        /* Store firmware IDT descriptor */
        sidtl   (efi32_boot_idt - 1b)(%ebx)
 
+       /* Store firmware stack pointer */
+       movl    %esp, (efi32_boot_sp - 1b)(%ebx)
+
        /* Store boot arguments */
        leal    (efi32_boot_args - 1b)(%ebx), %ebx
        movl    %ecx, 0(%ebx)
@@ -318,5 +326,6 @@ SYM_DATA_END(efi32_boot_idt)
 
 SYM_DATA_LOCAL(efi32_boot_cs, .word 0)
 SYM_DATA_LOCAL(efi32_boot_ds, .word 0)
+SYM_DATA_LOCAL(efi32_boot_sp, .long 0)
 SYM_DATA_LOCAL(efi32_boot_args, .long 0, 0, 0)
 SYM_DATA(efi_is64, .byte 1)