svn commit: r190107 - in head/sys: sparc64/include sparc64/sparc64 sun4v/include sun4v/sun4v

Marius Strobl marius at FreeBSD.org
Thu Mar 19 13:46:53 PDT 2009


Author: marius
Date: Thu Mar 19 20:46:51 2009
New Revision: 190107
URL: http://svn.freebsd.org/changeset/base/190107

Log:
  - There's no need to wrap kdb_active and kdb_trap() in #ifdef KDB as
    they're always available.
  - Remove unused variable. [1]
  - Add a missing const.
  - Sort includes.
  
  Submitted by:	Christoph Mallon [1]

Modified:
  head/sys/sparc64/include/trap.h
  head/sys/sparc64/sparc64/trap.c
  head/sys/sun4v/include/trap.h
  head/sys/sun4v/sun4v/trap.c

Modified: head/sys/sparc64/include/trap.h
==============================================================================
--- head/sys/sparc64/include/trap.h	Thu Mar 19 20:43:01 2009	(r190106)
+++ head/sys/sparc64/include/trap.h	Thu Mar 19 20:46:51 2009	(r190107)
@@ -91,7 +91,7 @@
 
 #ifndef LOCORE
 void sun4u_set_traptable(void *tba_addr);
-extern const char *trap_msg[];
+extern const char *const trap_msg[];
 #endif
 
 #endif

Modified: head/sys/sparc64/sparc64/trap.c
==============================================================================
--- head/sys/sparc64/sparc64/trap.c	Thu Mar 19 20:43:01 2009	(r190106)
+++ head/sys/sparc64/sparc64/trap.c	Thu Mar 19 20:46:51 2009	(r190107)
@@ -71,7 +71,6 @@ __FBSDID("$FreeBSD$");
 #include <security/audit/audit.h>
 
 #include <dev/ofw/openfirm.h>
-#include <machine/ofw_machdep.h>
 
 #include <vm/vm.h>
 #include <vm/pmap.h>
@@ -84,7 +83,7 @@ __FBSDID("$FreeBSD$");
 #include <machine/cpu.h>
 #include <machine/frame.h>
 #include <machine/intr_machdep.h>
-#include <machine/pcb.h>
+#include <machine/ofw_machdep.h>
 #include <machine/smp.h>
 #include <machine/trap.h>
 #include <machine/tstate.h>
@@ -114,7 +113,7 @@ extern char fas_nofault_end[];
 
 extern char *syscallnames[];
 
-const char *trap_msg[] = {
+const char *const trap_msg[] = {
 	"reserved",
 	"instruction access exception",
 	"instruction access error",
@@ -329,15 +328,12 @@ trap(struct trapframe *tf)
 		KASSERT((tf->tf_type & T_KERNEL) != 0,
 		    ("trap: kernel trap isn't"));
 
-#ifdef KDB
 		if (kdb_active) {
 			kdb_reenter();
 			return;
 		}
-#endif
 
 		switch (tf->tf_type & ~T_KERNEL) {
-#ifdef KDB
 		case T_BREAKPOINT:
 		case T_KSTACK_FAULT:
 			error = (kdb_trap(tf->tf_type, 0, tf) == 0);
@@ -349,7 +345,6 @@ trap(struct trapframe *tf)
 			error = db_watch_trap(tf);
 			break;
 #endif
-#endif
 		case T_DATA_MISS:
 		case T_DATA_PROTECTION:
 		case T_INSTRUCTION_MISS:
@@ -409,7 +404,6 @@ static int
 trap_pfault(struct thread *td, struct trapframe *tf)
 {
 	struct vmspace *vm;
-	struct pcb *pcb;
 	struct proc *p;
 	vm_offset_t va;
 	vm_prot_t prot;
@@ -429,7 +423,6 @@ trap_pfault(struct thread *td, struct tr
 
 	rv = KERN_SUCCESS;
 	ctx = TLB_TAR_CTX(tf->tf_tar);
-	pcb = td->td_pcb;
 	type = tf->tf_type & ~T_KERNEL;
 	va = TLB_TAR_VA(tf->tf_tar);
 
@@ -559,11 +552,6 @@ syscall(struct trapframe *tf)
 
 	PCPU_INC(cnt.v_syscall);
 
-	narg = 0;
-	error = 0;
-	reg = 0;
-	regcnt = REG_MAXARGS;
-
 	td->td_pticks = 0;
 	td->td_frame = tf;
 	if (td->td_ucred != p->p_ucred)
@@ -577,6 +565,8 @@ syscall(struct trapframe *tf)
 	tpc = tf->tf_tpc;
 	TF_DONE(tf);
 
+	reg = 0;
+	regcnt = REG_MAXARGS;
 	if (p->p_sysent->sv_prepsyscall) {
 		/*
 		 * The prep code is MP aware.

Modified: head/sys/sun4v/include/trap.h
==============================================================================
--- head/sys/sun4v/include/trap.h	Thu Mar 19 20:43:01 2009	(r190106)
+++ head/sys/sun4v/include/trap.h	Thu Mar 19 20:46:51 2009	(r190107)
@@ -144,7 +144,7 @@
 
 
 #ifndef LOCORE
-extern const char *trap_msg[];
+extern const char *const trap_msg[];
 extern void set_mmfsa_traptable(void *, uint64_t);
 extern void trap_init(void);
 #endif

Modified: head/sys/sun4v/sun4v/trap.c
==============================================================================
--- head/sys/sun4v/sun4v/trap.c	Thu Mar 19 20:43:01 2009	(r190106)
+++ head/sys/sun4v/sun4v/trap.c	Thu Mar 19 20:46:51 2009	(r190107)
@@ -81,7 +81,6 @@
 #include <machine/cpu.h>
 #include <machine/frame.h>
 #include <machine/intr_machdep.h>
-#include <machine/pcb.h>
 #include <machine/smp.h>
 #include <machine/trap.h>
 #include <machine/tstate.h>
@@ -119,7 +118,7 @@ extern char fas_nofault_end[];
 
 extern char *syscallnames[];
 
-const char *trap_msg[] = {
+const char *const trap_msg[] = {
 	"reserved",
 	"instruction access exception",
 	"instruction access error",
@@ -390,21 +389,17 @@ trap(struct trapframe *tf, int64_t type,
 		    ("trap: kernel trap isn't - trap: %ld:%s: 0x%lx at 0x%lx on cpu=%d\n", 
 		     trapno, trap_msg[trapno], data, tf->tf_tpc, curcpu));
 
-#ifdef KDB
 		if (kdb_active) {
 			kdb_reenter();
 			return;
 		}
-#endif
 
 		switch (trapno) {
-#ifdef KDB
 		case T_BREAKPOINT:
 		case T_KSTACK_FAULT:
 			error = (kdb_trap(trapno, 0, tf) == 0);
 			TF_DONE(tf);
 			break;
-#endif
 		case T_DATA_MISS:
 		case T_DATA_PROTECTION:
 		case T_INSTRUCTION_MISS:
@@ -460,7 +455,6 @@ static int
 trap_pfault(struct thread *td, struct trapframe *tf, int64_t type, uint64_t data)
 {
 	struct vmspace *vm;
-	struct pcb *pcb;
 	struct proc *p;
 	vm_offset_t va;
 	vm_prot_t prot;
@@ -475,7 +469,6 @@ trap_pfault(struct thread *td, struct tr
 
 	rv = KERN_SUCCESS;
 	ctx = TLB_TAR_CTX(data);
-	pcb = td->td_pcb;
 	type = type & ~T_KERNEL;
 	va = TLB_TAR_VA(data);
 
@@ -603,11 +596,6 @@ syscall(struct trapframe *tf)
 
 	PCPU_INC(cnt.v_syscall);
 
-	narg = 0;
-	error = 0;
-	reg = 0;
-	regcnt = REG_MAXARGS;
-
 	td->td_pticks = 0;
 	td->td_frame = tf;
 	if (td->td_ucred != p->p_ucred)
@@ -621,6 +609,8 @@ syscall(struct trapframe *tf)
 	tpc = tf->tf_tpc;
 	TF_DONE(tf);
 
+	reg = 0;
+	regcnt = REG_MAXARGS;
 	if (p->p_sysent->sv_prepsyscall) {
 		/*
 		 * The prep code is MP aware.


More information about the svn-src-all mailing list