Module Name:    src
Committed By:   skrll
Date:           Fri May  8 10:12:55 UTC 2009

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

Log Message:
Provide ucas for hppa.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/hp700/hp700/intr.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hppa/hppa/copy.S

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.17 src/sys/arch/hp700/hp700/intr.c:1.18
--- src/sys/arch/hp700/hp700/intr.c:1.17	Fri May  8 09:33:58 2009
+++ src/sys/arch/hp700/hp700/intr.c	Fri May  8 10:12:55 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.17 2009/05/08 09:33:58 skrll Exp $	*/
+/*	$NetBSD: intr.c,v 1.18 2009/05/08 10:12:55 skrll Exp $	*/
 
 /*
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.17 2009/05/08 09:33:58 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.18 2009/05/08 10:12:55 skrll Exp $");
 
 #define __MUTEX_PRIVATE
 
@@ -378,6 +378,9 @@
 	struct hp700_int_reg *int_reg;
 	int hp700_intr_ipending_new(struct hp700_int_reg *, int);
 
+	extern char ucas_ras_start[];
+	extern char ucas_ras_end[];
+
 #ifndef LOCKDEBUG
 	extern char mutex_enter_crit_start[];
 	extern char mutex_enter_crit_end[];
@@ -405,6 +408,13 @@
 		((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

Index: src/sys/arch/hppa/hppa/copy.S
diff -u src/sys/arch/hppa/hppa/copy.S:1.9 src/sys/arch/hppa/hppa/copy.S:1.10
--- src/sys/arch/hppa/hppa/copy.S:1.9	Thu Apr 30 07:01:27 2009
+++ src/sys/arch/hppa/hppa/copy.S	Fri May  8 10:12:55 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: copy.S,v 1.9 2009/04/30 07:01:27 skrll Exp $	*/
+/*	$NetBSD: copy.S,v 1.10 2009/05/08 10:12:55 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -345,3 +345,45 @@
 	b	hppa_ktext_stw
 	copy	%t2, %arg1
 EXIT(hppa_ktext_stb)
+
+STRONG_ALIAS(ucas_int,ucas_32)
+STRONG_ALIAS(ucas_ptr,ucas_32)
+
+	.global ucas_ras_start
+	.global ucas_ras_end
+
+/*
+ * Compare-and-swap the pointer in the user-space.
+ *
+ * int	ucasword(volatile void *uptr, void *old, void *new, void *ret);
+ */
+LEAF_ENTRY(ucas_32)
+	ldil	L%VM_MAXUSER_ADDRESS, %t1
+	comb,>>= %arg0, %t1, 1f
+
+	/* setup fault handler */
+	mfctl	CR_CURLWP, %r31
+	ldw	L_ADDR(%r31), %r31
+	ldil	L%_copy_on_fault, %t2
+	ldo	R%_copy_on_fault(%t2), %t2
+	stw	%t2, PCB_ONFAULT+U_PCB(%r31)
+
+	ldw	U_PCB+PCB_SPACE(%r31), %t1
+	mtsp	%t1, %sr1
+
+ucas_ras_start:
+	ldw	0(%sr1, %arg0), %t1
+	comb,<>	%arg1, %t1, 2f
+	 copy	%t1,%ret0
+ucas_ras_end:
+	stw	%arg2, 0(%sr1, %arg0)
+	copy	%arg1, %ret0
+2:
+	stw	%ret0,	0(%sr1, %arg3)
+	bv	0(%rp)
+	 copy	%r0, %ret0
+
+1:
+	bv	0(%rp)
+	 ldi	-1, %ret0
+EXIT(ucas_32)

Reply via email to