Page MenuHomeFreeBSD

D6762.id.diff
No OneTemporary

D6762.id.diff

Index: sys/arm/linux/linux_support.s
===================================================================
--- /dev/null
+++ sys/arm/linux/linux_support.s
@@ -0,0 +1,115 @@
+/*-
+ * 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-4
+
+#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
+
+
+futex_fault:
+ GET_PCB(r3)
+ ldr r3, [r3]
+ mov r4, #0
+ str r4, [r3, #PCB_ONFAULT]
+ pop {r3, r4, r5, r6}
+ mov r0, #-EFAULT
+ mov pc, lr
+/*
+ r0 : int oparg
+ r1 : uint32_t *uaddr
+ r2 : int *oldval
+*/
+#define FUTEX_HEAD(err_fun)\
+ push {r3, r4, r5, r6};\
+ adr r4, .vm_maxuser_address ;\
+ ldr r4, [r4] ;\
+ cmp r1, r4 ;\
+ popgt {r3, r4, r5, r6};\
+ movgt r0, #-EFAULT;\
+ movgt pc, lr;\
+ GET_PCB(r3) ;\
+ ldr r3, [r3] ;\
+ adr r5, err_fun ;\
+ str r5, [r3, #PCB_ONFAULT];\
+1:;\
+ ldrex r4, [r1]
+
+#define FUTEX_TAIL()\
+ strex r5, r6, [r1];\
+ cmp r5, #0;\
+ bne 1b;\
+ str r4, [r2] ;\
+ mov r5, #0 ;\
+ str r5, [r3, #PCB_ONFAULT] ;\
+ pop {r3, r4, r5, r6};\
+ mov r0, #0;\
+ mov pc, lr
+
+ENTRY(futex_xchgl)
+ FUTEX_HEAD(futex_fault)
+ mov r6, r0
+ FUTEX_TAIL()
+
+ENTRY(futex_addl)
+ FUTEX_HEAD(futex_fault)
+ add r6, r0, r4
+ FUTEX_TAIL()
+
+ENTRY(futex_orl)
+ FUTEX_HEAD(futex_fault)
+ orr r6, r0, r4
+ FUTEX_TAIL()
+
+ENTRY(futex_andl)
+ FUTEX_HEAD(futex_fault)
+ and r6, r0, r4
+ FUTEX_TAIL()
+
+ENTRY(futex_xorl)
+ FUTEX_HEAD(futex_fault)
+ eor r6, r0, r4
+ FUTEX_TAIL()

File Metadata

Mime Type
text/plain
Expires
Tue, May 19, 5:57 AM (6 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33295574
Default Alt Text
D6762.id.diff (3 KB)

Event Timeline