1 /* Portions taken from Linux arch arm */
2 #ifndef __ASM_SYSTEM_H
3 #define __ASM_SYSTEM_H
4 
5 #include <xen/lib.h>
6 #include <public/arch-arm.h>
7 
8 #define nop() \
9     asm volatile ( "nop" )
10 
11 #define sev()           asm volatile("sev" : : : "memory")
12 #define wfe()           asm volatile("wfe" : : : "memory")
13 #define wfi()           asm volatile("wfi" : : : "memory")
14 
15 #define isb()           asm volatile("isb" : : : "memory")
16 #define dsb(scope)      asm volatile("dsb " #scope : : : "memory")
17 #define dmb(scope)      asm volatile("dmb " #scope : : : "memory")
18 
19 #define mb()            dsb(sy)
20 #ifdef CONFIG_ARM_64
21 #define rmb()           dsb(ld)
22 #else
23 #define rmb()           dsb(sy) /* 32-bit has no ld variant. */
24 #endif
25 #define wmb()           dsb(st)
26 
27 #define smp_mb()        dmb(ish)
28 #ifdef CONFIG_ARM_64
29 #define smp_rmb()       dmb(ishld)
30 #else
31 #define smp_rmb()       dmb(ish) /* 32-bit has no ishld variant. */
32 #endif
33 
34 #define smp_wmb()       dmb(ishst)
35 
36 /*
37  * This is used to ensure the compiler did actually allocate the register we
38  * asked it for some inline assembly sequences.  Apparently we can't trust
39  * the compiler from one version to another so a bit of paranoia won't hurt.
40  * This string is meant to be concatenated with the inline asm string and
41  * will cause compilation to stop on mismatch.
42  * (for details, see gcc PR 15089)
43  */
44 #define __asmeq(x, y)  ".ifnc " x "," y " ; .err ; .endif\n\t"
45 
46 #if defined(CONFIG_ARM_32)
47 # include <asm/arm32/system.h>
48 #elif defined(CONFIG_ARM_64)
49 # include <asm/arm64/system.h>
50 #else
51 # error "unknown ARM variant"
52 #endif
53 
local_abort_is_enabled(void)54 static inline int local_abort_is_enabled(void)
55 {
56     unsigned long flags;
57     local_save_flags(flags);
58     return !(flags & PSR_ABT_MASK);
59 }
60 
61 #define arch_fetch_and_add(x, v) __sync_fetch_and_add(x, v)
62 
63 extern struct vcpu *__context_switch(struct vcpu *prev, struct vcpu *next);
64 
65 #endif
66 /*
67  * Local variables:
68  * mode: C
69  * c-file-style: "BSD"
70  * c-basic-offset: 4
71  * indent-tabs-mode: nil
72  * End:
73  */
74