From 17514b4ce79a0c306d4625f28727c90ed5ee804d Mon Sep 17 00:00:00 2001 From: matt Date: Tue, 8 Feb 2011 01:38:48 +0000 Subject: [PATCH] If we get a PGM exception for a trap, use SIGTRAP/TRAP_BRKPT instead of SIGILL/ILL_ILLTRP so GDB will recognize it. --- sys/arch/powerpc/booke/trap.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sys/arch/powerpc/booke/trap.c b/sys/arch/powerpc/booke/trap.c index 75f5ec63c1c7..424927aeb8d6 100644 --- a/sys/arch/powerpc/booke/trap.c +++ b/sys/arch/powerpc/booke/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.3 2011/02/07 06:41:08 matt Exp $ */ +/* $NetBSD: trap.c,v 1.4 2011/02/08 01:38:48 matt Exp $ */ /*- * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -39,7 +39,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.3 2011/02/07 06:41:08 matt Exp $"); +__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.4 2011/02/08 01:38:48 matt Exp $"); #include #include @@ -460,14 +460,16 @@ pgm_exception(struct trapframe *tf, ksiginfo_t *ksi) KSI_INIT_TRAP(ksi); ksi->ksi_signo = SIGILL; ksi->ksi_trap = EXC_PGM; - if (tf->tf_esr & ESR_PIL) + if (tf->tf_esr & ESR_PIL) { ksi->ksi_code = ILL_ILLOPC; - else if (tf->tf_esr & ESR_PPR) + } else if (tf->tf_esr & ESR_PPR) { ksi->ksi_code = ILL_PRVOPC; - else if (tf->tf_esr & ESR_PTR) - ksi->ksi_code = ILL_ILLTRP; - else + } else if (tf->tf_esr & ESR_PTR) { + ksi->ksi_signo = SIGTRAP; + ksi->ksi_code = TRAP_BRKPT; + } else { ksi->ksi_code = 0; + } ksi->ksi_addr = (void *)tf->tf_srr0; return rv; }