root / target-sparc / op_mem.h @ 4ad5b06d
History | View | Annotate | Download (2.9 kB)
1 |
/*** Integer load ***/
|
---|---|
2 |
#define SPARC_LD_OP(name, qp) \
|
3 |
void OPPROTO glue(glue(op_, name), MEMSUFFIX)(void) \ |
4 |
{ \ |
5 |
T1 = (target_ulong)glue(qp, MEMSUFFIX)(T0); \ |
6 |
} |
7 |
|
8 |
#define SPARC_LD_OP_S(name, qp) \
|
9 |
void OPPROTO glue(glue(op_, name), MEMSUFFIX)(void) \ |
10 |
{ \ |
11 |
T1 = (target_long)glue(qp, MEMSUFFIX)(T0); \ |
12 |
} |
13 |
|
14 |
#define SPARC_ST_OP(name, op) \
|
15 |
void OPPROTO glue(glue(op_, name), MEMSUFFIX)(void) \ |
16 |
{ \ |
17 |
glue(op, MEMSUFFIX)(T0, T1); \ |
18 |
} |
19 |
|
20 |
SPARC_LD_OP(ld, ldl); |
21 |
SPARC_LD_OP(ldub, ldub); |
22 |
SPARC_LD_OP(lduh, lduw); |
23 |
SPARC_LD_OP_S(ldsb, ldsb); |
24 |
SPARC_LD_OP_S(ldsh, ldsw); |
25 |
|
26 |
/*** Integer store ***/
|
27 |
SPARC_ST_OP(st, stl); |
28 |
SPARC_ST_OP(stb, stb); |
29 |
SPARC_ST_OP(sth, stw); |
30 |
|
31 |
void OPPROTO glue(op_std, MEMSUFFIX)(void) |
32 |
{ |
33 |
glue(stl, MEMSUFFIX)(T0, T1); |
34 |
glue(stl, MEMSUFFIX)((T0 + 4), T2);
|
35 |
} |
36 |
|
37 |
void OPPROTO glue(op_ldstub, MEMSUFFIX)(void) |
38 |
{ |
39 |
T1 = glue(ldub, MEMSUFFIX)(T0); |
40 |
glue(stb, MEMSUFFIX)(T0, 0xff); /* XXX: Should be Atomically */ |
41 |
} |
42 |
|
43 |
void OPPROTO glue(op_swap, MEMSUFFIX)(void) |
44 |
{ |
45 |
target_ulong tmp = glue(ldl, MEMSUFFIX)(T0); |
46 |
glue(stl, MEMSUFFIX)(T0, T1); /* XXX: Should be Atomically */
|
47 |
T1 = tmp; |
48 |
} |
49 |
|
50 |
void OPPROTO glue(op_ldd, MEMSUFFIX)(void) |
51 |
{ |
52 |
T1 = glue(ldl, MEMSUFFIX)(T0); |
53 |
T0 = glue(ldl, MEMSUFFIX)((T0 + 4));
|
54 |
} |
55 |
|
56 |
/*** Floating-point store ***/
|
57 |
void OPPROTO glue(op_stf, MEMSUFFIX) (void) |
58 |
{ |
59 |
glue(stfl, MEMSUFFIX)(T0, FT0); |
60 |
} |
61 |
|
62 |
void OPPROTO glue(op_stdf, MEMSUFFIX) (void) |
63 |
{ |
64 |
glue(stfq, MEMSUFFIX)(T0, DT0); |
65 |
} |
66 |
|
67 |
/*** Floating-point load ***/
|
68 |
void OPPROTO glue(op_ldf, MEMSUFFIX) (void) |
69 |
{ |
70 |
FT0 = glue(ldfl, MEMSUFFIX)(T0); |
71 |
} |
72 |
|
73 |
void OPPROTO glue(op_lddf, MEMSUFFIX) (void) |
74 |
{ |
75 |
DT0 = glue(ldfq, MEMSUFFIX)(T0); |
76 |
} |
77 |
|
78 |
#ifdef TARGET_SPARC64
|
79 |
/* XXX: Should be Atomically */
|
80 |
/* XXX: There are no cas[x] instructions, only cas[x]a */
|
81 |
void OPPROTO glue(op_cas, MEMSUFFIX)(void) |
82 |
{ |
83 |
uint32_t tmp; |
84 |
|
85 |
tmp = glue(ldl, MEMSUFFIX)(T0); |
86 |
T2 &= 0xffffffffULL;
|
87 |
if (tmp == (T1 & 0xffffffffULL)) { |
88 |
glue(stl, MEMSUFFIX)(T0, T2); |
89 |
} |
90 |
T2 = tmp; |
91 |
} |
92 |
|
93 |
void OPPROTO glue(op_casx, MEMSUFFIX)(void) |
94 |
{ |
95 |
uint64_t tmp; |
96 |
|
97 |
// XXX
|
98 |
tmp = (uint64_t)glue(ldl, MEMSUFFIX)(T0) << 32;
|
99 |
tmp |= glue(ldl, MEMSUFFIX)(T0); |
100 |
if (tmp == T1) {
|
101 |
glue(stq, MEMSUFFIX)(T0, T2); |
102 |
} |
103 |
T2 = tmp; |
104 |
} |
105 |
|
106 |
void OPPROTO glue(op_ldsw, MEMSUFFIX)(void) |
107 |
{ |
108 |
T1 = (int64_t)(glue(ldl, MEMSUFFIX)(T0) & 0xffffffff);
|
109 |
} |
110 |
|
111 |
SPARC_LD_OP(ldx, ldq); |
112 |
SPARC_ST_OP(stx, stq); |
113 |
#endif
|
114 |
#undef MEMSUFFIX
|