summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2017-05-29 06:06:52 +0000
committermpi <mpi@openbsd.org>2017-05-29 06:06:52 +0000
commit0180700becabee181a605924110bea5621c6f4b7 (patch)
tree35d59dd840073f99bd225df695dad8f57b2c67d7
parentvmm(4): Enable support for AMD-V (SVM) CPUs. (diff)
downloadwireguard-openbsd-0180700becabee181a605924110bea5621c6f4b7.tar.xz
wireguard-openbsd-0180700becabee181a605924110bea5621c6f4b7.zip
copyin32 implementation from miod@
ok kettenis@
-rw-r--r--sys/arch/m88k/m88k/subr.S44
1 files changed, 43 insertions, 1 deletions
diff --git a/sys/arch/m88k/m88k/subr.S b/sys/arch/m88k/m88k/subr.S
index a80746e506f..fceab377bd3 100644
--- a/sys/arch/m88k/m88k/subr.S
+++ b/sys/arch/m88k/m88k/subr.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr.S,v 1.26 2016/06/21 12:31:19 aoyama Exp $ */
+/* $OpenBSD: subr.S,v 1.27 2017/05/29 06:06:52 mpi Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1992 Carnegie Mellon University
@@ -372,6 +372,48 @@ ASLOCAL(Lciflt)
#undef DEST
#undef LEN
+/*
+ * Specific flavour for a single 32-bit word copy.
+ * copyin32(from, to)
+ * r2 == from (user source address)
+ * r3 == to (kernel destination address)
+ */
+
+#define SRC %r2
+#define DEST %r3
+
+ENTRY(copyin32)
+ /* check for source alignment */
+ mask %r8, SRC, 0x3
+ bcnd ne0, %r8, _ASM_LABEL(copyin32_misaligned)
+
+ /* set up fault handler */
+ ldcr %r5, CPU
+ ld %r6, %r5, CI_CURPCB
+ or.u %r5, %r0, %hi16(_ASM_LABEL(Lciflt))
+ or %r5, %r5, %lo16(_ASM_LABEL(Lciflt))
+ st %r5, %r6, PCB_ONFAULT /* pcb_onfault = Lciflt */
+
+#ifdef ERRATA__XXX_USR
+ NOP
+ ld.usr %r5, SRC, %r0
+ NOP
+ NOP
+ NOP
+#else
+ ld.usr %r5, SRC, %r0
+#endif
+ st %r5, DEST, %r0
+ br.n _ASM_LABEL(Lcidone)
+ or %r2, %r0, %r0 /* successful return */
+
+ASLOCAL(copyin32_misaligned)
+ jmp.n %r1
+ or %r2, %r0, EFAULT /* return fault */
+
+#undef SRC
+#undef DEST
+
/*######################################################################*/
/*######################################################################*/