:: commit 7be1573cccd8b8dc1a79ab9f8c8e35d3ac28e696

mintsuki <mintsuki@protonmail.com> — 2024-10-28 03:31

parents: 46ba9940c0

Revert "efi_thunk/x86: Move to a custom stack inside .bss"

This reverts commit af27df9b7abc8d1208bc1b6dfc994b90c5299265.
diff --git a/common/efi_thunk.asm_uefi_ia32 b/common/efi_thunk.asm_uefi_ia32
index 5a70081c..3bcaee55 100644
--- a/common/efi_thunk.asm_uefi_ia32
+++ b/common/efi_thunk.asm_uefi_ia32
@@ -1,33 +1,10 @@
-extern _GLOBAL_OFFSET_TABLE_
-
-section .bss
-
-align 16
-stack:
-    resb 32768
-  .top:
-
 section .text
 
 global efi_main
 extern uefi_entry
 efi_main:
-    pop eax
-    pop ebx
-    pop ecx
-
-    call .get_got
-  .get_got:
-    pop eax
-    add eax, _GLOBAL_OFFSET_TABLE_ + $$ - .get_got wrt ..gotpc
-
-    lea eax, [eax + stack.top wrt ..gotoff]
-    mov esp, eax
-
-    push ecx
-    push ebx
     xor eax, eax
-    push eax
+    mov [esp], eax
     jmp uefi_entry
 
 section .note.GNU-stack noalloc noexec nowrite progbits
diff --git a/common/efi_thunk.asm_uefi_x86_64 b/common/efi_thunk.asm_uefi_x86_64
index e13b0c4d..dad16474 100644
--- a/common/efi_thunk.asm_uefi_x86_64
+++ b/common/efi_thunk.asm_uefi_x86_64
@@ -1,20 +1,10 @@
-section .bss
-
-align 16
-stack:
-    resb 32768
-  .top:
-
 section .text
 
 global efi_main
 extern uefi_entry
 efi_main:
-    lea rax, [rel stack.top]
-    sub rax, 8
-    mov rsp, rax
-
     xor eax, eax
+    mov [rsp], rax
     jmp uefi_entry
 
 section .note.GNU-stack noalloc noexec nowrite progbits
tab: 248 wrap: offon