summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2001-11-25 17:15:22 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2001-11-25 17:15:22 +0000
commit303f90a786dd71a429859642caf95e25ef1a4888 (patch)
tree6ee22e33e3f293d231d66537a8515d9edbcaee83 /sys
parent7cc59fc55a631022296b3de379370d2cebb5c5d4 (diff)
Harmonize userret() prototypes across m68k arches.
XXX The userret() code is not factorized out yet, as this will require XXX insane amiga cleaning work.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amiga/amiga/trap.c75
-rw-r--r--sys/arch/hp300/hp300/trap.c7
-rw-r--r--sys/arch/m68k/include/cpu.h7
-rw-r--r--sys/arch/m68k/m68k/m68k_machdep.c7
-rw-r--r--sys/arch/mac68k/mac68k/trap.c7
-rw-r--r--sys/arch/mvme68k/mvme68k/trap.c7
-rw-r--r--sys/arch/sun3/sun3/trap.c17
7 files changed, 38 insertions, 89 deletions
diff --git a/sys/arch/amiga/amiga/trap.c b/sys/arch/amiga/amiga/trap.c
index 7aeef6642a0..48dc5d3900c 100644
--- a/sys/arch/amiga/amiga/trap.c
+++ b/sys/arch/amiga/amiga/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.24 2001/11/06 19:53:14 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.25 2001/11/25 17:15:15 miod Exp $ */
/* $NetBSD: trap.c,v 1.56 1997/07/16 00:01:47 is Exp $ */
/*
@@ -181,7 +181,6 @@ extern char fubail[], subail[];
extern void regdump __P((struct trapframe *, int));
int _write_back __P((u_int, u_int, u_int, u_int, vm_map_t));
-void userret __P((struct proc *, int, u_quad_t));
void panictrap __P((int, u_int, u_int, struct frame *));
void trapcpfault __P((struct proc *, struct frame *));
void trapmmufault __P((int, u_int, u_int, struct frame *, struct proc *,
@@ -194,11 +193,14 @@ int db_trap __P((int, db_regs_t *));
void syscall __P((register_t, struct frame));
void _wb_fault __P((void));
+/*ARGSUSED*/
void
-userret(p, pc, oticks)
+userret(p, f, oticks, faultaddr, fromtrap)
struct proc *p;
- int pc;
+ struct frame *fp;
u_quad_t oticks;
+ u_int faultaddr;
+ int fromtrap;
{
int sig;
@@ -221,7 +223,7 @@ userret(p, pc, oticks)
if (p->p_flag & P_PROFIL) {
extern int psratio;
- addupc_task(p, pc, (int)(p->p_sticks - oticks) * psratio);
+ addupc_task(p, fp->f_pc, (int)(p->p_sticks - oticks) * psratio);
}
curpriority = p->p_priority;
}
@@ -405,55 +407,8 @@ trapmmufault(type, code, v, fp, p, sticks)
goto nogo;
}
- /*
- * The 68040 doesn't re-run instructions that cause
- * write page faults (unless due to a move16 isntruction).
- * So once the page is repaired, we have to write the
- * value of WB2D out to memory ourselves. Because
- * the writeback could possibly span two pages in
- * memory, so we need to check both "ends" of the
- * address to see if they are in the same page or not.
- * If not, then we need to make sure the second page
- * is valid, and bring it into memory if it's not.
- *
- * This whole process needs to be repeated for WB3 as well.
- * <sigh>
- */
-
- /* Check WB1 */
- if (fp->f_fmt7.f_wb1s & WBS_VALID) {
- printf ("trap: wb1 was valid, not handled yet\n");
- panictrap(type, code, v, fp);
- }
-
- /*
- * Check WB2
- * skip if it's for a move16 instruction
- */
- if (fp->f_fmt7.f_wb2s & WBS_VALID &&
- ((fp->f_fmt7.f_wb2s & WBS_TTMASK)==WBS_TT_MOVE16) == 0) {
- if (_write_back(2, fp->f_fmt7.f_wb2s,
- fp->f_fmt7.f_wb2d, fp->f_fmt7.f_wb2a, map)
- != KERN_SUCCESS)
- goto nogo;
- if ((fp->f_fmt7.f_wb2s & WBS_TMMASK)
- != (code & SSW_TMMASK))
- panictrap(type, code, v, fp);
- }
-
- /* Check WB3 */
- if(fp->f_fmt7.f_wb3s & WBS_VALID) {
- vm_map_t wb3_map;
-
- if ((fp->f_fmt7.f_wb3s & WBS_TMMASK) == WBS_TM_SDATA)
- wb3_map = kernel_map;
- else
- wb3_map = &vm->vm_map;
- if (_write_back(3, fp->f_fmt7.f_wb3s,
- fp->f_fmt7.f_wb3d, fp->f_fmt7.f_wb3a, wb3_map)
- != KERN_SUCCESS)
- goto nogo;
- }
+ if (writeback(fp, 1) != 0)
+ goto nogo;
}
#ifdef no_386bsd_code
@@ -476,7 +431,7 @@ trapmmufault(type, code, v, fp, p, sticks)
if (rv == KERN_SUCCESS) {
if (type == T_MMUFLT)
return;
- userret(p, fp->f_pc, sticks);
+ userret(p, fp, sticks, 0, 0);
return;
}
#else /* use hacky 386bsd_code */
@@ -488,7 +443,7 @@ trapmmufault(type, code, v, fp, p, sticks)
vm->vm_ssize = nss;
if (type == T_MMUFLT)
return;
- userret(p, fp->f_pc, sticks);
+ userret(p, fp, sticks, 0, 0);
return;
}
nogo:
@@ -506,7 +461,7 @@ nogo:
trapsignal(p, SIGSEGV, vftype, SEGV_MAPERR, sv);
if ((type & T_USER) == 0)
return;
- userret(p, fp->f_pc, sticks);
+ userret(p, fp, sticks, 0, 0);
}
/*
@@ -749,7 +704,7 @@ trap(type, code, v, frame)
p->p_flag &= ~P_OWEUPC;
ADDUPROF(p);
}
- userret(p, frame.f_pc, sticks);
+ userret(p, &frame, sticks, 0, 0);
return;
/*
@@ -780,7 +735,7 @@ trap(type, code, v, frame)
}
if ((type & T_USER) == 0)
return;
- userret(p, frame.f_pc, sticks);
+ userret(p, &frame, sticks, 0, 0);
}
/*
@@ -935,7 +890,7 @@ syscall(code, frame)
if (error == ERESTART && (p->p_md.md_flags & MDP_STACKADJ))
frame.f_regs[SP] -= sizeof (int);
#endif
- userret(p, frame.f_pc, sticks);
+ userret(p, &frame, sticks, 0, 0);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSRET))
ktrsysret(p, code, error, rval[0]);
diff --git a/sys/arch/hp300/hp300/trap.c b/sys/arch/hp300/hp300/trap.c
index b858e3925d8..591973cd303 100644
--- a/sys/arch/hp300/hp300/trap.c
+++ b/sys/arch/hp300/hp300/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.31 2001/11/06 19:53:14 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.32 2001/11/25 17:15:19 miod Exp $ */
/* $NetBSD: trap.c,v 1.57 1998/02/16 20:58:31 thorpej Exp $ */
/*
@@ -119,9 +119,6 @@ void dumpssw __P((u_short));
void dumpwb __P((int, u_short, u_int, u_int));
#endif
-void userret __P((struct proc *p, struct frame *fp,
- u_quad_t oticks, u_int faultaddr, int fromtrap));
-
int astpending;
char *trap_type[] = {
@@ -1162,7 +1159,7 @@ bad:
if (error == ERESTART && (p->p_md.md_flags & MDP_STACKADJ))
frame.f_regs[SP] -= sizeof (int);
#endif
- userret(p, &frame, sticks, (u_int)0, 0);
+ userret(p, &frame, sticks, 0, 0);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSRET))
ktrsysret(p, code, error, rval[0]);
diff --git a/sys/arch/m68k/include/cpu.h b/sys/arch/m68k/include/cpu.h
index 2723dcb9169..5c1f46f081c 100644
--- a/sys/arch/m68k/include/cpu.h
+++ b/sys/arch/m68k/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.6 2001/08/25 11:37:26 espie Exp $ */
+/* $OpenBSD: cpu.h,v 1.7 2001/11/25 17:15:19 miod Exp $ */
/* $NetBSD: cpu.h,v 1.3 1997/02/02 06:56:57 thorpej Exp $ */
/*
@@ -205,6 +205,11 @@ u_long getsfc __P((void));
int fusword __P((caddr_t));
int susword __P((caddr_t, u_short));
+/* m68k_machdep.c */
+struct proc;
+struct frame;
+void userret __P((struct proc *, struct frame *, u_quad_t, u_int, int));
+
/* regdump.c */
struct trapframe;
void regdump __P((struct trapframe *, int));
diff --git a/sys/arch/m68k/m68k/m68k_machdep.c b/sys/arch/m68k/m68k/m68k_machdep.c
index 287d064859f..aac99422534 100644
--- a/sys/arch/m68k/m68k/m68k_machdep.c
+++ b/sys/arch/m68k/m68k/m68k_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m68k_machdep.c,v 1.2 2001/11/06 18:41:09 art Exp $ */
+/* $OpenBSD: m68k_machdep.c,v 1.3 2001/11/25 17:15:19 miod Exp $ */
/* $NetBSD: m68k_machdep.c,v 1.3 1997/06/12 09:57:04 veego Exp $ */
/*-
@@ -48,11 +48,8 @@
/* the following is used externally (sysctl_hw) */
char machine_arch[] = MACHINE_ARCH; /* from <machine/param.h> */
-void userret __P((struct proc *, int, u_quad_t)); /* XXX */
/*
* Process the tail end of a fork() for the child
- *
- * XXX - this is probably the wrong file.
*/
void
child_return(arg)
@@ -65,7 +62,7 @@ child_return(arg)
f->f_sr &= ~PSL_C; /* carry bit */
f->f_format = FMT0;
- userret(p, f->f_pc, p->p_sticks);
+ userret(p, f, p->p_sticks, 0, 0);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSRET))
ktrsysret(p, SYS_fork, 0, 0);
diff --git a/sys/arch/mac68k/mac68k/trap.c b/sys/arch/mac68k/mac68k/trap.c
index cb3edc452f2..f9dc6019bbc 100644
--- a/sys/arch/mac68k/mac68k/trap.c
+++ b/sys/arch/mac68k/mac68k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.30 2001/11/06 19:53:15 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.31 2001/11/25 17:15:20 miod Exp $ */
/* $NetBSD: trap.c,v 1.68 1998/12/22 08:47:07 scottr Exp $ */
/*
@@ -142,9 +142,6 @@ int mmupid = -1;
void trap __P((int, u_int, u_int, struct frame));
void syscall __P((register_t, struct frame));
-void userret __P((struct proc *p, struct frame *fp, u_quad_t oticks,
- u_int faultaddr, int fromtrap));
-
#if defined(M68040)
static int writeback __P((struct frame *, int));
#if DEBUG
@@ -1117,7 +1114,7 @@ syscall(code, frame)
if (error == ERESTART && (p->p_md.md_flags & MDP_STACKADJ))
frame.f_regs[SP] -= sizeof (int);
#endif
- userret(p, &frame, sticks, (u_int)0, 0);
+ userret(p, &frame, sticks, 0, 0);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSRET))
ktrsysret(p, code, error, rval[0]);
diff --git a/sys/arch/mvme68k/mvme68k/trap.c b/sys/arch/mvme68k/mvme68k/trap.c
index c19dc60822d..be45d95f887 100644
--- a/sys/arch/mvme68k/mvme68k/trap.c
+++ b/sys/arch/mvme68k/mvme68k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.37 2001/11/06 19:53:15 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.38 2001/11/25 17:15:20 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -168,9 +168,6 @@ u_char next_sir;
int writeback __P((struct frame *fp, int docachepush));
-void userret __P((struct proc *p, struct frame *fp,
- u_quad_t oticks, u_int faultaddr, int fromtrap));
-
/*
* trap and syscall both need the following work done before returning
* to user mode.
@@ -1096,7 +1093,7 @@ bad:
if (error == ERESTART && (p->p_md.md_flags & MDP_STACKADJ))
frame.f_regs[SP] -= sizeof (int);
#endif
- userret(p, &frame, sticks, (u_int)0, 0);
+ userret(p, &frame, sticks, 0, 0);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSRET))
ktrsysret(p, code, error, rval[0]);
diff --git a/sys/arch/sun3/sun3/trap.c b/sys/arch/sun3/sun3/trap.c
index bf4f4c39965..5b627ab8183 100644
--- a/sys/arch/sun3/sun3/trap.c
+++ b/sys/arch/sun3/sun3/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.28 2001/11/06 19:53:16 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.29 2001/11/25 17:15:21 miod Exp $ */
/* $NetBSD: trap.c,v 1.63-1.65ish 1997/01/16 15:41:40 gwr Exp $ */
/*
@@ -86,8 +86,6 @@ int nodb_trap __P((int type, struct frame *));
int astpending;
int want_resched;
-void userret __P((struct proc *, struct frame *, u_quad_t));
-
char *trap_type[] = {
"Bus error",
"Address error",
@@ -147,11 +145,14 @@ int mmupid = -1;
* trap and syscall both need the following work done before
* returning to user mode.
*/
+/*ARGSUSED*/
void
-userret(p, fp, oticks)
- register struct proc *p;
- register struct frame *fp;
+userret(p, fp, oticks, faultaddr, fromtrap)
+ struct proc *p;
+ struct frame *fp;
u_quad_t oticks;
+ u_int faultaddr;
+ int fromtrap;
{
int sig;
@@ -590,7 +591,7 @@ finish:
trapsignal(p, sig, ucode, si_type, sv);
}
douret:
- userret(p, &frame, sticks);
+ userret(p, &frame, sticks, 0, 0);
}
/*
@@ -740,7 +741,7 @@ syscall(code, frame)
frame.f_regs[SP] -= sizeof (int);
}
#endif
- userret(p, &frame, sticks);
+ userret(p, &frame, sticks, 0, 0);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSRET))
ktrsysret(p, code, error, rval[0]);