mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM64: support reserving the x18 platform register
@ 2025-12-15  8:47 Ahmad Fatoum
  2025-12-15  9:12 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2025-12-15  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Linux helpfully complained about "register x18 corrupted by EFI" with
the upcoming EFI loader support as this register is apparently the
platform register and is meant to be usable by the OS without other
firmware like the EFI runtime services clobbering it.

Provide a hidden AAPCS64 symbol that will be usable for this purpose.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/Kconfig  | 11 +++++++++++
 arch/arm/Makefile |  1 +
 2 files changed, 12 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index afa6de3cd0b1..d2d81a4f90d6 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -313,6 +313,17 @@ config AEABI
 
 	  To use this you need GCC version 4.0.0 or later.
 
+config AAPCS64
+	bool "Observe ARM64 Procedure Call Standard" if COMPILE_TEST
+	depends on CPU_V8
+	help
+	  This option instructs barebox to observe the AAPCS64 for
+	  interoperability with other firmware.
+
+	  The only effect this currently has is reserving x18 (the
+	  platform register), so Linux can call back into a barebox
+	  EFI runtime service without it getting clobbered.
+
 config THUMB2_BAREBOX
 	select AEABI
 	depends on !ARCH_TEGRA && !ARCH_AT91
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index d6ae6b648f65..4d84f3bf9c72 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -68,6 +68,7 @@ CFLAGS_ABI-$(CONFIG_CPU_32)	:=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call
 CFLAGS_ABI-$(CONFIG_AEABI)	:=-mabi=aapcs-linux
 
 CFLAGS_ABI-$(CONFIG_ARM_UNWIND)	+=-funwind-tables
+CFLAGS_ABI-$(CONFIG_AAPCS64)	+=-ffixed-x18
 
 ifeq ($(CONFIG_THUMB2_BAREBOX),y)
 AFLAGS_AUTOIT	:=$(call as-option,-Wa$(comma)-mimplicit-it=always,-Wa$(comma)-mauto-it)
-- 
2.47.3




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARM64: support reserving the x18 platform register
  2025-12-15  8:47 [PATCH] ARM64: support reserving the x18 platform register Ahmad Fatoum
@ 2025-12-15  9:12 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-12-15  9:12 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Mon, 15 Dec 2025 09:47:10 +0100, Ahmad Fatoum wrote:
> Linux helpfully complained about "register x18 corrupted by EFI" with
> the upcoming EFI loader support as this register is apparently the
> platform register and is meant to be usable by the OS without other
> firmware like the EFI runtime services clobbering it.
> 
> Provide a hidden AAPCS64 symbol that will be usable for this purpose.
> 
> [...]

Applied, thanks!

[1/1] ARM64: support reserving the x18 platform register
      https://git.pengutronix.de/cgit/barebox/commit/?id=0562055890bc (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-15  9:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-15  8:47 [PATCH] ARM64: support reserving the x18 platform register Ahmad Fatoum
2025-12-15  9:12 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox