mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] ARM64: support reserving the x18 platform register
Date: Mon, 15 Dec 2025 09:47:10 +0100	[thread overview]
Message-ID: <20251215084711.2635214-1-a.fatoum@pengutronix.de> (raw)

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




             reply	other threads:[~2025-12-15  8:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-15  8:47 Ahmad Fatoum [this message]
2025-12-15  9:12 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251215084711.2635214-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox