Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Feb 2008 05:13:18 GMT
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 135774 for review
Message-ID:  <200802200513.m1K5DI1P082872@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=135774

Change 135774 by marcel@marcel_xcllnt on 2008/02/20 05:12:57

	Replace NetBSD's evcnt with sysctl.
	Minor tweaking to make it compile.

Affected files ...

.. //depot/projects/e500/sys/powerpc/fpu/fpu_emu.c#4 edit

Differences ...

==== //depot/projects/e500/sys/powerpc/fpu/fpu_emu.c#4 (text+ko) ====

@@ -80,13 +80,17 @@
 
 #include "opt_ddb.h"
 
+#define DEBUG
+
 #include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kdb.h>
+#include <sys/kernel.h>
 #include <sys/proc.h>
+#include <sys/sysctl.h>
 #include <sys/signal.h>
-#include <sys/systm.h>
 #include <sys/syslog.h>
 #include <sys/signalvar.h>
-//#include <sys/device.h>		/* for evcnt */
 
 #include <machine/fpu.h>
 #include <machine/reg.h>
@@ -95,13 +99,14 @@
 #include <powerpc/fpu/fpu_extern.h>
 #include <powerpc/fpu/fpu_instr.h>
 
+SYSCTL_NODE(_hw, OID_AUTO, fpu_emu, CTLFLAG_RW, 0, "FPU emulator");
+
 #define	FPU_EMU_EVCNT_DECL(name)					\
-static struct evcnt fpu_emu_ev_##name =					\
-    EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "fpemu", #name);		\
-EVCNT_ATTACH_STATIC(fpu_emu_ev_##name)
+static u_int fpu_emu_evcnt_##name;					\
+SYSCTL_INT(_hw_fpu_emu, OID_AUTO, evcnt_##name, CTLFLAG_RD,		\
+    &fpu_emu_evcnt_##name, 0, "")
 
-#define	FPU_EMU_EVCNT_INCR(name)					\
-    fpu_emu_ev_##name.ev_count++
+#define	FPU_EMU_EVCNT_INCR(name)	fpu_emu_evcnt_##name++
 
 FPU_EMU_EVCNT_DECL(stfiwx);
 FPU_EMU_EVCNT_DECL(fpstore);
@@ -143,14 +148,11 @@
 #define	FPSR_EX		(FPSCR_VE|FPSCR_OE|FPSCR_UE|FPSCR_ZE|FPSCR_XE)
 #define	FPSR_EXOP	(FPSR_EX_MSK&(~FPSR_EX))
 
-
 int fpe_debug = 0;
 
-#ifdef DDB
-extern vaddr_t opc_disasm(vaddr_t loc, int opcode);
-#endif
+#ifdef DEBUG
+vm_offset_t opc_disasm(vm_offset_t, int);
 
-#ifdef DEBUG
 /*
  * Dump a `fpn' structure.
  */
@@ -238,7 +240,7 @@
 		if (fpe_debug & FPE_EX) {
 			printf("fpu_emulate:  illegal insn %x at %p:",
 			insn.i_int, (void *) (frame->srr0));
-			opc_disasm((vaddr_t)(frame->srr0), insn.i_int);
+			opc_disasm(frame->srr0, insn.i_int);
 		}
 #endif
 		/*
@@ -248,7 +250,7 @@
 			sig = SIGILL;
 #ifdef DEBUG
 			if (fpe_debug & FPE_EX)
-				Debugger();
+				kdb_enter(KDB_WHY_UNSET, "illegal instruction");
 #endif
 		}
 		lastill = frame->srr0;
@@ -272,7 +274,7 @@
 	struct fpn *fp;
 	union instr instr = *insn;
 	int *a;
-	vaddr_t addr;
+	vm_offset_t addr;
 	int ra, rb, rc, rt, type, mask, fsr, cx, bf, setcr;
 	unsigned int cond;
 	struct fpreg *fs;
@@ -293,7 +295,7 @@
 
 #if defined(DDB) && defined(DEBUG)
 	if (fpe_debug & FPE_EX) {
-		vaddr_t loc = tf->srr0;
+		vm_offset_t loc = tf->srr0;
 
 		printf("Trying to emulate: %p ", (void *)loc);
 		opc_disasm(loc, instr.i_int);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802200513.m1K5DI1P082872>