]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
x86: cpu: Fix crash on FTRACE enabled builds
authorPatrick Rudolph <patrick.rudolph@9elements.com>
Mon, 15 Dec 2025 08:16:39 +0000 (09:16 +0100)
committerTom Rini <trini@konsulko.com>
Tue, 3 Feb 2026 18:51:43 +0000 (12:51 -0600)
When compiled with FTRACE=1 U-boot will crash as %rdi is clobbered
in board_init_f_alloc_reserve() and board_init_f_init_reserve() will
memset the .text segment instead of the global_data struct.

According to the System V AMD64 ABI %rdi is not preserved and the
existing code only worked as board_init_f_alloc_reserve() was small
enough to not use %rdi.

Fix that by always passing the correct argument to
board_init_f_init_reserve().

TEST=Can boot on qemu-q35 with FTRACE=1 enabled during build.

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
arch/x86/cpu/start64.S

index 78e894d2a21a21891f7f73c741d113da6a9646f6..968a2929d0be3bb75c5ec0b06b109157d8c1b166 100644 (file)
@@ -16,7 +16,9 @@ _start:
        /* Set up memory using the existing stack */
        mov     %rsp, %rdi
        call    board_init_f_alloc_reserve
+
        mov     %rax, %rsp
+       mov     %rsp, %rdi
 
        call    board_init_f_init_reserve