mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-23 11:39:53 +00:00
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
This commit is contained in:
parent
6a3b9cc9c5
commit
70499c989f
28
thunk.c
28
thunk.c
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user