Add copyright notices
[qemu-kvm/fedora.git] / target-sparc / op_mem.h
blob894fc36660d81eed40cd838a5bb8e8915b9635cb
1 #ifdef TARGET_ABI32
2 #define ADDR(x) ((x) & 0xffffffff)
3 #else
4 #define ADDR(x) (x)
5 #endif
7 /*** Integer load ***/
8 #define SPARC_LD_OP(name, qp) \
9 void OPPROTO glue(glue(op_, name), MEMSUFFIX)(void) \
10 { \
11 T1 = (target_ulong)glue(qp, MEMSUFFIX)(ADDR(T0)); \
14 #define SPARC_LD_OP_S(name, qp) \
15 void OPPROTO glue(glue(op_, name), MEMSUFFIX)(void) \
16 { \
17 T1 = (target_long)glue(qp, MEMSUFFIX)(ADDR(T0)); \
20 #define SPARC_ST_OP(name, op) \
21 void OPPROTO glue(glue(op_, name), MEMSUFFIX)(void) \
22 { \
23 glue(op, MEMSUFFIX)(ADDR(T0), T1); \
26 SPARC_LD_OP(ld, ldl);
27 SPARC_LD_OP(ldub, ldub);
28 SPARC_LD_OP(lduh, lduw);
29 SPARC_LD_OP_S(ldsb, ldsb);
30 SPARC_LD_OP_S(ldsh, ldsw);
32 /*** Integer store ***/
33 SPARC_ST_OP(st, stl);
34 SPARC_ST_OP(stb, stb);
35 SPARC_ST_OP(sth, stw);
37 void OPPROTO glue(op_std, MEMSUFFIX)(void)
39 uint64_t tmp = ((uint64_t)T1 << 32) | (uint64_t)(T2 & 0xffffffff);
41 glue(stq, MEMSUFFIX)(ADDR(T0), tmp);
44 void OPPROTO glue(op_ldstub, MEMSUFFIX)(void)
46 T1 = glue(ldub, MEMSUFFIX)(ADDR(T0));
47 glue(stb, MEMSUFFIX)(ADDR(T0), 0xff); /* XXX: Should be Atomically */
50 void OPPROTO glue(op_swap, MEMSUFFIX)(void)
52 target_ulong tmp = glue(ldl, MEMSUFFIX)(ADDR(T0));
53 glue(stl, MEMSUFFIX)(ADDR(T0), T1); /* XXX: Should be Atomically */
54 T1 = tmp;
57 void OPPROTO glue(op_ldd, MEMSUFFIX)(void)
59 uint64_t tmp;
61 tmp = glue(ldq, MEMSUFFIX)(ADDR(T0));
62 T1 = tmp >> 32;
63 T0 = tmp & 0xffffffff;
66 /*** Floating-point store ***/
67 void OPPROTO glue(op_stf, MEMSUFFIX) (void)
69 glue(stfl, MEMSUFFIX)(ADDR(T0), FT0);
72 void OPPROTO glue(op_stdf, MEMSUFFIX) (void)
74 glue(stfq, MEMSUFFIX)(ADDR(T0), DT0);
77 /*** Floating-point load ***/
78 void OPPROTO glue(op_ldf, MEMSUFFIX) (void)
80 FT0 = glue(ldfl, MEMSUFFIX)(ADDR(T0));
83 void OPPROTO glue(op_lddf, MEMSUFFIX) (void)
85 DT0 = glue(ldfq, MEMSUFFIX)(ADDR(T0));
88 #if defined(CONFIG_USER_ONLY)
89 void OPPROTO glue(op_ldqf, MEMSUFFIX) (void)
91 // XXX add 128 bit load
92 CPU_QuadU u;
94 u.ll.upper = glue(ldq, MEMSUFFIX)(ADDR(T0));
95 u.ll.lower = glue(ldq, MEMSUFFIX)(ADDR(T0 + 8));
96 QT0 = u.q;
99 void OPPROTO glue(op_stqf, MEMSUFFIX) (void)
101 // XXX add 128 bit store
102 CPU_QuadU u;
104 u.q = QT0;
105 glue(stq, MEMSUFFIX)(ADDR(T0), u.ll.upper);
106 glue(stq, MEMSUFFIX)(ADDR(T0 + 8), u.ll.lower);
108 #endif
110 #ifdef TARGET_SPARC64
111 void OPPROTO glue(op_lduw, MEMSUFFIX)(void)
113 T1 = (uint64_t)(glue(ldl, MEMSUFFIX)(ADDR(T0)) & 0xffffffff);
116 void OPPROTO glue(op_ldsw, MEMSUFFIX)(void)
118 T1 = (int64_t)(glue(ldl, MEMSUFFIX)(ADDR(T0)) & 0xffffffff);
121 SPARC_LD_OP(ldx, ldq);
122 SPARC_ST_OP(stx, stq);
123 #endif
124 #undef MEMSUFFIX