Module Name:    src
Committed By:   matt
Date:           Fri May 14 22:26:00 UTC 2010

Modified Files:
        src/sys/arch/mips/mips [matt-nb5-mips64]: locore_mips3.S
        src/sys/arch/mips/sibyte/pci [matt-nb5-mips64]: sbbrz_pci.c

Log Message:
Make badaddr64 work on O32.  Add a few syncs to force errors.


To generate a diff of this commit:
cvs rdiff -u -r1.93.38.8 -r1.93.38.9 src/sys/arch/mips/mips/locore_mips3.S
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/arch/mips/sibyte/pci/sbbrz_pci.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/mips/mips/locore_mips3.S
diff -u src/sys/arch/mips/mips/locore_mips3.S:1.93.38.8 src/sys/arch/mips/mips/locore_mips3.S:1.93.38.9
--- src/sys/arch/mips/mips/locore_mips3.S:1.93.38.8	Mon Mar  1 19:29:41 2010
+++ src/sys/arch/mips/mips/locore_mips3.S	Fri May 14 22:26:00 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore_mips3.S,v 1.93.38.8 2010/03/01 19:29:41 matt Exp $	*/
+/*	$NetBSD: locore_mips3.S,v 1.93.38.9 2010/05/14 22:26:00 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Jonathan Stone (hereinafter referred to as the author)
@@ -442,7 +442,6 @@
  * See if access to addr with a len type instruction causes a machine check.
  * len is length of access in bytes (can be 1, 2, 4, or 8).
  */
-#if !defined(__mips_o32)
 LEAF(badaddr64)
 	PTR_L	v1, L_ADDR(MIPS_CURLWP)
 	PTR_LA	v0, _C_LABEL(baderr64)
@@ -450,9 +449,27 @@
 	/* Enable KX */
 	mfc0	t0, MIPS_COP_0_STATUS
 	or	t1, t0, MIPS3_SR_KX
+#ifdef __mips_o32
+	and	t2, t0, MIPS_SR_INT_IE	# disable interrupts
+	xor	t1, t2
+#endif
 	mtc0	t1, MIPS_COP_0_STATUS
 	COP0_SYNC
 
+#ifdef __mips_o32
+#ifdef __MIPSEB__
+	dsll	a0, a0, 32	# MSW
+	dsll	a1, a1, 32	# LSW
+	dsrl	a1, a1, 32
+#else
+	dsll	a1, a1, 32	# MSW
+	dsll	a0, a0, 32	# LSW
+	dsrl	a0, a0, 32
+#endif
+	or	a0, a1		# combine
+	move	a1, a2		# move up length argument
+#endif /* __mips_o32 */
+
 	bne	a1, 1, 2f
 	PTR_S	v0, U_PCB_ONFAULT(v1)
 	b	9f
@@ -470,8 +487,11 @@
 8:
 	REG_L	v0, (a0)
 9:
+	sync
 	mtc0	t0, MIPS_COP_0_STATUS           # Restore KX
 	COP0_SYNC
+	nop
+	nop
 	PTR_S	zero, U_PCB_ONFAULT(v1)
 	j	ra
 	move	v0, zero			# made it w/o errors
@@ -484,7 +504,6 @@
 	j	ra
 	li	v0, -1
 END(baderr64)
-#endif
 
 /*
  * uint64_t mips3_cp0_tlb_entry_hi_probe(void);

Index: src/sys/arch/mips/sibyte/pci/sbbrz_pci.c
diff -u src/sys/arch/mips/sibyte/pci/sbbrz_pci.c:1.1.2.5 src/sys/arch/mips/sibyte/pci/sbbrz_pci.c:1.1.2.6
--- src/sys/arch/mips/sibyte/pci/sbbrz_pci.c:1.1.2.5	Thu Jan 21 08:47:22 2010
+++ src/sys/arch/mips/sibyte/pci/sbbrz_pci.c	Fri May 14 22:26:00 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: sbbrz_pci.c,v 1.1.2.5 2010/01/21 08:47:22 cyber Exp $ */
+/* $NetBSD: sbbrz_pci.c,v 1.1.2.6 2010/05/14 22:26:00 matt Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -64,7 +64,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: sbbrz_pci.c,v 1.1.2.5 2010/01/21 08:47:22 cyber Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbbrz_pci.c,v 1.1.2.6 2010/05/14 22:26:00 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -184,12 +184,14 @@
 	addr = A_PHYS_LDTPCI_CFG_MATCH_BITS + tag + offset;
 	addr = MIPS_PHYS_TO_XKPHYS(MIPS3_TLB_ATTR_UNCACHED, addr);
 
-#ifdef _punt_on_64
 	if (badaddr64(addr, 4) != 0)
 		return 0xffffffff;
-#endif
 
-	return mips3_lw_a64(addr);
+	pcireg_t rv = mips3_lw_a64(addr);
+#ifdef __mips_o32
+	__asm volatile("sync");
+#endif
+	return rv;
 }
 
 void

Reply via email to