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@
-/* $OpenBSD: machdep.c,v 1.195 2021/12/07 17:50:44 guenther Exp $ */
+/* $OpenBSD: machdep.c,v 1.196 2022/05/19 05:43:48 miod Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
/*
* Set up trap vectors
*/
- for (exc = EXC_RSVD; exc <= EXC_LAST; exc += 0x100) {
+ for (exc = EXC_RSVD; exc < EXC_END; exc += 0x100) {
switch (exc) {
default:
bcopy(&trapcode, (void *)exc, (size_t)&trapsize);
}
/* Grr, ALTIVEC_UNAVAIL is a vector not ~0xff aligned: 0x0f20 */
- bcopy(&trapcode, (void *)0xf20, (size_t)&trapsize);
+ bcopy(&trapcode, (void *)EXC_VEC, (size_t)&trapsize);
/*
* since trapsize is > 0x20, we just overwrote the EXC_PERF handler
* do not generate EXC_PERF exceptions...
*/
- syncicache((void *)EXC_RST, EXC_LAST - EXC_RST + 0x100);
+ syncicache((void *)EXC_RST, EXC_END - EXC_RST);
/*
* Now enable translation (and machine checks/recoverable interrupts).
-/* $OpenBSD: trap.h,v 1.7 2007/04/26 21:36:32 kettenis Exp $ */
+/* $OpenBSD: trap.h,v 1.8 2022/05/19 05:43:48 miod Exp $ */
/* $NetBSD: trap.h,v 1.1 1996/09/30 16:34:35 ws Exp $ */
/*
#define EXC_DLMISS 0x1100 /* Data load translation miss */
#define EXC_DSMISS 0x1200 /* Data store translation miss */
-#define EXC_LAST 0x2f00 /* Last possible exception vector */
+#define EXC_END 0x3000 /* End of exception vectors */
#define EXC_AST 0x3000 /* Fake AST vector */
+/* $OpenBSD: trap.h,v 1.9 2022/05/19 05:43:48 miod Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
*
/* 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 */
-/* $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>
* 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. */
*((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();
/* Remove interrupt vectors. */
reg.addr = trunc_page(EXC_RSVD);
- reg.size = round_page(EXC_LAST);
+ reg.size = round_page(EXC_END);
memreg_remove(®);
/* Remove kernel. */