Module Name: src
Committed By: matt
Date: Sat Nov 14 21:52:08 UTC 2009
Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: db_disasm.c mips_emul.c
trap.c
Log Message:
Switch from fu*/su* to ufetch_*/ustore_*. This make netbsd32 compat root
on a LP64 BE kernel.
To generate a diff of this commit:
cvs rdiff -u -r1.19.62.1 -r1.19.62.2 src/sys/arch/mips/mips/db_disasm.c
cvs rdiff -u -r1.14.78.4 -r1.14.78.5 src/sys/arch/mips/mips/mips_emul.c
cvs rdiff -u -r1.217.12.10 -r1.217.12.11 src/sys/arch/mips/mips/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/mips/mips/db_disasm.c
diff -u src/sys/arch/mips/mips/db_disasm.c:1.19.62.1 src/sys/arch/mips/mips/db_disasm.c:1.19.62.2
--- src/sys/arch/mips/mips/db_disasm.c:1.19.62.1 Sun Aug 23 06:38:07 2009
+++ src/sys/arch/mips/mips/db_disasm.c Sat Nov 14 21:52:08 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: db_disasm.c,v 1.19.62.1 2009/08/23 06:38:07 matt Exp $ */
+/* $NetBSD: db_disasm.c,v 1.19.62.2 2009/11/14 21:52:08 matt Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.19.62.1 2009/08/23 06:38:07 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.19.62.2 2009/11/14 21:52:08 matt Exp $");
#include <sys/types.h>
#include <sys/systm.h>
@@ -164,7 +164,7 @@
* loses the current debugging context. KSEG2 not checked.
*/
if (loc < MIPS_KSEG0_START) {
- instr = fuword((void *)loc);
+ instr = ufetch_uint32((void *)loc);
if (instr == 0xffffffff) {
/* "sd ra, -1(ra)" is unlikely */
db_printf("invalid address.\n");
Index: src/sys/arch/mips/mips/mips_emul.c
diff -u src/sys/arch/mips/mips/mips_emul.c:1.14.78.4 src/sys/arch/mips/mips/mips_emul.c:1.14.78.5
--- src/sys/arch/mips/mips/mips_emul.c:1.14.78.4 Mon Aug 24 12:08:01 2009
+++ src/sys/arch/mips/mips/mips_emul.c Sat Nov 14 21:52:08 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: mips_emul.c,v 1.14.78.4 2009/08/24 12:08:01 uebayasi Exp $ */
+/* $NetBSD: mips_emul.c,v 1.14.78.5 2009/11/14 21:52:08 matt Exp $ */
/*
* Copyright (c) 1999 Shuichiro URATA. All rights reserved.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mips_emul.c,v 1.14.78.4 2009/08/24 12:08:01 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_emul.c,v 1.14.78.5 2009/11/14 21:52:08 matt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -224,9 +224,9 @@
* Fetch the instruction.
*/
if (cause & MIPS_CR_BR_DELAY)
- inst = fuword((uint32_t *)opc+1);
+ inst = ufetch_uint32((uint32_t *)opc+1);
else
- inst = fuword((uint32_t *)opc);
+ inst = ufetch_uint32((uint32_t *)opc);
switch (((InstFmt)inst).FRType.op) {
case OP_LWC0:
@@ -256,6 +256,9 @@
break;
#endif
default:
+#ifdef DEBUG
+ printf("pid %d(%s): trap: bad vaddr %#"PRIxVADDR" cause %#x insn %#x\n", curproc->p_pid, curproc->p_comm, opc, cause, inst);
+#endif
frame->f_regs[_R_CAUSE] = cause;
frame->f_regs[_R_BADVADDR] = opc;
KSI_INIT_TRAP(&ksi);
@@ -937,7 +940,7 @@
return;
}
- if (suword((void *)vaddr, frame->f_regs[(inst>>16)&0x1F]) < 0) {
+ if (ustore_uint32((void *)vaddr, frame->f_regs[(inst>>16)&0x1F]) < 0) {
send_sigsegv(vaddr, T_TLB_ST_MISS, frame, cause);
return;
}
@@ -973,7 +976,7 @@
a &= ~(0xFFFFFFFFUL >> shift);
a |= x;
- if (suword((void *)vaddr, a) < 0) {
+ if (ustore_uint32((void *)vaddr, a) < 0) {
send_sigsegv(vaddr, T_TLB_ST_MISS, frame, cause);
return;
}
@@ -1009,7 +1012,7 @@
a &= ~(0xFFFFFFFFUL << shift);
a |= x;
- if (suword((void *)vaddr, a) < 0) {
+ if (ustore_uint32((void *)vaddr, a) < 0) {
send_sigsegv(vaddr, T_TLB_ST_MISS, frame, cause);
return;
}
Index: src/sys/arch/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.217.12.10 src/sys/arch/mips/mips/trap.c:1.217.12.11
--- src/sys/arch/mips/mips/trap.c:1.217.12.10 Mon Nov 9 10:02:30 2009
+++ src/sys/arch/mips/mips/trap.c Sat Nov 14 21:52:08 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.217.12.10 2009/11/09 10:02:30 cliff Exp $ */
+/* $NetBSD: trap.c,v 1.217.12.11 2009/11/14 21:52:08 matt Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -78,7 +78,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.217.12.10 2009/11/09 10:02:30 cliff Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.217.12.11 2009/11/14 21:52:08 matt Exp $");
#include "opt_cputype.h" /* which mips CPU levels do we support? */
#include "opt_ddb.h"
@@ -508,7 +508,7 @@
/*
* Restore original instruction and clear BP
*/
- rv = suiword((void *)va, l->l_md.md_ss_instr);
+ rv = ustore_uint32_isync((void *)va, l->l_md.md_ss_instr);
if (rv < 0) {
vaddr_t sa, ea;
sa = trunc_page(va);
@@ -516,7 +516,7 @@
rv = uvm_map_protect(&p->p_vmspace->vm_map,
sa, ea, VM_PROT_ALL, false);
if (rv == 0) {
- rv = suiword((void *)va, l->l_md.md_ss_instr);
+ rv = ustore_uint32_isync((void *)va, l->l_md.md_ss_instr);
(void)uvm_map_protect(&p->p_vmspace->vm_map,
sa, ea, VM_PROT_READ|VM_PROT_EXECUTE, false);
}
@@ -661,7 +661,7 @@
l->l_md.md_ss_addr = va;
l->l_md.md_ss_instr = fuiword((void *)va);
- rv = suiword((void *)va, MIPS_BREAK_SSTEP);
+ rv = ustore_uint32_isync((void *)va, MIPS_BREAK_SSTEP);
if (rv < 0) {
vaddr_t sa, ea;
sa = trunc_page(va);
@@ -669,7 +669,7 @@
rv = uvm_map_protect(&p->p_vmspace->vm_map,
sa, ea, VM_PROT_ALL, false);
if (rv == 0) {
- rv = suiword((void *)va, MIPS_BREAK_SSTEP);
+ rv = ustore_uint32_isync((void *)va, MIPS_BREAK_SSTEP);
(void)uvm_map_protect(&p->p_vmspace->vm_map,
sa, ea, VM_PROT_READ|VM_PROT_EXECUTE, false);
}
@@ -677,7 +677,7 @@
#if 0
printf("SS %s (%d): breakpoint set at %x: %x (pc %x) br %x\n",
p->p_comm, p->p_pid, p->p_md.md_ss_addr,
- p->p_md.md_ss_instr, pc, fuword((void *)va)); /* XXX */
+ p->p_md.md_ss_instr, pc, ufetch_uint32((void *)va)); /* XXX */
#endif
return 0;
}