Module Name:    src
Committed By:   chs
Date:           Wed Jul  7 01:18:39 UTC 2010

Modified Files:
        src/sys/arch/hp700/hp700: intr.c
        src/sys/arch/hppa/hppa: copy.S trap.c

Log Message:
fix hppa ucas_*():
 - "ret" is a kernel-space pointer.
 - move the ucas RAS check from the device interrupt path
   to the page-fault path.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/hp700/hp700/intr.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/hppa/hppa/copy.S
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/hppa/hppa/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/hp700/hp700/intr.c
diff -u src/sys/arch/hp700/hp700/intr.c:1.25 src/sys/arch/hp700/hp700/intr.c:1.26
--- src/sys/arch/hp700/hp700/intr.c:1.25	Wed Mar 31 17:46:21 2010
+++ src/sys/arch/hp700/hp700/intr.c	Wed Jul  7 01:18:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.25 2010/03/31 17:46:21 skrll Exp $	*/
+/*	$NetBSD: intr.c,v 1.26 2010/07/07 01:18:39 chs Exp $	*/
 /*	$OpenBSD: intr.c,v 1.27 2009/12/31 12:52:35 jsing Exp $	*/
 
 /*
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.25 2010/03/31 17:46:21 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.26 2010/07/07 01:18:39 chs Exp $");
 
 #define __MUTEX_PRIVATE
 
@@ -370,9 +370,6 @@
 	int hp700_intr_ipending_new(struct hp700_int_reg *, int);
 	struct cpu_info *ci = curcpu();
 
-	extern char ucas_ras_start[];
-	extern char ucas_ras_end[];
-
 #ifndef LOCKDEBUG
 	extern char mutex_enter_crit_start[];
 	extern char mutex_enter_crit_end[];
@@ -399,13 +396,6 @@
 		((kmutex_t *)frame->tf_arg0)->mtx_owner = (uintptr_t)curlwp;
 #endif
 
-	if (frame->tf_iisq_head == HPPA_SID_KERNEL &&
-	    frame->tf_iioq_head >= (u_int)ucas_ras_start &&
-	    frame->tf_iioq_head <= (u_int)ucas_ras_end) {
-		frame->tf_iioq_head = (u_int)ucas_ras_start;
-		frame->tf_iioq_tail = (u_int)ucas_ras_start + 4;
-	}
-
 	/*
 	 * Read the CPU interrupt register and acknowledge all interrupts.
 	 * Starting with this value, get our set of new pending interrupts and

Index: src/sys/arch/hppa/hppa/copy.S
diff -u src/sys/arch/hppa/hppa/copy.S:1.17 src/sys/arch/hppa/hppa/copy.S:1.18
--- src/sys/arch/hppa/hppa/copy.S:1.17	Sun Jun  6 12:13:36 2010
+++ src/sys/arch/hppa/hppa/copy.S	Wed Jul  7 01:18:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: copy.S,v 1.17 2010/06/06 12:13:36 skrll Exp $	*/
+/*	$NetBSD: copy.S,v 1.18 2010/07/07 01:18:39 chs Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -363,14 +363,11 @@
 
 ucas_ras_start:
 	ldw	0(%sr1, %arg0), %t1
-	comb,<>	%arg1, %t1, 2f
-	 copy	%t1, %ret1
-ucas_ras_end:
+	comb,<>	%arg1, %t1, ucas_ras_end
+	 copy	%r0, %ret0
 	stw	%arg2, 0(%sr1, %arg0)
-	copy	%arg1, %ret1
-2:
-	stw	%ret1,	0(%sr1, %arg3)
-	copy	%r0, %ret0
+ucas_ras_end:
+	stw	%t1, 0(%arg3)
 
 L$ucas_32_fault:
 	bv	0(%rp)
@@ -380,4 +377,3 @@
 	bv	0(%rp)
 	 ldi	EFAULT, %ret0
 EXIT(ucas_32)
-

Index: src/sys/arch/hppa/hppa/trap.c
diff -u src/sys/arch/hppa/hppa/trap.c:1.92 src/sys/arch/hppa/hppa/trap.c:1.93
--- src/sys/arch/hppa/hppa/trap.c:1.92	Mon May 31 20:19:33 2010
+++ src/sys/arch/hppa/hppa/trap.c	Wed Jul  7 01:18:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.92 2010/05/31 20:19:33 skrll Exp $	*/
+/*	$NetBSD: trap.c,v 1.93 2010/07/07 01:18:39 chs Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.92 2010/05/31 20:19:33 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.93 2010/07/07 01:18:39 chs Exp $");
 
 /* #define INTRDEBUG */
 /* #define TRAPDEBUG */
@@ -917,6 +917,15 @@
 				panic("trap: uvm_fault(%p, %lx, %d): %d",
 				    map, va, vftype, ret);
 			}
+		} else if ((type & T_USER) == 0) {
+			extern char ucas_ras_start[];
+			extern char ucas_ras_end[];
+
+			if (frame->tf_iioq_head > (u_int)ucas_ras_start &&
+			    frame->tf_iioq_head < (u_int)ucas_ras_end) {
+				frame->tf_iioq_head = (u_int)ucas_ras_start;
+				frame->tf_iioq_tail = (u_int)ucas_ras_start + 4;
+			}
 		}
 		break;
 

Reply via email to