mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
bitkeeper revision 1.1713.2.9 (42b3588569-8TLyTABHy5VPCdbAQmQ)
Implement cmpxchg_user for ia64 (hopefully correct :-) Signed-off-by: Dan Magenheimer <dan.magenheimer@hp.com>
This commit is contained in:
1 parent
65a9bd6d17
commit
866a85366c
2 files changed
+33
-4
No files matched your search
@@ -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
|
||||
|
||||
@@ -61,5 +61,37 @@ extern struct task_struct *vmx_ia64_switch_to (void *next_task);
|
||||
} 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
|
||||