summaryrefslogtreecommitdiff
path: root/sys/arch/powerpc64
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2022-05-19 05:43:49 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2022-05-19 05:43:49 +0000
commit1d32d08dd8b528aa0dc2cb88d2f84aa8279c782b (patch)
tree1569bdd7c7f65f758729740275caefd68925a6cf /sys/arch/powerpc64
parente88b462acda7c518910ddd7e404cd581140eacc1 (diff)
Not so recent evolution of the PowerPC and POWER architectures have defined
exception addresses past EXC_LAST, making its definition wrong. Replace it with EXC_END, which points to the end of hardware exception addresses, and adjust logic accordingly. ok kettenis@
Diffstat (limited to 'sys/arch/powerpc64')
-rw-r--r--sys/arch/powerpc64/include/trap.h3
-rw-r--r--sys/arch/powerpc64/powerpc64/machdep.c8
2 files changed, 6 insertions, 5 deletions
diff --git a/sys/arch/powerpc64/include/trap.h b/sys/arch/powerpc64/include/trap.h
index 13905df90a0..279dc0e209d 100644
--- a/sys/arch/powerpc64/include/trap.h
+++ b/sys/arch/powerpc64/include/trap.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: trap.h,v 1.9 2022/05/19 05:43:48 miod Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
*
@@ -105,7 +106,7 @@
/* POWER8 */
#define EXC_SOFT_PATCH 0x1500 /* POWER8 Soft Patch Exception */
-#define EXC_LAST 0x2f00 /* Last possible exception vector */
+#define EXC_END 0x3000 /* End of exception vectors */
#define EXC_AST 0x3000 /* Fake AST vector */
diff --git a/sys/arch/powerpc64/powerpc64/machdep.c b/sys/arch/powerpc64/powerpc64/machdep.c
index 36929b11d7b..37f482cdd96 100644
--- a/sys/arch/powerpc64/powerpc64/machdep.c
+++ b/sys/arch/powerpc64/powerpc64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.71 2021/12/06 21:21:10 guenther Exp $ */
+/* $OpenBSD: machdep.c,v 1.72 2022/05/19 05:43:48 miod Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@@ -239,7 +239,7 @@ init_powernv(void *fdt, void *tocbase)
* Initialize all traps with the stub that calls the generic
* trap handler.
*/
- for (trap = EXC_RST; trap < EXC_LAST; trap += 32)
+ for (trap = EXC_RST; trap < EXC_END; trap += 32)
memcpy((void *)trap, trapcode, trapcodeend - trapcode);
/* Hypervisor interrupts needs special handling. */
@@ -262,7 +262,7 @@ init_powernv(void *fdt, void *tocbase)
*((void **)TRAP_RSTENTRY) = cpu_idle_restore_context;
/* Make the stubs visible to the CPU. */
- __syncicache(EXC_RSVD, EXC_LAST - EXC_RSVD);
+ __syncicache(EXC_RSVD, EXC_END - EXC_RSVD);
/* We're now ready to take traps. */
msr = mfmsr();
@@ -305,7 +305,7 @@ init_powernv(void *fdt, void *tocbase)
/* Remove interrupt vectors. */
reg.addr = trunc_page(EXC_RSVD);
- reg.size = round_page(EXC_LAST);
+ reg.size = round_page(EXC_END);
memreg_remove(&reg);
/* Remove kernel. */