summaryrefslogtreecommitdiff
path: root/sys/arch/mac68k
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2005-08-01 11:54:26 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2005-08-01 11:54:26 +0000
commitc0b929a7d733ebd19869cc7bce698dc1ded92d13 (patch)
treea2dae6bafe51fbb906792f57adf3a62438cf49ba /sys/arch/mac68k
parenta5cf009c5477467bd0e5f178fd37ac50ddeea367 (diff)
Factorize cachectl() accross m68k platforms, and make the CC_ constants
public.
Diffstat (limited to 'sys/arch/mac68k')
-rw-r--r--sys/arch/mac68k/include/cpu.h5
-rw-r--r--sys/arch/mac68k/mac68k/sys_machdep.c124
2 files changed, 2 insertions, 127 deletions
diff --git a/sys/arch/mac68k/include/cpu.h b/sys/arch/mac68k/include/cpu.h
index c4abd9ff8df..cf1b4d4d85c 100644
--- a/sys/arch/mac68k/include/cpu.h
+++ b/sys/arch/mac68k/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.33 2005/07/31 15:39:56 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.34 2005/08/01 11:54:24 miod Exp $ */
/* $NetBSD: cpu.h,v 1.45 1997/02/10 22:13:40 scottr Exp $ */
/*
@@ -323,9 +323,6 @@ void savectx(struct pcb *);
void proc_trampoline(void);
void loadustp(int);
-/* sys_machdep.c */
-int cachectl(struct proc *, int, vaddr_t, int);
-
/* vm_machdep.c */
void physaccess(caddr_t, caddr_t, register int, register int);
void physunaccess(caddr_t, register int);
diff --git a/sys/arch/mac68k/mac68k/sys_machdep.c b/sys/arch/mac68k/mac68k/sys_machdep.c
index ca8c802c3c5..77db7b5750e 100644
--- a/sys/arch/mac68k/mac68k/sys_machdep.c
+++ b/sys/arch/mac68k/mac68k/sys_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_machdep.c,v 1.9 2004/05/20 09:20:42 kettenis Exp $ */
+/* $OpenBSD: sys_machdep.c,v 1.10 2005/08/01 11:54:24 miod Exp $ */
/* $NetBSD: sys_machdep.c,v 1.9 1996/05/05 06:18:58 briggs Exp $ */
/*
@@ -79,130 +79,8 @@
#include <sys/buf.h>
#include <sys/mount.h>
-#include <uvm/uvm_extern.h>
-
#include <sys/syscallargs.h>
-#include <machine/cpu.h>
-
-/* XXX should be in an include file somewhere */
-#define CC_PURGE 1
-#define CC_FLUSH 2
-#define CC_IPURGE 4
-#define CC_EXTPURGE 0x80000000
-/* XXX end should be */
-
-/*ARGSUSED1*/
-int
-cachectl(p, req, addr, len)
- struct proc *p;
- int req;
- vaddr_t addr;
- int len;
-{
- int error = 0;
-
-#if defined(M68040)
- if (mmutype == MMU_68040) {
- int inc = 0;
- int doall = 0;
- paddr_t pa = 0;
- vaddr_t end = 0;
-
- if (addr == 0 ||
- ((req & ~CC_EXTPURGE) != CC_PURGE && len > 2*NBPG))
- doall = 1;
-
- if (!doall) {
- end = addr + len;
- if (len <= 1024) {
- addr = addr & ~0xF;
- inc = 16;
- } else {
- addr = addr & ~PGOFSET;
- inc = NBPG;
- }
- }
- do {
- /*
- * Convert to physical address if needed.
- * If translation fails, we perform operation on
- * entire cache (XXX is this a rational thing to do?)
- */
- if (!doall &&
- (pa == 0 || ((int)addr & PGOFSET) == 0)) {
- if (pmap_extract(
- p->p_vmspace->vm_map.pmap,
- addr, &pa) == FALSE)
- doall = 1;
- }
- switch (req) {
- case CC_EXTPURGE|CC_IPURGE:
- case CC_IPURGE:
- if (doall) {
- DCFA();
- ICPA();
- } else if (inc == 16) {
- DCFL(pa);
- ICPL(pa);
- } else if (inc == NBPG) {
- DCFP(pa);
- ICPP(pa);
- }
- break;
-
- case CC_EXTPURGE|CC_PURGE:
- case CC_PURGE:
- if (doall)
- DCFA(); /* note: flush not purge */
- else if (inc == 16)
- DCPL(pa);
- else if (inc == NBPG)
- DCPP(pa);
- break;
-
- case CC_EXTPURGE|CC_FLUSH:
- case CC_FLUSH:
- if (doall)
- DCFA();
- else if (inc == 16)
- DCFL(pa);
- else if (inc == NBPG)
- DCFP(pa);
- break;
-
- default:
- error = EINVAL;
- break;
- }
- if (doall)
- break;
- pa += inc;
- addr += inc;
- } while (addr < end);
- return(error);
- }
-#endif
- switch (req) {
- case CC_EXTPURGE|CC_PURGE:
- case CC_EXTPURGE|CC_FLUSH:
- case CC_PURGE:
- case CC_FLUSH:
- DCIU();
- break;
- case CC_EXTPURGE|CC_IPURGE:
- DCIU();
- /* fall into... */
- case CC_IPURGE:
- ICIA();
- break;
- default:
- error = EINVAL;
- break;
- }
- return(error);
-}
-
int
sys_sysarch(p, v, retval)
struct proc *p;