summaryrefslogtreecommitdiff
path: root/thunk.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2012-01-31 19:44:41 +0100
committerRiku Voipio <riku.voipio@linaro.org>2012-04-06 18:49:58 +0300
commit6083abd9aa134c9b0804e584f8279f54e6c90a1c (patch)
tree8e142aa5564218708c8670513414c37b8694c473 /thunk.c
parent56e904ecb2018e30b10e9ec846635ff3b1e1d923 (diff)
downloadqemu-6083abd9aa134c9b0804e584f8279f54e6c90a1c.tar.gz
linux-user: add struct old_dev_t compat
The compat LOOP_SET_STATUS ioctl uses struct old_dev_t in its passed struct. That variable type is vastly different between different architectures. Implement wrapping around it so we can use it. This fixes running arm kpartx on an x86_64 host for me. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Diffstat (limited to 'thunk.c')
-rw-r--r--thunk.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/thunk.c b/thunk.c
index 06571889ae..8ebbbb46b6 100644
--- a/thunk.c
+++ b/thunk.c
@@ -46,6 +46,7 @@ static inline const argtype *thunk_type_next(const argtype *type_ptr)
case TYPE_LONG:
case TYPE_ULONG:
case TYPE_PTRVOID:
+ case TYPE_OLDDEVT:
return type_ptr;
case TYPE_PTR:
return thunk_type_next_ptr(type_ptr);
@@ -188,6 +189,33 @@ const argtype *thunk_convert(void *dst, const void *src,
#else
#warning unsupported conversion
#endif
+ case TYPE_OLDDEVT:
+ {
+ uint64_t val = 0;
+ switch (thunk_type_size(type_ptr - 1, !to_host)) {
+ case 2:
+ val = *(uint16_t *)src;
+ break;
+ case 4:
+ val = *(uint32_t *)src;
+ break;
+ case 8:
+ val = *(uint64_t *)src;
+ break;
+ }
+ switch (thunk_type_size(type_ptr - 1, to_host)) {
+ case 2:
+ *(uint16_t *)dst = tswap16(val);
+ break;
+ case 4:
+ *(uint32_t *)dst = tswap32(val);
+ break;
+ case 8:
+ *(uint64_t *)dst = tswap64(val);
+ break;
+ }
+ break;
+ }
case TYPE_ARRAY:
{
int array_length, i, dst_size, src_size;