summaryrefslogtreecommitdiff
path: root/arch/arch-sh.h
blob: 58ff22652ca833782b4f42254c87ba601883aa85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* Renesas SH (32bit) only */

#ifndef ARCH_SH_H
#define ARCH_SH_H

#define FIO_ARCH	(arch_sh)

#define nop             __asm__ __volatile__ ("nop": : :"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()

#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