summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2007-02-06 23:14:12 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2007-02-06 23:14:12 +0000
commit50559256e64b1c1ed8ff42aa0bbf49b768e6a940 (patch)
treee258d341da8ceffd34951cadbc25d2ee15a12059 /sys
parent6101889507706e8a5bbbe7a836d307f8d47659a1 (diff)
Define trap #0x81 for cache range flush, will be necessary soon for gcc
trampoline code and ld.so.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/sh/include/trap.h3
-rw-r--r--sys/arch/sh/sh/trap.c28
2 files changed, 29 insertions, 2 deletions
diff --git a/sys/arch/sh/include/trap.h b/sys/arch/sh/include/trap.h
index b3a4bca347b..23a28909faa 100644
--- a/sys/arch/sh/include/trap.h
+++ b/sys/arch/sh/include/trap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.h,v 1.1 2006/10/06 21:02:55 miod Exp $ */
+/* $OpenBSD: trap.h,v 1.2 2007/02/06 23:14:09 miod Exp $ */
/* $NetBSD: exception.h,v 1.9 2006/07/22 21:58:29 uwe Exp $ */
/*-
@@ -79,6 +79,7 @@
#define EXP_USER 0x001 /* exception from user-mode */
#define _SH_TRA_SYSCALL 0x80 /* syscall trapa number */
+#define _SH_TRA_CACHECTL 0x81 /* cachectl trapa number */
#define _SH_TRA_BREAK 0xc3 /* magic number for debugger */
/*
diff --git a/sys/arch/sh/sh/trap.c b/sys/arch/sh/sh/trap.c
index d19a634256b..2db0d410517 100644
--- a/sys/arch/sh/sh/trap.c
+++ b/sys/arch/sh/sh/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.7 2007/02/06 23:12:01 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.8 2007/02/06 23:14:11 miod Exp $ */
/* $NetBSD: exception.c,v 1.32 2006/09/04 23:57:52 uwe Exp $ */
/* $NetBSD: syscall.c,v 1.6 2006/03/07 07:21:50 thorpej Exp $ */
@@ -100,6 +100,7 @@
#include <uvm/uvm_extern.h>
+#include <sh/cache.h>
#include <sh/cpu.h>
#include <sh/mmu.h>
#include <sh/trap.h>
@@ -150,6 +151,7 @@ void general_exception(struct proc *, struct trapframe *, uint32_t);
void tlb_exception(struct proc *, struct trapframe *, uint32_t);
void ast(struct proc *, struct trapframe *);
void syscall(struct proc *, struct trapframe *);
+void cachectl(struct proc *, struct trapframe *);
/*
* void general_exception(struct proc *p, struct trapframe *tf):
@@ -203,6 +205,9 @@ general_exception(struct proc *p, struct trapframe *tf, uint32_t va)
case _SH_TRA_SYSCALL << 2:
syscall(p, tf);
return;
+ case _SH_TRA_CACHECTL << 2:
+ cachectl(p, tf);
+ return;
default:
sv.sival_ptr = (void *)tf->tf_spc;
trapsignal(p, SIGILL, expevt & ~EXP_USER, ILL_ILLTRP,
@@ -494,6 +499,27 @@ ast(struct proc *p, struct trapframe *tf)
}
void
+cachectl(struct proc *p, struct trapframe *tf)
+{
+ vaddr_t va;
+ vsize_t len;
+
+ if (!SH_HAS_UNIFIED_CACHE) {
+ va = (vaddr_t)tf->tf_r4;
+ len = (vsize_t)tf->tf_r5;
+
+ if (/* va < VM_MIN_ADDRESS || */ va >= VM_MAXUSER_ADDRESS ||
+ va + len <= va || va + len >= VM_MAXUSER_ADDRESS)
+ len = 0;
+
+ if (len != 0)
+ sh_icache_sync_range_index(va, len);
+ }
+
+ userret(p);
+}
+
+void
syscall(struct proc *p, struct trapframe *tf)
{
caddr_t params;