* [PATCH] fixup! ARM: add exception handling support for PBL
@ 2025-07-09 10:12 Ahmad Fatoum
2025-08-05 9:20 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2025-07-09 10:12 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
ARM: interrupts: fix guard page linker error in PBL
We set up the stack guard page only in barebox proper. Attempting to
compile in support in barebox PBL leads to a compile error, because
arm_mem_guard_page_get() references arm_mem_endmem_get(), which is not
available.
Fix this by defining and using a new helper that always returns skips
referencing arm_mem_endmem_get when not IN_PROPER.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/cpu/interrupts_32.c | 10 ++--------
arch/arm/cpu/interrupts_64.c | 10 ++--------
arch/arm/include/asm/barebox-arm.h | 12 ++++++++++++
3 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/arch/arm/cpu/interrupts_32.c b/arch/arm/cpu/interrupts_32.c
index cd503b38eeea..b8b9210197ea 100644
--- a/arch/arm/cpu/interrupts_32.c
+++ b/arch/arm/cpu/interrupts_32.c
@@ -111,16 +111,10 @@ void do_prefetch_abort (struct pt_regs *pt_regs)
static const char *data_abort_reason(ulong far)
{
- ulong guard_page;
-
if (far < PAGE_SIZE)
return "NULL pointer dereference";
-
- if (IS_ENABLED(CONFIG_STACK_GUARD_PAGE)) {
- guard_page = arm_mem_guard_page_get();
- if (guard_page <= far && far < guard_page + PAGE_SIZE)
- return "stack overflow";
- }
+ if (inside_stack_guard_page(far))
+ return "stack overflow";
return "paging request";
}
diff --git a/arch/arm/cpu/interrupts_64.c b/arch/arm/cpu/interrupts_64.c
index 574ab6a7ec22..b4787783978e 100644
--- a/arch/arm/cpu/interrupts_64.c
+++ b/arch/arm/cpu/interrupts_64.c
@@ -147,16 +147,10 @@ extern volatile int arm_data_abort_occurred;
static const char *data_abort_reason(ulong far)
{
- ulong guard_page;
-
if (far < PAGE_SIZE)
return "NULL pointer dereference: ";
-
- if (IS_ENABLED(CONFIG_STACK_GUARD_PAGE)) {
- guard_page = arm_mem_guard_page_get();
- if (guard_page <= far && far < guard_page + PAGE_SIZE)
- return "Stack overflow: ";
- }
+ if (inside_stack_guard_page(far))
+ return "Stack overflow: ";
return NULL;
}
diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index 0abdd297a2ce..da6f5d528338 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -167,6 +167,18 @@ static inline unsigned long arm_mem_guard_page_get(void)
return arm_mem_guard_page(arm_mem_endmem_get());
}
+static inline bool inside_stack_guard_page(ulong addr)
+{
+ if (IS_ENABLED(CONFIG_STACK_GUARD_PAGE) && IN_PROPER) {
+ ulong guard_page = arm_mem_guard_page_get();
+
+ if (guard_page <= addr && addr < guard_page + PAGE_SIZE)
+ return true;
+ }
+
+ return false;
+}
+
/*
* When using compressed images in conjunction with relocatable images
* the PBL code must pick a suitable place where to uncompress the barebox
--
2.39.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] fixup! ARM: add exception handling support for PBL
2025-07-09 10:12 [PATCH] fixup! ARM: add exception handling support for PBL Ahmad Fatoum
@ 2025-08-05 9:20 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-08-05 9:20 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Wed, 09 Jul 2025 12:12:49 +0200, Ahmad Fatoum wrote:
> ARM: interrupts: fix guard page linker error in PBL
>
> We set up the stack guard page only in barebox proper. Attempting to
> compile in support in barebox PBL leads to a compile error, because
> arm_mem_guard_page_get() references arm_mem_endmem_get(), which is not
> available.
>
> [...]
Applied, thanks!
[1/1] fixup! ARM: add exception handling support for PBL
https://git.pengutronix.de/cgit/barebox/commit/?id=61522f98c253 (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-08-05 9:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-09 10:12 [PATCH] fixup! ARM: add exception handling support for PBL Ahmad Fatoum
2025-08-05 9:20 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox