Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/arm Add event counters for undefined instructio...



details:   https://anonhg.NetBSD.org/src/rev/e84f264325bc
branches:  trunk
changeset: 780131:e84f264325bc
user:      matt <matt%NetBSD.org@localhost>
date:      Thu Jul 12 17:20:20 2012 +0000

description:
Add event counters for undefined instruction and cp15 instruction emulation.

diffstat:

 sys/arch/arm/arm/undefined.c |  17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diffs (66 lines):

diff -r d38ad54a6268 -r e84f264325bc sys/arch/arm/arm/undefined.c
--- a/sys/arch/arm/arm/undefined.c      Thu Jul 12 17:15:27 2012 +0000
+++ b/sys/arch/arm/arm/undefined.c      Thu Jul 12 17:20:20 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: undefined.c,v 1.43 2011/11/16 16:59:47 he Exp $        */
+/*     $NetBSD: undefined.c,v 1.44 2012/07/12 17:20:20 matt Exp $      */
 
 /*
  * Copyright (c) 2001 Ben Harris.
@@ -54,7 +54,7 @@
 #include <sys/kgdb.h>
 #endif
 
-__KERNEL_RCSID(0, "$NetBSD: undefined.c,v 1.43 2011/11/16 16:59:47 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: undefined.c,v 1.44 2012/07/12 17:20:20 matt Exp $");
 
 #include <sys/malloc.h>
 #include <sys/queue.h>
@@ -122,6 +122,10 @@
        free(uh, M_TEMP);
 }
 
+static struct evcnt cp15_ev =
+    EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "cpu0", "undefined cp15 insn traps");
+EVCNT_ATTACH_STATIC(cp15_ev);
+
 static int
 cp15_trapper(u_int addr, u_int insn, struct trapframe *frame, int code)
 {
@@ -151,7 +155,7 @@
         */
        if ((insn & 0xffff0fff) == 0xee1d0f70) {
                *regp = (uintptr_t)l->l_private;
-               frame->tf_pc += INSN_SIZE;
+               cp15_ev.ev_count++;
                return 0;
        }
 
@@ -165,6 +169,7 @@
                else
                        pcb->pcb_user_pid_rw = *regp;
                frame->tf_pc += INSN_SIZE;
+               cp15_ev.ev_count++;
                return 0;
        }
 
@@ -235,6 +240,10 @@
 #endif
 }
 
+static struct evcnt und_ev =
+    EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "cpu0", "undefined insn traps");
+EVCNT_ATTACH_STATIC(und_ev);
+
 void
 undefinedinstruction(trapframe_t *frame)
 {
@@ -249,6 +258,8 @@
        int s;
 #endif
 
+       und_ev.ev_count++;
+
        /* Enable interrupts if they were enabled before the exception. */
 #ifdef acorn26
        if ((frame->tf_r15 & R15_IRQ_DISABLE) == 0)



Home | Main Index | Thread Index | Old Index