1 /* Renesas SH (32bit) only */ 2 3 #ifndef ARCH_SH_H 4 #define ARCH_SH_H 5 6 #define FIO_ARCH (arch_sh) 7 8 #define nop __asm__ __volatile__ ("nop": : :"memory") 9 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) 17 18 #define read_barrier() mb() 19 #define write_barrier() mb() 20 21 #include <stdio.h> 22 #include <elf.h> 23 24 extern unsigned long arch_flags; 25 26 #define CPU_HAS_LLSC 0x0040 27 arch_init(char * envp[])28static 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 49 #endif 50