1 /* Portions taken from Linux arch arm */
2 #ifndef __ASM_ARM32_NOSPEC_H
3 #define __ASM_ARM32_NOSPEC_H
4 
5 #define CSDB    ".inst  0xe320f014"
6 
array_index_mask_nospec(unsigned long idx,unsigned long sz)7 static inline unsigned long array_index_mask_nospec(unsigned long idx,
8                                                     unsigned long sz)
9 {
10     unsigned long mask;
11 
12     asm volatile( "cmp    %1, %2\n"
13                   "sbc    %0, %1, %1\n"
14                   CSDB
15                   : "=r" (mask)
16                   : "r" (idx), "Ir" (sz)
17                   : "cc" );
18 
19     return mask;
20 }
21 #define array_index_mask_nospec array_index_mask_nospec
22 
23 #endif /* __ASM_ARM32_NOSPEC_H */
24 /*
25  * Local variables:
26  * mode: C
27  * c-file-style: "BSD"
28  * c-basic-offset: 4
29  * indent-tabs-mode: nil
30  * End:
31  */
32