Skip to contentSkip to conversation

x86: cpu: Fix crash on FTRACE enabled builds

PATCH Superseded Patrick Rudolph 1 participant 1 message Dec 15, 2025 x86

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: cpu: Fix crash on FTRACE enabled builds

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.

---
 arch/x86/cpu/start64.S | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/cpu/start64.S +2 -0
index 78e894d2a21..3fcd8c15481 100644
@@ -16,6 +16,8 @@ _start:
 	/* Set up memory using the existing stack */
 	mov	%rsp, %rdi
 	call	board_init_f_alloc_reserve
+
+	mov	%rsp, %rdi
 	mov	%rax, %rsp
 
 	call	board_init_f_init_reserve
Signature · 1 line
2.52.0