Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Mar 2004 20:48:23 -0800 (PST)
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 49431 for review
Message-ID:  <200403210448.i2L4mN3o062498@repoman.freebsd.org>

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

Change 49431 by jmallett@jmallett_oingo on 2004/03/20 20:47:39

	Rework to return the trapframe.

Affected files ...

.. //depot/projects/mips/sys/mips/mips/trap.c#18 edit

Differences ...

==== //depot/projects/mips/sys/mips/mips/trap.c#18 (text+ko) ====

@@ -87,9 +87,9 @@
 #define	MAXTRAPID	31
 
 /* XXX belongs in a header some day? */
-void trap(struct trapframe *, u_int, void *);
+struct trapframe *trap(struct trapframe *, u_int, void *);
 
-void
+struct trapframe *
 trap(struct trapframe *tf, u_int cause, void *badvaddr)
 {
 	struct trap_identifier *tid;
@@ -99,6 +99,10 @@
 
 	code = (cause & MIPS_CR_EXC_CODE) >> MIPS_CR_EXC_CODE_SHIFT;
 	kernelmode = (tf->tf_regs[TF_SR] & MIPS_SR_KSU_USER) == 0;
+	
+	if (curthread != NULL) {
+		curthread->td_frame = tf;
+	}
 
 	/*
 	 * Handle that which we can.
@@ -108,13 +112,17 @@
 		/* XXX Kernel only. */
 		tlb_modified(badvaddr);
 		platform_trap_exit();
-		return;
+		if (curthread)
+			tf = curthread->td_frame;
+		return (tf);
 	case TrInt:
 		platform_trap_exit();
 		atomic_add_int(&curthread->td_intr_nesting_level, 1);
 		platform_intr(tf);
 		atomic_subtract_int(&curthread->td_intr_nesting_level, 1);
-		return;
+		if (curthread)
+			tf = curthread->td_frame;
+		return (tf);
 	default:
 		/* Fatal! */
 		break;
@@ -154,14 +162,12 @@
 #if	DDB
 	default:
 		kdb_trap(code, tf);
-		break;
+		goto done;
 #else
 	default:
 		goto dopanic;
 #endif
 	}
-	platform_trap_exit();
-	return;
 #ifndef	DDB
 dopanic:
 	if (panicstr != NULL) {
@@ -169,6 +175,10 @@
 		cpu_reset();
 	}
 	panic("trap");
+#endif
+done:
 	platform_trap_exit();
-#endif
+	if (curthread)
+		tf = curthread->td_frame;
+	return (tf);
 }



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