> This makes MULTIPROCESSOR kernels use copyin32(9) to guarantee
> atomicity.  This will break m88k GENERIC.MP; shouldn't be too
> difficult to fix for someone whu understands m88k assembly.

Index: subr.S
===================================================================
RCS file: /OpenBSD/src/sys/arch/m88k/m88k/subr.S,v
retrieving revision 1.26
diff -u -p -r1.26 subr.S
--- subr.S      21 Jun 2016 12:31:19 -0000      1.26
+++ subr.S      28 May 2017 19:20:34 -0000
@@ -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
+
 /*######################################################################*/
 /*######################################################################*/
 

Reply via email to