summaryrefslogtreecommitdiff
path: root/sys/arch/mvme68k/mvme68k/trap.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/mvme68k/mvme68k/trap.c')
-rw-r--r--sys/arch/mvme68k/mvme68k/trap.c89
1 files changed, 58 insertions, 31 deletions
diff --git a/sys/arch/mvme68k/mvme68k/trap.c b/sys/arch/mvme68k/mvme68k/trap.c
index 3525bdae77c..ea4d2889da2 100644
--- a/sys/arch/mvme68k/mvme68k/trap.c
+++ b/sys/arch/mvme68k/mvme68k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.47 2002/12/09 00:45:37 millert Exp $ */
+/* $OpenBSD: trap.c,v 1.48 2003/01/09 22:27:09 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -264,7 +264,6 @@ trap(type, code, v, frame)
register u_int v;
struct frame frame;
{
- extern char fubail[], subail[];
register struct proc *p;
register int i;
u_int ucode;
@@ -536,15 +535,6 @@ copyfault:
goto out;
case T_MMUFLT: /* kernel mode page fault */
- /*
- * If we were doing profiling ticks or other user mode
- * stuff from interrupt code, Just Say No.
- */
- if (p && (p->p_addr->u_pcb.pcb_onfault == fubail ||
- p->p_addr->u_pcb.pcb_onfault == subail))
- goto copyfault;
- /* FALLTHROUGH */
-
case T_MMUFLT|T_USER: /* page fault */
{
vm_offset_t va;
@@ -786,7 +776,8 @@ writeback(fp, docachepush)
if (KDFAULT(f->f_wb1s))
*(long *)f->f_wb1a = wb1d;
else
- err = suword((caddr_t)f->f_wb1a, wb1d);
+ err = copyout(&wb1d,
+ (caddr_t)f->f_wb1a, sizeof(int));
break;
case SSW4_SZB:
off = 24 - off;
@@ -794,8 +785,12 @@ writeback(fp, docachepush)
wb1d >>= off;
if (KDFAULT(f->f_wb1s))
*(char *)f->f_wb1a = wb1d;
- else
- err = subyte((caddr_t)f->f_wb1a, wb1d);
+ else {
+ char tmp = wb1d;
+
+ err = copyout(&tmp,
+ (caddr_t)f->f_wb1a, sizeof(char));
+ }
break;
case SSW4_SZW:
off = (off + 16) % 32;
@@ -803,8 +798,12 @@ writeback(fp, docachepush)
wb1d = (wb1d >> (32 - off)) | (wb1d << off);
if (KDFAULT(f->f_wb1s))
*(short *)f->f_wb1a = wb1d;
- else
- err = susword((caddr_t)f->f_wb1a, wb1d);
+ else {
+ short tmp = wb1d;
+
+ err = copyout(&tmp,
+ (caddr_t)f->f_wb1a, sizeof(long));
+ }
break;
}
if (err) {
@@ -836,19 +835,28 @@ writeback(fp, docachepush)
if (KDFAULT(f->f_wb2s))
*(long *)f->f_wb2a = f->f_wb2d;
else
- err = suword((caddr_t)f->f_wb2a, f->f_wb2d);
+ err = copyout(&f->f_wb2d,
+ (caddr_t)f->f_wb2a, sizeof(int));
break;
case SSW4_SZB:
if (KDFAULT(f->f_wb2s))
*(char *)f->f_wb2a = f->f_wb2d;
- else
- err = subyte((caddr_t)f->f_wb2a, f->f_wb2d);
+ else {
+ char tmp = f->f_wb2d;
+
+ err = copyout(&tmp,
+ (caddr_t)f->f_wb2a, sizeof(char));
+ }
break;
case SSW4_SZW:
if (KDFAULT(f->f_wb2s))
*(short *)f->f_wb2a = f->f_wb2d;
- else
- err = susword((caddr_t)f->f_wb2a, f->f_wb2d);
+ else {
+ short tmp = f->f_wb2d;
+
+ err = copyout(&tmp,
+ (caddr_t)f->f_wb2a, sizeof(short));
+ }
break;
}
if (err) {
@@ -876,19 +884,28 @@ writeback(fp, docachepush)
if (KDFAULT(f->f_wb3s))
*(long *)f->f_wb3a = f->f_wb3d;
else
- err = suword((caddr_t)f->f_wb3a, f->f_wb3d);
+ err = copyout(&f->f_wb3d,
+ (caddr_t)f->f_wb3a, sizeof(int));
break;
case SSW4_SZB:
if (KDFAULT(f->f_wb3s))
*(char *)f->f_wb3a = f->f_wb3d;
- else
- err = subyte((caddr_t)f->f_wb3a, f->f_wb3d);
+ else {
+ char tmp = f->f_wb3d;
+
+ err = copyout(&tmp,
+ (caddr_t)f->f_wb3a, sizeof(char));
+ }
break;
case SSW4_SZW:
if (KDFAULT(f->f_wb3s))
*(short *)f->f_wb3a = f->f_wb3d;
- else
- err = susword((caddr_t)f->f_wb3a, f->f_wb3d);
+ else {
+ short tmp = f->f_wb3d;
+
+ err = copyout(&tmp,
+ (caddr_t)f->f_wb3a, sizeof(short));
+ }
break;
#ifdef DEBUG
case SSW4_SZLN:
@@ -950,6 +967,7 @@ dumpwb(num, s, a, d)
{
register struct proc *p = curproc;
vm_offset_t pa;
+ int tmp;
printf(" writeback #%d: VA %x, data %x, SZ=%s, TT=%s, TM=%s\n",
num, a, d, f7sz[(s & SSW4_SZMASK) >> 5],
@@ -957,8 +975,12 @@ dumpwb(num, s, a, d)
printf(" PA ");
if (pmap_extract(p->p_vmspace->vm_map.pmap, (vm_offset_t)a, &pa) == FALSE)
printf("<invalid address>");
- else
- printf("%x, current value %x", pa, fuword((caddr_t)a));
+ else {
+ if (copyin((caddr_t)a, &tmp, sizeof(int)) == 0)
+ printf("%lx, current value %lx", pa, tmp);
+ else
+ printf("%lx, current value inaccessible", pa);
+ }
printf("\n");
}
#endif
@@ -1003,7 +1025,9 @@ syscall(code, frame)
* code assumes the kernel pops the syscall argument the
* glue pushed on the stack. Sigh...
*/
- code = fuword((caddr_t)frame.f_regs[SP]);
+ if (copyin((caddr_t)frame.f_regs[SP], &code,
+ sizeof(register_t)) != 0)
+ code = -1;
/*
* XXX
@@ -1031,7 +1055,8 @@ syscall(code, frame)
/*
* Code is first argument, followed by actual args.
*/
- code = fuword(params);
+ if (copyin(params, &code, sizeof(register_t)) != 0)
+ code = -1;
params += sizeof(int);
/*
* XXX sigreturn requires special stack manipulation
@@ -1048,7 +1073,9 @@ syscall(code, frame)
*/
if (callp != sysent)
break;
- code = fuword(params + _QUAD_LOWWORD * sizeof(int));
+ if (copyin(params + _QUAD_LOWWORD * sizeof(int), &code,
+ sizeof(register_t)) != 0)
+ code = -1;
params += sizeof(quad_t);
break;
default: