commit 1c78e134cdce606a2d56b0a925b0ac3ce387213b
parent 371f0b5b497177e3cc399554a57c77d45294f4dd
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 23 Oct 2020 18:41:24 +0200
os9/arm64: Relocate exception strings in low memory
When an exception happens in low memory the strings stored in
ecstr are invalid, because they are linked at high memory. For
this reason is needed a variable to control if we are in low memory
or in high memory to relocate them if needed.
Change-Id: I210cd394f9c4a0796e48a0393b2143ff17f25bc5
Diffstat:
4 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/os9/arch/arm64/arch.h b/src/os9/arch/arm64/arch.h
@@ -34,3 +34,6 @@ extern void icache(void);
extern void immu(void);
extern void ifpu(void);
extern void igic(void);
+
+/* globals */
+extern int inlowmem;
diff --git a/src/os9/arch/arm64/crt.s b/src/os9/arch/arm64/crt.s
@@ -70,6 +70,8 @@ hmem:
ADR X0,mach
LDR X9,[X0,16]
ADD X30,X30,X9
+ ADR X9,inlowmem
+ STR XZR,[x9]
RET
OUTSYNC:
diff --git a/src/os9/arch/arm64/mmu.c b/src/os9/arch/arm64/mmu.c
@@ -136,6 +136,8 @@
#define NRALLOC 0ull
#define NWALLOC 0ull
+int inlowmem = 1;
+
static pte_t *
walker(uintptr_t va)
{
diff --git a/src/os9/arch/arm64/trap.c b/src/os9/arch/arm64/trap.c
@@ -23,6 +23,8 @@ trap(Context *ctx)
if (ec != SVC) {
msg = (ec < NR_EC_VALS) ? ecstr[ec] : "unknown reason";
+ if (inlowmem)
+ msg -= mach.kzero;
fault(msg, ctx);
}