Commit | Line | Data |
---|---|---|
29721c9c NI |
1 | /* Renesas SH (32bit) only */ |
2 | ||
3 | #ifndef ARCH_SH_H | |
4 | #define ARCH_SH_H | |
5 | ||
cca84643 | 6 | #define FIO_ARCH (arch_sh) |
29721c9c | 7 | |
29721c9c | 8 | #define nop __asm__ __volatile__ ("nop": : :"memory") |
e0c4a469 | 9 | |
d3cc4ebf JA |
10 | #define mb() \ |
11 | do { \ | |
12 | if (arch_flags & ARCH_FLAG_1) \ | |
13 | __asm__ __volatile__ ("synco": : :"memory"); \ | |
14 | else \ | |
15 | __asm__ __volatile__ (" " : : : "memory"); \ | |
16 | } while (0) | |
e0c4a469 JA |
17 | |
18 | #define read_barrier() mb() | |
19 | #define write_barrier() mb() | |
29721c9c | 20 | |
5f739e0e NI |
21 | #include <stdio.h> |
22 | #include <elf.h> | |
23 | ||
24 | extern unsigned long arch_flags; | |
25 | ||
d3cc4ebf JA |
26 | #define CPU_HAS_LLSC 0x0040 |
27 | ||
28 | static inline int arch_init(char *envp[]) | |
29 | { | |
30 | Elf32_auxv_t *auxv; | |
31 | ||
32 | while (*envp++ != NULL) | |
33 | ; | |
34 | ||
35 | for (auxv = (Elf32_auxv_t *) envp; auxv->a_type != AT_NULL; auxv++) { | |
36 | if (auxv->a_type == AT_HWCAP) { | |
37 | if (auxv->a_un.a_val & CPU_HAS_LLSC) { | |
38 | arch_flags |= ARCH_FLAG_1; | |
39 | break; | |
40 | } | |
41 | } | |
42 | } | |
43 | ||
44 | return 0; | |
45 | } | |
46 | ||
47 | #define ARCH_HAVE_INIT | |
48 | ||
29721c9c | 49 | #endif |