From: deraadt Date: Tue, 13 Jun 2017 01:42:12 +0000 (+0000) Subject: Prepare install_extint() for the vector being relative-negative (ie X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c62e4ab210ea0f6d5bf9655a302e9011419d3005;p=openbsd Prepare install_extint() for the vector being relative-negative (ie lower in the address space). Previously it could only be higher than... uhm locore.o Discussed with drahn and tom --- diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c index 0b6548f9f4f..18ed83f1a52 100644 --- a/sys/arch/macppc/macppc/machdep.c +++ b/sys/arch/macppc/macppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.180 2017/04/30 16:45:45 mpi Exp $ */ +/* $OpenBSD: machdep.c,v 1.181 2017/06/13 01:42:12 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -331,16 +331,17 @@ install_extint(void (*handler)(void)) void extint(void); void extsize(void); extern u_long extint_call; - u_long offset = (u_long)handler - (u_long)&extint_call; + long offset = (u_long)handler - (u_long)&extint_call; int omsr, msr; -#ifdef DIAGNOSTIC - if (offset > 0x1ffffff) +#ifdef DIAGNOSTIC + if (offset > 0x1ffffff || offset < -0x1ffffff) panic("install_extint: too far away"); #endif omsr = ppc_mfmsr(); msr = omsr & ~PSL_EE; ppc_mtmsr(msr); + offset &= 0x3ffffff; extint_call = (extint_call & 0xfc000003) | offset; bcopy(&extint, (void *)EXC_EXI, (size_t)&extsize); syncicache((void *)&extint_call, sizeof extint_call);