blob: 5c27696de14fda11bf6866138387f1149128e485 [file] [log] [blame]
Stefano Stabellini0ec53ec2012-09-14 13:37:32 +00001#ifndef _ASM_ARM_XEN_EVENTS_H
2#define _ASM_ARM_XEN_EVENTS_H
3
4#include <asm/ptrace.h>
5
6enum ipi_vector {
7 XEN_PLACEHOLDER_VECTOR,
8
9 /* Xen IPIs go here */
10 XEN_NR_IPIS,
11};
12
13static inline int xen_irqs_disabled(struct pt_regs *regs)
14{
15 return raw_irqs_disabled_flags(regs->ARM_cpsr);
16}
17
Ian Campbellc81611c2013-02-20 11:48:06 +000018/*
19 * We cannot use xchg because it does not support 8-byte
20 * values. However it is safe to use {ldr,dtd}exd directly because all
21 * platforms which Xen can run on support those instructions.
22 */
23static inline xen_ulong_t xchg_xen_ulong(xen_ulong_t *ptr, xen_ulong_t val)
24{
25 xen_ulong_t oldval;
26 unsigned int tmp;
27
28 wmb();
29 asm volatile("@ xchg_xen_ulong\n"
30 "1: ldrexd %0, %H0, [%3]\n"
31 " strexd %1, %2, %H2, [%3]\n"
32 " teq %1, #0\n"
33 " bne 1b"
34 : "=&r" (oldval), "=&r" (tmp)
35 : "r" (val), "r" (ptr)
36 : "memory", "cc");
37 return oldval;
38}
39
Stefano Stabellini0ec53ec2012-09-14 13:37:32 +000040#endif /* _ASM_ARM_XEN_EVENTS_H */