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#if DATA_SIZE == 8
26#define SUFFIX q
27#define USUFFIX q
28#define DATA_TYPE uint64_t
29#elif DATA_SIZE == 4
30#define SUFFIX l
31#define USUFFIX l
32#define DATA_TYPE uint32_t
33#elif DATA_SIZE == 2
34#define SUFFIX w
35#define USUFFIX uw
36#define DATA_TYPE uint16_t
37#define DATA_STYPE int16_t
38#elif DATA_SIZE == 1
39#define SUFFIX b
40#define USUFFIX ub
41#define DATA_TYPE uint8_t
42#define DATA_STYPE int8_t
43#else
44#error unsupported data size
45#endif
46
47#if DATA_SIZE == 8
48#define RES_TYPE uint64_t
49#else
50#define RES_TYPE uint32_t
51#endif
52
53static inline RES_TYPE
54glue(glue(cpu_ld, USUFFIX), MEMSUFFIX)(CPUArchState *env, target_ulong ptr)
55{
56 return glue(glue(ld, USUFFIX), _p)(g2h(ptr));
57}
58
59static inline RES_TYPE
60glue(glue(glue(cpu_ld, USUFFIX), MEMSUFFIX), _ra)(CPUArchState *env,
61 target_ulong ptr,
62 uintptr_t retaddr)
63{
64 return glue(glue(cpu_ld, USUFFIX), MEMSUFFIX)(env, ptr);
65}
66
67#if DATA_SIZE <= 2
68static inline int
69glue(glue(cpu_lds, SUFFIX), MEMSUFFIX)(CPUArchState *env, target_ulong ptr)
70{
71 return glue(glue(lds, SUFFIX), _p)(g2h(ptr));
72}
73
74static inline int
75glue(glue(glue(cpu_lds, SUFFIX), MEMSUFFIX), _ra)(CPUArchState *env,
76 target_ulong ptr,
77 uintptr_t retaddr)
78{
79 return glue(glue(cpu_lds, SUFFIX), MEMSUFFIX)(env, ptr);
80}
81#endif
82
83#ifndef CODE_ACCESS
84static inline void
85glue(glue(cpu_st, SUFFIX), MEMSUFFIX)(CPUArchState *env, target_ulong ptr,
86 RES_TYPE v)
87{
88 glue(glue(st, SUFFIX), _p)(g2h(ptr), v);
89}
90
91static inline void
92glue(glue(glue(cpu_st, SUFFIX), MEMSUFFIX), _ra)(CPUArchState *env,
93 target_ulong ptr,
94 RES_TYPE v,
95 uintptr_t retaddr)
96{
97 glue(glue(cpu_st, SUFFIX), MEMSUFFIX)(env, ptr, v);
98}
99#endif
100
101#undef RES_TYPE
102#undef DATA_TYPE
103#undef DATA_STYPE
104#undef SUFFIX
105#undef USUFFIX
106#undef DATA_SIZE
107