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