diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2005-04-23 18:16:07 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2005-04-23 18:16:07 +0000 |
commit | 111bfab3b5c6a47a7182e095647e6a5e0e17feb8 (patch) | |
tree | 7ff41315c47fc137d03a92d42acc7333965544f0 /target-ppc/op_helper_mem.h | |
parent | c7d344af8fb308975f941de1640b917e1b085a81 (diff) | |
download | qemu-111bfab3b5c6a47a7182e095647e6a5e0e17feb8.zip qemu-111bfab3b5c6a47a7182e095647e6a5e0e17feb8.tar.gz qemu-111bfab3b5c6a47a7182e095647e6a5e0e17feb8.tar.bz2 |
This patch adds little-endian mode support to PPC emulation.
This is needed by OS/2 and Windows NT and some programs like VirtualPC.
This patch has been tested using OS/2 bootloader (thanks to Tero
Kaarlela).
(Jocelyn Mayer)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1379 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-ppc/op_helper_mem.h')
-rw-r--r-- | target-ppc/op_helper_mem.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/target-ppc/op_helper_mem.h b/target-ppc/op_helper_mem.h index 85ac911..fa7f076 100644 --- a/target-ppc/op_helper_mem.h +++ b/target-ppc/op_helper_mem.h @@ -40,4 +40,53 @@ void glue(do_stsw, MEMSUFFIX) (int src) } } +void glue(do_lsw_le, 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) { + tmp = glue(ldl, MEMSUFFIX)(T0); + ugpr(dst++) = ((tmp & 0xFF000000) >> 24) | ((tmp & 0x00FF0000) >> 8) | + ((tmp & 0x0000FF00) << 8) | ((tmp & 0x000000FF) << 24); + if (dst == 32) + dst = 0; + } + if (T1 > 0) { + tmp = 0; + for (sh = 0; T1 > 0; T1--, T0++, sh += 8) { + tmp |= glue(ldub, MEMSUFFIX)(T0) << sh; + } + ugpr(dst) = tmp; + } +} + +void glue(do_stsw_le, MEMSUFFIX) (int src) +{ + uint32_t tmp; + 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) { + tmp = ((ugpr(src++) & 0xFF000000) >> 24); + tmp |= ((ugpr(src++) & 0x00FF0000) >> 8); + tmp |= ((ugpr(src++) & 0x0000FF00) << 8); + tmp |= ((ugpr(src++) & 0x000000FF) << 24); + glue(stl, MEMSUFFIX)(T0, tmp); + if (src == 32) + src = 0; + } + if (T1 > 0) { + for (sh = 0; T1 > 0; T1--, T0++, sh += 8) + glue(stb, MEMSUFFIX)(T0, (ugpr(src) >> sh) & 0xFF); + } +} + #undef MEMSUFFIX |