summaryrefslogtreecommitdiffstats
path: root/arch/arm/include/asm/xen/events.h
blob: 5c27696de14fda11bf6866138387f1149128e485 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef _ASM_ARM_XEN_EVENTS_H
#define _ASM_ARM_XEN_EVENTS_H

#include <asm/ptrace.h>

enum ipi_vector {
	XEN_PLACEHOLDER_VECTOR,

	/* Xen IPIs go here */
	XEN_NR_IPIS,
};

static inline int xen_irqs_disabled(struct pt_regs *regs)
{
	return raw_irqs_disabled_flags(regs->ARM_cpsr);
}

/*
 * We cannot use xchg because it does not support 8-byte
 * values. However it is safe to use {ldr,dtd}exd directly because all
 * platforms which Xen can run on support those instructions.
 */
static inline xen_ulong_t xchg_xen_ulong(xen_ulong_t *ptr, xen_ulong_t val)
{
	xen_ulong_t oldval;
	unsigned int tmp;

	wmb();
	asm volatile("@ xchg_xen_ulong\n"
		"1:     ldrexd  %0, %H0, [%3]\n"
		"       strexd  %1, %2, %H2, [%3]\n"
		"       teq     %1, #0\n"
		"       bne     1b"
		: "=&r" (oldval), "=&r" (tmp)
		: "r" (val), "r" (ptr)
		: "memory", "cc");
	return oldval;
}

#endif /* _ASM_ARM_XEN_EVENTS_H */
OpenPOWER on IntegriCloud