Module Name: src
Committed By: matt
Date: Wed Dec 29 00:47:51 UTC 2010
Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: syscall.c trap.c
Log Message:
Move away from StudlyCaps.
Change opc to pc since opc might be confused with opcode.
To generate a diff of this commit:
cvs rdiff -u -r1.37.12.12 -r1.37.12.13 src/sys/arch/mips/mips/syscall.c
cvs rdiff -u -r1.217.12.31 -r1.217.12.32 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/syscall.c
diff -u src/sys/arch/mips/mips/syscall.c:1.37.12.12 src/sys/arch/mips/mips/syscall.c:1.37.12.13
--- src/sys/arch/mips/mips/syscall.c:1.37.12.12 Mon Feb 22 20:17:09 2010
+++ src/sys/arch/mips/mips/syscall.c Wed Dec 29 00:47:50 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: syscall.c,v 1.37.12.12 2010/02/22 20:17:09 matt Exp $ */
+/* $NetBSD: syscall.c,v 1.37.12.13 2010/12/29 00:47:50 matt Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -107,7 +107,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.37.12.12 2010/02/22 20:17:09 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.37.12.13 2010/12/29 00:47:50 matt Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sa.h"
@@ -144,8 +144,6 @@
void EMULNAME(syscall_intern)(struct proc *);
static void EMULNAME(syscall)(struct lwp *, uint32_t, uint32_t, vaddr_t);
-register_t MachEmulateBranch(struct trapframe *, register_t, u_int, int);
-
void
EMULNAME(syscall_intern)(struct proc *p)
{
@@ -162,7 +160,7 @@
*/
void
-EMULNAME(syscall)(struct lwp *l, u_int status, u_int cause, vaddr_t opc)
+EMULNAME(syscall)(struct lwp *l, u_int status, u_int cause, vaddr_t pc)
{
struct proc *p = l->l_proc;
struct trapframe *tf = l->l_md.md_utf;
@@ -190,9 +188,9 @@
curcpu()->ci_data.cpu_nsyscall++;
if (cause & MIPS_CR_BR_DELAY)
- reg->r_regs[_R_PC] = MachEmulateBranch(tf, opc, 0, 0);
+ reg->r_regs[_R_PC] = mips_emul_branch(tf, pc, 0, false);
else
- reg->r_regs[_R_PC] = opc + sizeof(uint32_t);
+ reg->r_regs[_R_PC] = pc + sizeof(uint32_t);
callp = p->p_emul->e_sysent;
saved_v0 = code = reg->r_regs[_R_V0];
@@ -400,7 +398,7 @@
break;
case ERESTART:
reg->r_regs[_R_V0] = saved_v0; /* restore syscall code */
- reg->r_regs[_R_PC] = opc;
+ reg->r_regs[_R_PC] = pc;
break;
case EJUSTRETURN:
break; /* nothing to do */
Index: src/sys/arch/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.217.12.31 src/sys/arch/mips/mips/trap.c:1.217.12.32
--- src/sys/arch/mips/mips/trap.c:1.217.12.31 Wed Dec 22 06:06:19 2010
+++ src/sys/arch/mips/mips/trap.c Wed Dec 29 00:47:50 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.217.12.31 2010/12/22 06:06:19 matt Exp $ */
+/* $NetBSD: trap.c,v 1.217.12.32 2010/12/29 00:47:50 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.31 2010/12/22 06:06:19 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.217.12.32 2010/12/29 00:47:50 matt Exp $");
#include "opt_cputype.h" /* which mips CPU levels do we support? */
#include "opt_ddb.h"
@@ -158,13 +158,9 @@
"r4000 virtual coherency data",
};
-void trap(unsigned int, unsigned int, vaddr_t, vaddr_t, struct trapframe *);
+void trap(uint32_t, uint32_t, vaddr_t, vaddr_t, struct trapframe *);
void ast(void);
-vaddr_t MachEmulateBranch(struct trapframe *, vaddr_t, unsigned int, int); /* XXX */
-void MachEmulateInst(uint32_t, uint32_t, vaddr_t, struct trapframe *); /* XXX */
-void MachFPTrap(uint32_t, uint32_t, vaddr_t, struct trapframe *); /* XXX */
-
/*
* fork syscall returns directly to user process via lwp_trampoline(),
* which will be called the very first time when child gets running.
@@ -195,7 +191,7 @@
* interrupts as a part of real interrupt processing.
*/
void
-trap(unsigned int status, unsigned int cause, vaddr_t vaddr, vaddr_t opc,
+trap(uint32_t status, uint32_t cause, vaddr_t vaddr, vaddr_t pc,
struct trapframe *tf)
{
int type;
@@ -226,7 +222,7 @@
trap_type[TRAPTYPE(cause)],
USERMODE(status) ? "user" : "kernel");
printf("status=0x%x, cause=0x%x, epc=%#" PRIxVADDR
- ", vaddr=%#" PRIxVADDR, status, cause, opc, vaddr);
+ ", vaddr=%#" PRIxVADDR, status, cause, pc, vaddr);
if (USERMODE(status)) {
KASSERT(tf == utf);
printf(" frame=%p usp=%#" PRIxREGISTER
@@ -410,7 +406,7 @@
register_t tlb_hi;
pt_entry_t *pte = pfi->pfi_faultpte;
__asm("dmfc0 %0,$%1" : "=r"(tlb_hi) : "n"(MIPS_COP_0_TLB_HI));
- printf("trap: fault #%u (%s/%s) for %#"PRIxVADDR" (%#"PRIxVADDR") at pc %#"PRIxVADDR" curpid=%u/%u p...@%p=%#x)\n", pfi->pfi_repeats, trap_type[TRAPTYPE(cause)], trap_type[pfi->pfi_faulttype], va, vaddr, opc, map->pmap->pm_pai[0].pai_asid, (uint8_t)tlb_hi, pte, pte ? pte->pt_entry : 0);
+ printf("trap: fault #%u (%s/%s) for %#"PRIxVADDR" (%#"PRIxVADDR") at pc %#"PRIxVADDR" curpid=%u/%u p...@%p=%#x)\n", pfi->pfi_repeats, trap_type[TRAPTYPE(cause)], trap_type[pfi->pfi_faulttype], va, vaddr, pc, map->pmap->pm_pai[0].pai_asid, (uint8_t)tlb_hi, pte, pte ? pte->pt_entry : 0);
if (pfi->pfi_repeats >= 4) {
cpu_Debugger();
} else {
@@ -440,7 +436,7 @@
printf(
"uvm_fault(%p (pmap %p), %#"PRIxVADDR
" (%"PRIxVADDR"), %d) -> %d at pc %#"PRIxVADDR"\n",
- map, vm->vm_map.pmap, va, vaddr, ftype, rv, opc);
+ map, vm->vm_map.pmap, va, vaddr, ftype, rv, pc);
#endif
/*
* If this was a stack access we keep track of the maximum
@@ -567,7 +563,7 @@
int rv;
/* compute address of break instruction */
- va = (cause & MIPS_CR_BR_DELAY) ? opc + sizeof(int) : opc;
+ va = (cause & MIPS_CR_BR_DELAY) ? pc + sizeof(int) : pc;
/* read break instruction */
instr = fuiword((void *)va);
@@ -618,15 +614,15 @@
} else
#endif
{
- MachEmulateInst(status, cause, opc, utf);
+ mips_emul_inst(status, cause, pc, utf);
}
userret(l);
return; /* GEN */
case T_FPE+T_USER:
#if defined(FPEMUL)
- MachEmulateInst(status, cause, opc, utf);
+ mips_emul_inst(status, cause, pc, utf);
#elif !defined(NOFPU)
- MachFPTrap(status, cause, opc, utf);
+ mips_fpu_trap(pc, utf);
#endif
userret(l);
return; /* GEN */
@@ -634,7 +630,7 @@
case T_TRAP+T_USER:
ksi.ksi_trap = type & ~T_USER;
ksi.ksi_signo = SIGFPE;
- ksi.ksi_addr = (void *)(intptr_t)opc /*utf->tf_regs[_R_PC]*/;
+ ksi.ksi_addr = (void *)(intptr_t)pc /*utf->tf_regs[_R_PC]*/;
ksi.ksi_code = FPE_FLTOVF; /* XXX */
break; /* SIGNAL */
}
@@ -714,6 +710,7 @@
{
struct trapframe * const tf = l->l_md.md_utf;
struct proc * const p = l->l_proc;
+ struct pcb * const pcb = &l->l_addr->u_pcb;
vaddr_t pc, va;
int rv;
@@ -724,7 +721,7 @@
}
pc = (vaddr_t)tf->tf_regs[_R_PC];
if (ufetch_uint32((void *)pc) != 0) /* not a NOP instruction */
- va = MachEmulateBranch(tf, pc, PCB_FSR(&l->l_addr->u_pcb), 1);
+ va = mips_emul_branch(tf, pc, PCB_FSR(pcb), true);
else
va = pc + sizeof(int);