UEFI test builds currently use the stack pointer configured by the UEFI implementation. Reserve stack space in .data for EFI testcases and switch %rsp to use this memory on early boot. This provides one 4K page per CPU to store its stack / percpu data. Signed-off-by: Varad Gautam <varad.gautam@xxxxxxxx> --- x86/efi/crt0-efi-x86_64.S | 3 +++ x86/efi/efistart64.S | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/x86/efi/crt0-efi-x86_64.S b/x86/efi/crt0-efi-x86_64.S index eaf1656..1708ed5 100644 --- a/x86/efi/crt0-efi-x86_64.S +++ b/x86/efi/crt0-efi-x86_64.S @@ -58,6 +58,9 @@ _start: popq %rdi popq %rsi + /* Switch away from EFI stack. */ + lea stacktop(%rip), %rsp + call efi_main addq $8, %rsp diff --git a/x86/efi/efistart64.S b/x86/efi/efistart64.S index 8eadca5..cb08230 100644 --- a/x86/efi/efistart64.S +++ b/x86/efi/efistart64.S @@ -6,6 +6,14 @@ .data +max_cpus = MAX_TEST_CPUS + +/* Reserve stack in .data */ + . = . + 4096 * max_cpus + .align 16 +.globl stacktop +stacktop: + .align PAGE_SIZE .globl ptl2 ptl2: -- 2.32.0