From 43a8f434a03f0a6a7af3f51de43614730925bb9e Mon Sep 17 00:00:00 2001 From: Thorsten Lockert Date: Sun, 9 Feb 1997 03:53:59 +0000 Subject: Use the instruction pointer from the trapframe many places CR2 does not hold valid data. --- sys/arch/i386/i386/trap.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'sys/arch/i386') diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c index c264eae7404..ee4de907951 100644 --- a/sys/arch/i386/i386/trap.c +++ b/sys/arch/i386/i386/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.19 1997/02/08 23:23:57 tholo Exp $ */ +/* $OpenBSD: trap.c,v 1.20 1997/02/09 03:53:58 tholo Exp $ */ /* $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $ */ #undef DEBUG @@ -288,24 +288,27 @@ trap(frame) goto out; } #endif - case T_SEGNPFLT|T_USER: trapsignal(p, SIGSEGV, vftype, SEGV_MAPERR, (caddr_t)rcr2()); goto out; + case T_SEGNPFLT|T_USER: + trapsignal(p, SIGSEGV, vftype, SEGV_MAPERR, frame.tf_eip); + goto out; + case T_STKFLT|T_USER: - trapsignal(p, SIGSEGV, vftype, SEGV_MAPERR, (caddr_t)rcr2()); + trapsignal(p, SIGSEGV, vftype, SEGV_MAPERR, frame.tf_eip); goto out; case T_ALIGNFLT|T_USER: - trapsignal(p, SIGBUS, vftype, BUS_ADRALN, (caddr_t)rcr2()); + trapsignal(p, SIGBUS, vftype, BUS_ADRALN, frame.tf_eip); goto out; case T_PRIVINFLT|T_USER: /* privileged instruction fault */ - trapsignal(p, SIGILL, type &~ T_USER, ILL_PRVOPC, (caddr_t)rcr2()); + trapsignal(p, SIGILL, type &~ T_USER, ILL_PRVOPC, frame.tf_eip); goto out; case T_FPOPFLT|T_USER: /* coprocessor operand fault */ - trapsignal(p, SIGILL, type &~ T_USER, ILL_COPROC, (caddr_t)rcr2()); + trapsignal(p, SIGILL, type &~ T_USER, ILL_COPROC, frame.tf_eip); goto out; case T_ASTFLT|T_USER: /* Allow process switch */ @@ -324,28 +327,28 @@ trap(frame) goto trace; return; } - trapsignal(p, rv, type &~ T_USER, FPE_FLTINV, (caddr_t)rcr2()); + trapsignal(p, rv, type &~ T_USER, FPE_FLTINV, frame.tf_eip); goto out; #else printf("pid %d killed due to lack of floating point\n", p->p_pid); - trapsignal(p, SIGKILL, type &~ T_USER, FPE_FLTINV, (caddr_t)rcr2()); + trapsignal(p, SIGKILL, type &~ T_USER, FPE_FLTINV, frame.tf_eip); goto out; #endif } case T_BOUND|T_USER: - trapsignal(p, SIGFPE, type &~ T_USER, FPE_FLTSUB, (caddr_t)rcr2()); + trapsignal(p, SIGFPE, type &~ T_USER, FPE_FLTSUB, frame.tf_eip); goto out; case T_OFLOW|T_USER: - trapsignal(p, SIGFPE, type &~ T_USER, FPE_INTOVF, (caddr_t)rcr2()); + trapsignal(p, SIGFPE, type &~ T_USER, FPE_INTOVF, frame.tf_eip); goto out; case T_DIVIDE|T_USER: - trapsignal(p, SIGFPE, type &~ T_USER, FPE_INTDIV, (caddr_t)rcr2()); + trapsignal(p, SIGFPE, type &~ T_USER, FPE_INTDIV, frame.tf_eip); goto out; case T_ARITHTRAP|T_USER: - trapsignal(p, SIGFPE, frame.tf_err, FPE_INTOVF, (caddr_t)rcr2()); + trapsignal(p, SIGFPE, frame.tf_err, FPE_INTOVF, frame.tf_eip); goto out; case T_PAGEFLT: /* allow page faults in kernel mode */ -- cgit v1.2.3