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 sev()           asm volatile("sev" : : : "memory")
9 #define wfe()           asm volatile("wfe" : : : "memory")
10 #define wfi()           asm volatile("wfi" : : : "memory")
11 
12 #define isb()           asm volatile("isb" : : : "memory")
13 #define dsb(scope)      asm volatile("dsb " #scope : : : "memory")
14 #define dmb(scope)      asm volatile("dmb " #scope : : : "memory")
15 
16 #define mb()            dsb(sy)
17 #ifdef CONFIG_ARM_64
18 #define rmb()           dsb(ld)
19 #else
20 #define rmb()           dsb(sy) /* 32-bit has no ld variant. */
21 #endif
22 #define wmb()           dsb(st)
23 
24 #define smp_mb()        dmb(ish)
25 #ifdef CONFIG_ARM_64
26 #define smp_rmb()       dmb(ishld)
27 #else
28 #define smp_rmb()       dmb(ish) /* 32-bit has no ishld variant. */
29 #endif
30 
31 #define smp_wmb()       dmb(ishst)
32 
33 #define smp_mb__before_atomic()    smp_mb()
34 #define smp_mb__after_atomic()     smp_mb()
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