diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2013-01-31 12:50:40 +0000 |
|---|---|---|
| committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-02-06 16:37:39 -0600 |
| commit | 0bc8ce9460c1f51211e797a825432e55327b70c6 (patch) | |
| tree | 399f562d9eefef192235df41aacdc1fac0a090d0 /linux-user/qemu.h | |
| parent | f565235b71b7be66f3f6b385a5377969f5ed26f7 (diff) | |
| download | focaccia-qemu-0bc8ce9460c1f51211e797a825432e55327b70c6.tar.gz focaccia-qemu-0bc8ce9460c1f51211e797a825432e55327b70c6.zip | |
linux-user: Restore cast to target type in get_user()
Commit 658f2dc97 accidentally dropped the cast to the target type of the value loaded by get_user(). The most visible effect of this would be that the sequence "uint64_t v; get_user_u32(v, addr)" would sign extend the 32 bit loaded value into v rather than zero extending as would be expected for a _u32 accessor. Put the cast back again to restore the old behaviour. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'linux-user/qemu.h')
| -rw-r--r-- | linux-user/qemu.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 31a220af81..b10e9572a9 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -306,12 +306,12 @@ static inline int access_ok(int type, abi_ulong addr, abi_ulong size) ((hptr), (x)), 0) #define __get_user_e(x, hptr, e) \ - ((x) = \ + ((x) = (typeof(*hptr))( \ __builtin_choose_expr(sizeof(*(hptr)) == 1, ldub_p, \ __builtin_choose_expr(sizeof(*(hptr)) == 2, lduw_##e##_p, \ __builtin_choose_expr(sizeof(*(hptr)) == 4, ldl_##e##_p, \ __builtin_choose_expr(sizeof(*(hptr)) == 8, ldq_##e##_p, abort)))) \ - (hptr), 0) + (hptr)), 0) #ifdef TARGET_WORDS_BIGENDIAN # define __put_user(x, hptr) __put_user_e(x, hptr, be) |