PERFORCE change 93257 for review

Kip Macy kmacy at FreeBSD.org
Mon Mar 13 20:10:55 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=93257

Change 93257 by kmacy at kmacy_storage:sun4v_work on 2006/03/13 20:10:25

	switch trap over to not taking all data out of the trapframe

Affected files ...

.. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/trap.c#7 edit

Differences ...

==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/trap.c#7 (text+ko) ====

@@ -92,12 +92,12 @@
 #include <machine/md_var.h>
 #include <machine/hypervisor_api.h>
 
-void trap(struct trapframe *tf);
+void trap(struct trapframe *tf, int64_t type, uint64_t data);
 void syscall(struct trapframe *tf);
 
 vm_paddr_t mmu_fault_status_area;
 
-static int trap_pfault(struct thread *td, struct trapframe *tf);
+static int trap_pfault(struct thread *td, struct trapframe *tf, int64_t type, uint64_t data);
 
 extern char copy_fault[];
 extern char copy_nofault_begin[];
@@ -246,7 +246,7 @@
 }
 
 void
-trap(struct trapframe *tf)
+trap(struct trapframe *tf, int64_t type, uint64_t data)
 {
 	struct thread *td;
 	struct proc *p;
@@ -257,7 +257,7 @@
 	td = PCPU_GET(curthread);
 
 	CTR4(KTR_TRAP, "trap: %p type=%s (%s) pil=%#lx", td,
-	    trap_msg[tf->tf_type & ~T_KERNEL],
+	    trap_msg[type & ~T_KERNEL],
 	    (TRAPF_USERMODE(tf) ? "user" : "kernel"), rdpr(pil));
 
 	PCPU_LAZY_INC(cnt.v_trap);
@@ -272,11 +272,11 @@
 		if (td->td_ucred != p->p_ucred)
 			cred_update_thread(td);
 
-		switch (tf->tf_type) {
+		switch (type) {
 		case T_DATA_MISS:
 		case T_DATA_PROTECTION:
 		case T_INSTRUCTION_MISS:
-			sig = trap_pfault(td, tf);
+			sig = trap_pfault(td, tf, type, data);
 			break;
 		case T_FILL:
 			sig = rwindow_load(td, tf, 2);
@@ -288,10 +288,10 @@
 			sig = rwindow_save(td);
 			break;
 		default:
-			if (tf->tf_type < 0 || tf->tf_type >= T_MAX ||
-			    trap_sig[tf->tf_type] == -1)
+			if (type < 0 || type >= T_MAX ||
+			    trap_sig[type] == -1)
 				panic("trap: bad trap type");
-			sig = trap_sig[tf->tf_type];
+			sig = trap_sig[type];
 			break;
 		}
 
@@ -299,23 +299,23 @@
 			/* Translate fault for emulators. */
 			if (p->p_sysent->sv_transtrap != NULL) {
 				sig = p->p_sysent->sv_transtrap(sig,
-				    tf->tf_type);
+				    type);
 			}
 			if (debugger_on_signal &&
 			    (sig == 4 || sig == 10 || sig == 11))
 				kdb_enter("trapsig");
 			ksiginfo_init_trap(&ksi);
 			ksi.ksi_signo = sig;
-			ksi.ksi_code = (int)tf->tf_type; /* XXX not POSIX */
+			ksi.ksi_code = (int)type; /* XXX not POSIX */
 			/* ksi.ksi_addr = ? */
-			ksi.ksi_trapno = (int)tf->tf_type;
+			ksi.ksi_trapno = (int)type;
 			trapsignal(td, &ksi);
 		}
 
 		userret(td, tf);
 		mtx_assert(&Giant, MA_NOTOWNED);
  	} else {
-		KASSERT((tf->tf_type & T_KERNEL) != 0,
+		KASSERT((type & T_KERNEL) != 0,
 		    ("trap: kernel trap isn't"));
 
 #ifdef KDB
@@ -325,18 +325,18 @@
 		}
 #endif
 
-		switch (tf->tf_type & ~T_KERNEL) {
+		switch (type & ~T_KERNEL) {
 #ifdef KDB
 		case T_BREAKPOINT:
 		case T_KSTACK_FAULT:
-			error = (kdb_trap(tf->tf_type, 0, tf) == 0);
+			error = (kdb_trap(type, 0, tf) == 0);
 			TF_DONE(tf);
 			break;
 #endif
 		case T_DATA_MISS:
 		case T_DATA_PROTECTION:
 		case T_INSTRUCTION_MISS:
-			error = trap_pfault(td, tf);
+			error = trap_pfault(td, tf, type, data);
 			break;
 		case T_DATA_EXCEPTION:
 		case T_MEM_ADDRESS_NOT_ALIGNED:
@@ -371,13 +371,13 @@
 		}
 
 		if (error != 0)
-			panic("trap: %s", trap_msg[tf->tf_type & ~T_KERNEL]);
+			panic("trap: %s", trap_msg[type & ~T_KERNEL]);
 	}
 	CTR1(KTR_TRAP, "trap: td=%p return", td);
 }
 
 static int
-trap_pfault(struct thread *td, struct trapframe *tf)
+trap_pfault(struct thread *td, struct trapframe *tf, int64_t type, uint64_t data)
 {
 	struct vmspace *vm;
 	struct pcb *pcb;
@@ -386,7 +386,6 @@
 	vm_prot_t prot;
 	u_long ctx;
 	int flags;
-	int type;
 	int rv;
 
 	if (td == NULL)
@@ -398,10 +397,10 @@
 	p = td->td_proc;
 
 	rv = KERN_SUCCESS;
-	ctx = TLB_TAR_CTX(tf->tf_tar);
+	ctx = TLB_TAR_CTX(data);
 	pcb = td->td_pcb;
-	type = tf->tf_type & ~T_KERNEL;
-	va = TLB_TAR_VA(tf->tf_tar);
+	type = type & ~T_KERNEL;
+	va = TLB_TAR_VA(data);
 
 	CTR4(KTR_TRAP, "trap_pfault: td=%p pm_ctx=%#lx va=%#lx ctx=%#lx",
 	    td, p->p_vmspace->vm_pmap.pm_context[PCPU_GET(cpuid)], va, ctx);


More information about the p4-projects mailing list