Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 May 2007 08:49:39 GMT
From:      Roman Divacky <rdivacky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 119718 for review
Message-ID:  <200705120849.l4C8ndlC079878@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=119718

Change 119718 by rdivacky@rdivacky_witten on 2007/05/12 08:49:14

	Linux32_support.s WIP.

Affected files ...

.. //depot/projects/soc2007/rdivacky/linux_futex/sys/amd64/linux32/linux32_support.s#3 edit

Differences ...

==== //depot/projects/soc2007/rdivacky/linux_futex/sys/amd64/linux32/linux32_support.s#3 (text+ko) ====

@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 1993 The Regents of the University of California.
+ * Copyright (c) 2007 The FreeBSD Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -29,8 +29,8 @@
  * $FreeBSD$
  */
 
-#include "linux32_assym.h"                        /* system definitions */
-#include <machine/asmacros.h>                   /* miscellaneous asm macros */
+#include "linux32_assym.h"		/* system definitions */
+#include <machine/asmacros.h>		/* miscellaneous asm macros */
 
 #include "assym.s"
 
@@ -39,96 +39,87 @@
 /*****************************************************************************/
 
 futex_fault:
-	movq	$0,PCB_ONFAULT(%rcx)
-	movq	$-EFAULT,%rax
+	movq	$0,PCB_ONFAULT(%r8)
+	movl	$-EFAULT,%eax
 	ret
 
 ENTRY(futex_xchgl)
-	movq	PCPU(CURPCB),%rcx
-	movq	$futex_fault,PCB_ONFAULT(%rcx)
-
+	movq	PCPU(CURPCB),%r8
+	movq	$futex_fault,PCB_ONFAULT(%r8)
 	movq	$VM_MAXUSER_ADDRESS-4,%rax
 	cmpq	%rax,%rsi
 	ja	futex_fault
-
-	movl	(%rsi),%eax
-	movl	%eax,(%rdx)
-#ifdef SMP
-	lock
-#endif
 	xchgl	%edi,(%rsi)
+	movl	%edi,(%rdx)
 	xorl	%eax,%eax
-	movq	%rax,PCB_ONFAULT(%rcx)
+	movq	%rax,PCB_ONFAULT(%r8)
 	ret
 
 ENTRY(futex_addl)
-	movq	PCPU(CURPCB),%rcx
-	movq	$futex_fault,PCB_ONFAULT(%rcx)
-
+	movq	PCPU(CURPCB),%r8
+	movq	$futex_fault,PCB_ONFAULT(%r8)
 	movq	$VM_MAXUSER_ADDRESS-4,%rax
 	cmpq	%rax,%rsi
 	ja	futex_fault
-
-	movl	(%rsi),%eax
-	movl	%eax,(%rdx)
 #ifdef SMP
 	lock
 #endif
 	xaddl	%edi,(%rsi)
+	movl	%edi,(%rdx)
 	xorl	%eax,%eax
-	movq	%rax,PCB_ONFAULT(%rcx)
+	movq	%rax,PCB_ONFAULT(%r8)
 	ret
 
 ENTRY(futex_orl)
-	movq	PCPU(CURPCB),%rcx
-	movq	$futex_fault,PCB_ONFAULT(%rcx)
-
+	movq	PCPU(CURPCB),%r8
+	movq	$futex_fault,PCB_ONFAULT(%r8)
 	movq	$VM_MAXUSER_ADDRESS-4,%rax
 	cmpq	%rax,%rsi
 	ja	futex_fault
-
 	movl	(%rsi),%eax
-	movl	%eax,(%rdx)
+1:	movl	%eax,%ecx
+	orl	%edi,%ecx
 #ifdef SMP
 	lock
 #endif
-	orl	%edi,(%rsi)
+	cmpxchgl %ecx,(%rsi)
+	jnz	1b
 	xorl	%eax,%eax
-	movq	%rax,PCB_ONFAULT(%rcx)
+	movq	%rax,PCB_ONFAULT(%r8)
 	ret
 
 ENTRY(futex_andl)
-	movq	PCPU(CURPCB),%rcx
-	movq	$futex_fault,PCB_ONFAULT(%rcx)
-
+	movq	PCPU(CURPCB),%r8
+	movq	$futex_fault,PCB_ONFAULT(%r8)
 	movq	$VM_MAXUSER_ADDRESS-4,%rax
 	cmpq	%rax,%rsi
 	ja	futex_fault
-
 	movl	(%rsi),%eax
-	movl	%eax,(%rdx)
+1:	movl	%eax,%ecx
+	andl	%edi,%ecx
 #ifdef SMP
 	lock
 #endif
-	andl	%edi,(%rsi)
+	cmpxchgl %ecx,(%rsi)
+	jnz	1b
 	xorl	%eax,%eax
-	movq	%rax,PCB_ONFAULT(%rcx)
+	movq	%rax,PCB_ONFAULT(%r8)
 	ret
 
 ENTRY(futex_xorl)
-	movq	PCPU(CURPCB),%rcx
-	movq	$futex_fault,PCB_ONFAULT(%rcx)
-
+	movq	PCPU(CURPCB),%r8
+	movq	$futex_fault,PCB_ONFAULT(%r8)
 	movq	$VM_MAXUSER_ADDRESS-4,%rax
 	cmpq	%rax,%rsi
 	ja	futex_fault
-
 	movl	(%rsi),%eax
-	movl	%eax,(%rdx)
+1:	movl	%eax,%ecx
+	xorl	%edi,%ecx
 #ifdef SMP
 	lock
 #endif
-	xorl	%edi,(%rsi)
+	cmpxchgl %ecx,(%rsi)
+	jnz	1b
 	xorl	%eax,%eax
-	movq	%rax,PCB_ONFAULT(%rcx)
+	movq	%rax,PCB_ONFAULT(%r8)
 	ret



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705120849.l4C8ndlC079878>