X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=arch%2Farch-sh.h;h=ef4ee032f1ca0922014baca2e0697f210b3a37d7;hp=72183fac9eb26bc2ff64d8498cab45b4b0ca2251;hb=d3cc4ebf58ec05037c3b0dd7c83c075a56f1dc62;hpb=29721c9ce4f85775ff77dcb04bd26a7f10272e47 diff --git a/arch/arch-sh.h b/arch/arch-sh.h index 72183fac..ef4ee032 100644 --- a/arch/arch-sh.h +++ b/arch/arch-sh.h @@ -3,7 +3,7 @@ #ifndef ARCH_SH_H #define ARCH_SH_H -#define SH (arch_sh) +#define ARCH (arch_sh) #ifndef __NR_ioprio_set #define __NR_ioprio_set 288 @@ -21,7 +21,39 @@ #endif #define nop __asm__ __volatile__ ("nop": : :"memory") -#define read_barrier() __asm__ __volatile__ (" " : : : "memory") -#define write_barrier() __asm__ __volatile__ (" " : : : "memory") + +#define mb() \ + do { \ + if (arch_flags & ARCH_FLAG_1) \ + __asm__ __volatile__ ("synco": : :"memory"); \ + else \ + __asm__ __volatile__ (" " : : : "memory"); \ + } while (0) + +#define read_barrier() mb() +#define write_barrier() mb() + +#define CPU_HAS_LLSC 0x0040 + +static inline int arch_init(char *envp[]) +{ + Elf32_auxv_t *auxv; + + while (*envp++ != NULL) + ; + + for (auxv = (Elf32_auxv_t *) envp; auxv->a_type != AT_NULL; auxv++) { + if (auxv->a_type == AT_HWCAP) { + if (auxv->a_un.a_val & CPU_HAS_LLSC) { + arch_flags |= ARCH_FLAG_1; + break; + } + } + } + + return 0; +} + +#define ARCH_HAVE_INIT #endif