diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2020-12-23 10:47:11 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2020-12-23 10:47:11 +0000 |
commit | 12bbb7ecf6de74a23725b41d4420a4dc8762df5f (patch) | |
tree | 018b413038f30225336ff59ff0472da3c460a9e8 | |
parent | 644f76c6abd9add33af0bab4960d7557b80c9cf2 (diff) |
Handle a few more userland traps that would lead to a kernel panic.
-rw-r--r-- | sys/arch/powerpc64/powerpc64/trap.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/sys/arch/powerpc64/powerpc64/trap.c b/sys/arch/powerpc64/powerpc64/trap.c index 2d05ac6a28a..d8a89f6fa35 100644 --- a/sys/arch/powerpc64/powerpc64/trap.c +++ b/sys/arch/powerpc64/powerpc64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.47 2020/12/22 18:17:28 gkoehler Exp $ */ +/* $OpenBSD: trap.c,v 1.48 2020/12/23 10:47:10 kettenis Exp $ */ /* * Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org> @@ -332,7 +332,12 @@ trap(struct trapframe *frame) case EXC_PGM|EXC_USER: sv.sival_ptr = (void *)frame->srr0; - trapsignal(p, SIGTRAP, 0, TRAP_BRKPT, sv); + if (frame->srr1 & EXC_PGM_FPENABLED) + trapsignal(p, SIGFPE, 0, FPE_FLTINV, sv); + else if (frame->srr1 & EXC_PGM_TRAP) + trapsignal(p, SIGTRAP, 0, TRAP_BRKPT, sv); + else + trapsignal(p, SIGILL, 0, ILL_PRVOPC, sv); break; case EXC_FPU|EXC_USER: @@ -347,6 +352,11 @@ trap(struct trapframe *frame) trapsignal(p, SIGTRAP, 0, TRAP_TRACE, sv); break; + case EXC_HEA|EXC_USER: + sv.sival_ptr = (void *)frame->srr0; + trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv); + break; + case EXC_VEC|EXC_USER: if ((frame->srr1 & (PSL_FP|PSL_VEC|PSL_VSX)) == 0) restore_vsx(p); @@ -354,6 +364,13 @@ trap(struct trapframe *frame) frame->srr1 |= PSL_VEC; break; + case EXC_VSX|EXC_USER: + if ((frame->srr1 & (PSL_FP|PSL_VEC|PSL_VSX)) == 0) + restore_vsx(p); + curpcb->pcb_flags |= PCB_VSX; + frame->srr1 |= PSL_VSX; + break; + case EXC_FAC|EXC_USER: sv.sival_ptr = (void *)frame->srr0; trapsignal(p, SIGILL, 0, ILL_PRVOPC, sv); |