Page MenuHomeFreeBSD

D7977.id20538.diff
No OneTemporary

D7977.id20538.diff

Index: sys/arm/linux/linux_support.s
===================================================================
--- /dev/null
+++ sys/arm/linux/linux_support.s
@@ -0,0 +1,127 @@
+/*-
+ * Copyright (c) 2016 Gregory Soutade
+ * Copyright (c) 2006,2007 Konstantin Belousov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include "linux_assym.h" /* system definitions */
+#include <machine/asmacros.h> /* miscellaneous asm macros */
+#define EFAULT 1
+
+#include "assym.s"
+
+.vm_maxuser_address: .word VM_MAXUSER_ADDRESS
+
+#if __ARM_ARCH >= 6
+#define GET_PCB(tmp) \
+ mrc p15, 0, tmp, c13, c0, 4 ; \
+ add tmp, tmp, #(TD_PCB)
+#else
+ .Lcurpcb:
+ .word _C_LABEL(__pcpu) + PC_CURPCB
+#define GET_PCB(tmp) \
+ ldr tmp, .Lcurpcb
+#endif
+
+
+ASENTRY_NP(futex_fault_decx)
+ GET_PCB(r0)
+ ldr r0, [r0]
+futex_fault:
+ mov r1, #0
+ str r1, [r0, #PCB_ONFAULT]
+ mov r0, #-EFAULT
+ mov pc, lr
+ASEND(futex_fault_decx)
+
+#define FUTEX_HEAD(err_fun)\
+ GET_PCB(r3) ; \
+ ldr r3, [r3] ; \
+ adr r1, err_fun ; \
+ str r1, [r3, #PCB_ONFAULT] ; \
+ ldr r0, [sp, #4] ; \
+ ldr r1, [sp, #8] ; \
+ adr r2, .vm_maxuser_address ;\
+ ldr r2, [r2] ;\
+ cmp r1, r2 ; \
+ bgt futex_fault
+
+#define FUTEX_TAIL()\
+ ldr r1, [sp, #12] ; \
+ str r0, [r1] ; \
+ mov r1, #0 ; \
+ str r1, [r3, #PCB_ONFAULT] ; \
+ mov pc, lr
+
+ENTRY_NP(futex_xchgl)
+ FUTEX_HEAD(futex_fault)
+ ldrex r0, [r1]
+ FUTEX_TAIL()
+END(futex_xchgl)
+
+ENTRY_NP(futex_addl)
+ FUTEX_HEAD(futex_fault)
+ ldrex r1, [r1]
+ add r0, r1
+ FUTEX_TAIL()
+END(futex_addl)
+
+ENTRY_NP(futex_orl)
+ FUTEX_HEAD(futex_fault_decx)
+ ldr r0, [r1]
+1: ldr r2, [sp, #4]
+ orr r2, r0
+ strex r4, r2, [r1]
+ cmp r2, #0
+ bne 1b
+futex_tail:
+ FUTEX_TAIL()
+END(futex_orl)
+
+ENTRY_NP(futex_andl)
+ FUTEX_HEAD(futex_fault_decx)
+ ldr r0, [r1]
+1: ldr r2, [sp, #4]
+ and r2, r0
+ strex r4, r2, [r1]
+ cmp r2, #0
+ bne 1b
+ b futex_tail
+END(futex_andl)
+
+ENTRY_NP(futex_xorl)
+ FUTEX_HEAD(futex_fault_decx)
+ ldr r0, [r1]
+1: ldr r2, [sp, #4]
+ eor r2, r0
+ strex r4, r2, [r1]
+ cmp r2, #0
+ bne 1b
+ b futex_tail
+END(futex_xorl)

File Metadata

Mime Type
text/plain
Expires
Fri, May 15, 11:28 PM (10 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33102737
Default Alt Text
D7977.id20538.diff (3 KB)

Event Timeline