diff options
author | 2007-11-11 19:31:34 +0000 | |
---|---|---|
committer | 2007-11-11 19:31:34 +0000 | |
commit | 70499c989f434cba8bc2104da9f6ca162c4a937b (patch) | |
tree | 44b2fb2202f1f241c78590fb7576834121b5c8b5 /thunk.c | |
parent | Add SPARCserver 600MP emulation (original patch by Robert Reif) (diff) | |
download | qemu-kvm-70499c989f434cba8bc2104da9f6ca162c4a937b.tar.gz qemu-kvm-70499c989f434cba8bc2104da9f6ca162c4a937b.tar.bz2 qemu-kvm-70499c989f434cba8bc2104da9f6ca162c4a937b.zip |
better than nothing 64 bit support - added sign extension for TYPE_LONG
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3605 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'thunk.c')
-rw-r--r-- | thunk.c | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -147,11 +147,37 @@ const argtype *thunk_convert(void *dst, const void *src, case TYPE_ULONG: case TYPE_PTRVOID: if (to_host) { - *(uint64_t *)dst = tswap32(*(uint32_t *)src); + if (type == TYPE_LONG) { + /* sign extension */ + *(uint64_t *)dst = (int32_t)tswap32(*(uint32_t *)src); + } else { + *(uint64_t *)dst = tswap32(*(uint32_t *)src); + } } else { *(uint32_t *)dst = tswap32(*(uint64_t *)src & 0xffffffff); } break; +#elif HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 64 + case TYPE_LONG: + case TYPE_ULONG: + case TYPE_PTRVOID: + *(uint64_t *)dst = tswap64(*(uint64_t *)src); + break; +#elif HOST_LONG_BITS == 32 && TARGET_ABI_BITS == 64 + case TYPE_LONG: + case TYPE_ULONG: + case TYPE_PTRVOID: + if (to_host) { + *(uint32_t *)dst = tswap64(*(uint64_t *)src); + } else { + if (type == TYPE_LONG) { + /* sign extension */ + *(uint64_t *)dst = tswap64(*(int32_t *)src); + } else { + *(uint64_t *)dst = tswap64(*(uint32_t *)src); + } + } + break; #else #warning unsupported conversion #endif |