diff options
author | bde <bde@FreeBSD.org> | 1994-12-24 07:22:58 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1994-12-24 07:22:58 +0000 |
commit | 56c1610b718e566d6b35ed42ba72ae1b4922b393 (patch) | |
tree | ca1ddb515bfff18d70eb883221762cc1a5654957 /sys | |
parent | 9b98551f59193f2b6827c9a2c5a759c79e8f9ea1 (diff) | |
download | FreeBSD-src-56c1610b718e566d6b35ed42ba72ae1b4922b393.zip FreeBSD-src-56c1610b718e566d6b35ed42ba72ae1b4922b393.tar.gz |
Obtained from: 1.1.5
Fix single-stepping of emulated FPU instructions.
Don't panic if an FPU instruction is attempted but there is no FPU
and no FPU emulator is configured.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/amd64/trap.c | 14 | ||||
-rw-r--r-- | sys/i386/i386/trap.c | 14 | ||||
-rw-r--r-- | sys/kern/subr_trap.c | 14 |
3 files changed, 30 insertions, 12 deletions
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 1aa5202..d0ca150 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id: trap.c,v 1.40 1994/10/21 01:18:38 wollman Exp $ + * $Id: trap.c,v 1.41 1994/10/30 20:25:21 bde Exp $ */ /* @@ -259,11 +259,17 @@ trap(frame) #if defined(MATH_EMULATE) || defined(GPL_MATH_EMULATE) i = math_emulate(&frame); - if (i == 0) return; + if (i == 0) { + if (!(frame.tf_eflags & PSL_T)) + return; + frame.tf_eflags &= ~PSL_T; + i = SIGTRAP; + } + /* else ucode = emulator_only_knows() XXX */ #else /* MATH_EMULATE || GPL_MATH_EMULATE */ - panic("trap: math emulation necessary!"); -#endif /* MATH_EMULATE || GPL_MATH_EMULATE */ + i = SIGFPE; ucode = FPE_FPU_NP_TRAP; +#endif /* MATH_EMULATE || GPL_MATH_EMULATE */ break; case T_FPOPFLT: /* FPU operand fetch fault */ diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index 1aa5202..d0ca150 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id: trap.c,v 1.40 1994/10/21 01:18:38 wollman Exp $ + * $Id: trap.c,v 1.41 1994/10/30 20:25:21 bde Exp $ */ /* @@ -259,11 +259,17 @@ trap(frame) #if defined(MATH_EMULATE) || defined(GPL_MATH_EMULATE) i = math_emulate(&frame); - if (i == 0) return; + if (i == 0) { + if (!(frame.tf_eflags & PSL_T)) + return; + frame.tf_eflags &= ~PSL_T; + i = SIGTRAP; + } + /* else ucode = emulator_only_knows() XXX */ #else /* MATH_EMULATE || GPL_MATH_EMULATE */ - panic("trap: math emulation necessary!"); -#endif /* MATH_EMULATE || GPL_MATH_EMULATE */ + i = SIGFPE; ucode = FPE_FPU_NP_TRAP; +#endif /* MATH_EMULATE || GPL_MATH_EMULATE */ break; case T_FPOPFLT: /* FPU operand fetch fault */ diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index 1aa5202..d0ca150 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id: trap.c,v 1.40 1994/10/21 01:18:38 wollman Exp $ + * $Id: trap.c,v 1.41 1994/10/30 20:25:21 bde Exp $ */ /* @@ -259,11 +259,17 @@ trap(frame) #if defined(MATH_EMULATE) || defined(GPL_MATH_EMULATE) i = math_emulate(&frame); - if (i == 0) return; + if (i == 0) { + if (!(frame.tf_eflags & PSL_T)) + return; + frame.tf_eflags &= ~PSL_T; + i = SIGTRAP; + } + /* else ucode = emulator_only_knows() XXX */ #else /* MATH_EMULATE || GPL_MATH_EMULATE */ - panic("trap: math emulation necessary!"); -#endif /* MATH_EMULATE || GPL_MATH_EMULATE */ + i = SIGFPE; ucode = FPE_FPU_NP_TRAP; +#endif /* MATH_EMULATE || GPL_MATH_EMULATE */ break; case T_FPOPFLT: /* FPU operand fetch fault */ |