op_helper_mem.h 1.0 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
void glue(do_lsw, MEMSUFFIX) (int dst)
{
    uint32_t tmp;
    int sh;

    if (loglevel > 0) {
        fprintf(logfile, "%s: addr=0x%08x count=%d reg=%d\n",
                __func__, T0, T1, dst);
    }
    for (; T1 > 3; T1 -= 4, T0 += 4) {
11
        ugpr(dst++) = glue(ldl, MEMSUFFIX)((void *)T0);
12 13 14 15 16 17
        if (dst == 32)
            dst = 0;
    }
    if (T1 > 0) {
        tmp = 0;
        for (sh = 24; T1 > 0; T1--, T0++, sh -= 8) {
18
            tmp |= glue(ldub, MEMSUFFIX)((void *)T0) << sh;
19 20 21 22 23 24 25 26 27 28 29 30 31 32
        }
        ugpr(dst) = tmp;
    }
}

void glue(do_stsw, MEMSUFFIX) (int src)
{
    int sh;

    if (loglevel > 0) {
        fprintf(logfile, "%s: addr=0x%08x count=%d reg=%d\n",
                __func__, T0, T1, src);
    }
    for (; T1 > 3; T1 -= 4, T0 += 4) {
33
        glue(stl, MEMSUFFIX)((void *)T0, ugpr(src++));
34 35 36 37 38
        if (src == 32)
            src = 0;
    }
    if (T1 > 0) {
        for (sh = 24; T1 > 0; T1--, T0++, sh -= 8)
39
            glue(stb, MEMSUFFIX)((void *)T0, (ugpr(src) >> sh) & 0xFF);
40 41 42 43
    }
}

#undef MEMSUFFIX