Add os/os-linux-syscall.h to separate syscall NR from arch headers
[fio.git] / arch / arch-sh.h
index 23e6ca07305876e8e71e21eb381178920d947d57..58ff22652ca833782b4f42254c87ba601883aa85 100644 (file)
@@ -3,25 +3,47 @@
 #ifndef ARCH_SH_H
 #define ARCH_SH_H
 
-#define ARCH   (arch_sh)
+#define FIO_ARCH       (arch_sh)
 
-#ifndef __NR_ioprio_set
-#define __NR_ioprio_set        288
-#define __NR_ioprio_get        289
-#endif
+#define nop             __asm__ __volatile__ ("nop": : :"memory")
 
-#ifndef __NR_fadvise64
-#define __NR_fadvise64 250
-#endif
+#define mb()                                                           \
+       do {                                                            \
+               if (arch_flags & ARCH_FLAG_1)                           \
+                       __asm__ __volatile__ ("synco": : :"memory");    \
+               else                                                    \
+                       __asm__ __volatile__ (" " : : : "memory");      \
+       } while (0)
 
-#ifndef __NR_sys_splice
-#define __NR_sys_splice                313
-#define __NR_sys_tee           315
-#define __NR_sys_vmsplice      316
-#endif
+#define read_barrier() mb()
+#define write_barrier()        mb()
 
-#define nop             __asm__ __volatile__ ("nop": : :"memory")
-#define read_barrier()  __asm__ __volatile__ (" " : : : "memory")
-#define write_barrier() __asm__ __volatile__ (" " : : : "memory")
+#include <stdio.h>
+#include <elf.h>
+
+extern unsigned long arch_flags;
+
+#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