2004-09-30 23:55:55 +02:00
|
|
|
/*** Integer load ***/
|
|
|
|
#define SPARC_LD_OP(name, qp) \
|
|
|
|
void OPPROTO glue(glue(op_, name), MEMSUFFIX)(void) \
|
|
|
|
{ \
|
2005-07-02 16:31:34 +02:00
|
|
|
T1 = (target_ulong)glue(qp, MEMSUFFIX)(T0); \
|
2004-09-30 23:55:55 +02:00
|
|
|
}
|
|
|
|
|
2005-07-02 16:31:34 +02:00
|
|
|
#define SPARC_LD_OP_S(name, qp) \
|
|
|
|
void OPPROTO glue(glue(op_, name), MEMSUFFIX)(void) \
|
|
|
|
{ \
|
|
|
|
T1 = (target_long)glue(qp, MEMSUFFIX)(T0); \
|
|
|
|
}
|
|
|
|
|
2004-09-30 23:55:55 +02:00
|
|
|
#define SPARC_ST_OP(name, op) \
|
|
|
|
void OPPROTO glue(glue(op_, name), MEMSUFFIX)(void) \
|
|
|
|
{ \
|
2005-01-04 00:43:32 +01:00
|
|
|
glue(op, MEMSUFFIX)(T0, T1); \
|
2004-09-30 23:55:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
SPARC_LD_OP(ld, ldl);
|
|
|
|
SPARC_LD_OP(ldub, ldub);
|
|
|
|
SPARC_LD_OP(lduh, lduw);
|
2005-07-02 16:31:34 +02:00
|
|
|
SPARC_LD_OP_S(ldsb, ldsb);
|
|
|
|
SPARC_LD_OP_S(ldsh, ldsw);
|
2004-09-30 23:55:55 +02:00
|
|
|
|
|
|
|
/*** Integer store ***/
|
|
|
|
SPARC_ST_OP(st, stl);
|
|
|
|
SPARC_ST_OP(stb, stb);
|
|
|
|
SPARC_ST_OP(sth, stw);
|
|
|
|
|
|
|
|
void OPPROTO glue(op_std, MEMSUFFIX)(void)
|
|
|
|
{
|
2005-01-04 00:43:32 +01:00
|
|
|
glue(stl, MEMSUFFIX)(T0, T1);
|
|
|
|
glue(stl, MEMSUFFIX)((T0 + 4), T2);
|
2004-09-30 23:55:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO glue(op_ldstub, MEMSUFFIX)(void)
|
|
|
|
{
|
2005-01-04 00:43:32 +01:00
|
|
|
T1 = glue(ldub, MEMSUFFIX)(T0);
|
|
|
|
glue(stb, MEMSUFFIX)(T0, 0xff); /* XXX: Should be Atomically */
|
2004-09-30 23:55:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO glue(op_swap, MEMSUFFIX)(void)
|
|
|
|
{
|
2005-01-30 23:39:04 +01:00
|
|
|
target_ulong tmp = glue(ldl, MEMSUFFIX)(T0);
|
2005-01-04 00:43:32 +01:00
|
|
|
glue(stl, MEMSUFFIX)(T0, T1); /* XXX: Should be Atomically */
|
2004-09-30 23:55:55 +02:00
|
|
|
T1 = tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO glue(op_ldd, MEMSUFFIX)(void)
|
|
|
|
{
|
2005-01-04 00:43:32 +01:00
|
|
|
T1 = glue(ldl, MEMSUFFIX)(T0);
|
|
|
|
T0 = glue(ldl, MEMSUFFIX)((T0 + 4));
|
2004-09-30 23:55:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** Floating-point store ***/
|
|
|
|
void OPPROTO glue(op_stf, MEMSUFFIX) (void)
|
|
|
|
{
|
2005-01-04 00:43:32 +01:00
|
|
|
glue(stfl, MEMSUFFIX)(T0, FT0);
|
2004-09-30 23:55:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO glue(op_stdf, MEMSUFFIX) (void)
|
|
|
|
{
|
2005-01-04 00:43:32 +01:00
|
|
|
glue(stfq, MEMSUFFIX)(T0, DT0);
|
2004-09-30 23:55:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** Floating-point load ***/
|
|
|
|
void OPPROTO glue(op_ldf, MEMSUFFIX) (void)
|
|
|
|
{
|
2005-01-04 00:43:32 +01:00
|
|
|
FT0 = glue(ldfl, MEMSUFFIX)(T0);
|
2004-09-30 23:55:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO glue(op_lddf, MEMSUFFIX) (void)
|
|
|
|
{
|
2005-01-04 00:43:32 +01:00
|
|
|
DT0 = glue(ldfq, MEMSUFFIX)(T0);
|
2004-09-30 23:55:55 +02:00
|
|
|
}
|
2005-07-02 16:31:34 +02:00
|
|
|
|
|
|
|
#ifdef TARGET_SPARC64
|
|
|
|
/* XXX: Should be Atomically */
|
|
|
|
/* XXX: There are no cas[x] instructions, only cas[x]a */
|
|
|
|
void OPPROTO glue(op_cas, MEMSUFFIX)(void)
|
|
|
|
{
|
|
|
|
uint32_t tmp;
|
|
|
|
|
|
|
|
tmp = glue(ldl, MEMSUFFIX)(T0);
|
|
|
|
T2 &= 0xffffffffULL;
|
|
|
|
if (tmp == (T1 & 0xffffffffULL)) {
|
|
|
|
glue(stl, MEMSUFFIX)(T0, T2);
|
|
|
|
}
|
|
|
|
T2 = tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO glue(op_casx, MEMSUFFIX)(void)
|
|
|
|
{
|
|
|
|
uint64_t tmp;
|
|
|
|
|
|
|
|
// XXX
|
|
|
|
tmp = (uint64_t)glue(ldl, MEMSUFFIX)(T0) << 32;
|
|
|
|
tmp |= glue(ldl, MEMSUFFIX)(T0);
|
|
|
|
if (tmp == T1) {
|
|
|
|
glue(stq, MEMSUFFIX)(T0, T2);
|
|
|
|
}
|
|
|
|
T2 = tmp;
|
|
|
|
}
|
|
|
|
|
2007-07-07 22:50:33 +02:00
|
|
|
void OPPROTO glue(op_lduw, MEMSUFFIX)(void)
|
|
|
|
{
|
|
|
|
T1 = (uint64_t)(glue(ldl, MEMSUFFIX)(T0) & 0xffffffff);
|
|
|
|
}
|
|
|
|
|
2005-07-02 16:31:34 +02:00
|
|
|
void OPPROTO glue(op_ldsw, MEMSUFFIX)(void)
|
|
|
|
{
|
2005-07-23 16:27:54 +02:00
|
|
|
T1 = (int64_t)(glue(ldl, MEMSUFFIX)(T0) & 0xffffffff);
|
2005-07-02 16:31:34 +02:00
|
|
|
}
|
|
|
|
|
2005-07-23 16:27:54 +02:00
|
|
|
SPARC_LD_OP(ldx, ldq);
|
|
|
|
SPARC_ST_OP(stx, stq);
|
2005-07-02 16:31:34 +02:00
|
|
|
#endif
|
2004-09-30 23:55:55 +02:00
|
|
|
#undef MEMSUFFIX
|