WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Implement cmpxchg_user for ia64 (hopefully correct :-)

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Implement cmpxchg_user for ia64 (hopefully correct :-)
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Fri, 17 Jun 2005 23:11:01 +0000
Cc: james@xxxxxxxxxxxxx
Delivery-date: Thu, 23 Jun 2005 11:02:26 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1713.2.9, 2005/06/17 17:11:01-06:00, djm@xxxxxxxxxxxxxxx

        Implement cmpxchg_user for ia64 (hopefully correct :-)
        
        Signed-off-by: Dan Magenheimer <dan.magenheimer@xxxxxx>



 arch/ia64/grant_table.c      |    5 +----
 include/asm-ia64/xensystem.h |   32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 4 deletions(-)


diff -Nru a/xen/arch/ia64/grant_table.c b/xen/arch/ia64/grant_table.c
--- a/xen/arch/ia64/grant_table.c       2005-06-23 07:03:34 -04:00
+++ b/xen/arch/ia64/grant_table.c       2005-06-23 07:03:34 -04:00
@@ -35,10 +35,7 @@
 #ifdef __ia64__
 #define __addr_ok(a) 1 // FIXME-ia64: a variant of access_ok??
 // FIXME-ia64: need to implement real cmpxchg_user on ia64
-#define cmpxchg_user(_p,_o,_n) ((*_p == _o) ? ((*_p = _n), 0) : ((_o = *_p), 
0))
-// FIXME-ia64: the following are meaningless on ia64? move to some header file
-#define put_page(x) do { } while (0)
-#define put_page_type(x) do { } while (0)
+//#define cmpxchg_user(_p,_o,_n) ((*_p == _o) ? ((*_p = _n), 0) : ((_o = *_p), 
0))
 // FIXME-ia64: these belong in an asm/grant_table.h... PAGE_SIZE different
 #undef ORDER_GRANT_FRAMES
 //#undef NUM_GRANT_FRAMES
diff -Nru a/xen/include/asm-ia64/xensystem.h b/xen/include/asm-ia64/xensystem.h
--- a/xen/include/asm-ia64/xensystem.h  2005-06-23 07:03:34 -04:00
+++ b/xen/include/asm-ia64/xensystem.h  2005-06-23 07:03:34 -04:00
@@ -61,5 +61,37 @@
 } while (0)
 #endif // CONFIG_VTI
 
+#define __cmpxchg_user(ptr, new, old, _size)                           \
+({                                                                     \
+       register long __gu_r8 asm ("r8");                               \
+       register long __gu_r9 asm ("r9");                               \
+       asm volatile ("mov ar.ccv=%0;;" :: "rO"(old));                  \
+       asm volatile ("mov %2=r0;;\n"                                   \
+               "[1:]\tcmpxchg"_size".acq %0=[%3],%4,ar.ccv\n"          \
+               "\t.xdata4 \"__ex_table\", 1b-., 1f.+4\n"               \
+               "[1:]"                                                  \
+               : "=r"(old), "=r"(__gu_r9), "=r"(__gu_r8) :             \
+               "r"(ptr), "r"(new) : "memory");                         \
+       (old) = __gu_r9;                                                \
+       __gu_r8;                                                        \
+})
+
+
+// NOTE: Xen defines args as pointer,old,new whereas ia64 uses pointer,new,old
+//  so reverse them here
+#define cmpxchg_user(_p,_o,_n)                                 \
+({                                                             \
+       register long _rc;                                      \
+       ia64_mf();                                              \
+       switch ( sizeof(*(_p)) ) {                              \
+           case 1: _rc = __cmpxchg_user(_p,_n,_o,"1"); break;  \
+           case 2: _rc = __cmpxchg_user(_p,_n,_o,"2"); break;  \
+           case 4: _rc = __cmpxchg_user(_p,_n,_o,"4"); break;  \
+           case 8: _rc = __cmpxchg_user(_p,_n,_o,"8"); break;  \
+       }                                                       \
+       ia64_mf();                                              \
+       _rc;                                                    \
+})
+
 #endif // __ASSEMBLY__
 #endif // _ASM_IA64_XENSYSTEM_H

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Implement cmpxchg_user for ia64 (hopefully correct :-), BitKeeper Bot <=