# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1292530427 0
# Node ID 4cf3919db1b5b8d04f43887b389dbf9d4191feee
# Parent d11341841f449d4ec51ebcf720d28bab957ccdfe
x86: Define pte_{read,write}[_atomic] in terms of atomic_readN
Signed-off-by: Keir Fraser <keir@xxxxxxx>
xen-unstable changeset: 22565:1cc551716430
xen-unstable date: Thu Dec 16 19:36:35 2010 +0000
---
xen/include/asm-x86/x86_32/page.h | 18 +++++-------------
xen/include/asm-x86/x86_64/page.h | 6 +++---
2 files changed, 8 insertions(+), 16 deletions(-)
diff -r d11341841f44 -r 4cf3919db1b5 xen/include/asm-x86/x86_32/page.h
--- a/xen/include/asm-x86/x86_32/page.h Thu Dec 16 20:10:32 2010 +0000
+++ b/xen/include/asm-x86/x86_32/page.h Thu Dec 16 20:13:47 2010 +0000
@@ -79,23 +79,15 @@ extern unsigned int PAGE_HYPERVISOR_NOCA
#endif
-#define pte_read_atomic(ptep) ({ \
- intpte_t __pte = *(ptep), __npte; \
- while ( (__npte = cmpxchg(ptep, __pte, __pte)) != __pte ) \
- __pte = __npte; \
- __pte; })
-#define pte_write_atomic(ptep, pte) do { \
- intpte_t __pte = *(ptep), __npte; \
- while ( (__npte = cmpxchg(ptep, __pte, (pte))) != __pte ) \
- __pte = __npte; \
-} while ( 0 )
+#define pte_read_atomic(ptep) atomic_read64(ptep)
+#define pte_write_atomic(ptep, pte) atomic_write64(ptep, pte)
#define pte_write(ptep, pte) do { \
u32 *__ptep_words = (u32 *)(ptep); \
- __ptep_words[0] = 0; \
+ atomic_write32(&__ptep_words[0], 0); \
wmb(); \
- __ptep_words[1] = (pte) >> 32; \
+ atomic_write32(&__ptep_words[1], (pte) >> 32); \
wmb(); \
- __ptep_words[0] = (pte) >> 0; \
+ atomic_write32(&__ptep_words[0], (pte) >> 0); \
} while ( 0 )
/* root table */
diff -r d11341841f44 -r 4cf3919db1b5 xen/include/asm-x86/x86_64/page.h
--- a/xen/include/asm-x86/x86_64/page.h Thu Dec 16 20:10:32 2010 +0000
+++ b/xen/include/asm-x86/x86_64/page.h Thu Dec 16 20:13:47 2010 +0000
@@ -99,9 +99,9 @@ typedef l4_pgentry_t root_pgentry_t;
#endif /* !__ASSEMBLY__ */
-#define pte_read_atomic(ptep) (*(ptep))
-#define pte_write_atomic(ptep, pte) (*(ptep) = (pte))
-#define pte_write(ptep, pte) (*(ptep) = (pte))
+#define pte_read_atomic(ptep) atomic_read64(ptep)
+#define pte_write_atomic(ptep, pte) atomic_write64(ptep, pte)
+#define pte_write(ptep, pte) atomic_write64(ptep, pte)
/* Given a virtual address, get an entry offset into a linear page table. */
#define l1_linear_offset(_a) (((_a) & VADDR_MASK) >> L1_PAGETABLE_SHIFT)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|