aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-11-02 20:24:22 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-11-02 20:24:22 +0000
commit89343ecde51e7c287e8647a13f9e18f68a37c87c (patch)
treea6f99d2b33632d338b460ea70e446fa9dbcdbaff
parent80210bcd719c615d3ae9cd851e9e961bac722538 (diff)
EFAULT - update __get_user() __put_user(), by Thayne Harbaugh.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3508 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--linux-user/qemu.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index bcc0b34f36..d0f650edaa 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -206,22 +206,22 @@ int target_msync(abi_ulong start, abi_ulong len, int flags);
#define access_ok(type,addr,size) \
(page_check_range((target_ulong)addr,size,(type==VERIFY_READ)?PAGE_READ:PAGE_WRITE)==0)
-/* NOTE get_user and put_user use host addresses. */
-#define __put_user(x,ptr)\
+/* NOTE __get_user and __put_user use host pointers and don't check access. */
+#define __put_user(x, hptr)\
({\
- int size = sizeof(*ptr);\
+ int size = sizeof(*hptr);\
switch(size) {\
case 1:\
- *(uint8_t *)(ptr) = (typeof(*ptr))(x);\
+ *(uint8_t *)(hptr) = (typeof(*hptr))(x);\
break;\
case 2:\
- *(uint16_t *)(ptr) = tswap16((typeof(*ptr))(x));\
+ *(uint16_t *)(hptr) = tswap16((typeof(*hptr))(x));\
break;\
case 4:\
- *(uint32_t *)(ptr) = tswap32((typeof(*ptr))(x));\
+ *(uint32_t *)(hptr) = tswap32((typeof(*hptr))(x));\
break;\
case 8:\
- *(uint64_t *)(ptr) = tswap64((typeof(*ptr))(x));\
+ *(uint64_t *)(hptr) = tswap64((typeof(*hptr))(x));\
break;\
default:\
abort();\
@@ -229,21 +229,21 @@ int target_msync(abi_ulong start, abi_ulong len, int flags);
0;\
})
-#define __get_user(x, ptr) \
+#define __get_user(x, hptr) \
({\
- int size = sizeof(*ptr);\
+ int size = sizeof(*hptr);\
switch(size) {\
case 1:\
- x = (typeof(*ptr))*(uint8_t *)(ptr);\
+ x = (typeof(*hptr))*(uint8_t *)(hptr);\
break;\
case 2:\
- x = (typeof(*ptr))tswap16(*(uint16_t *)(ptr));\
+ x = (typeof(*hptr))tswap16(*(uint16_t *)(hptr));\
break;\
case 4:\
- x = (typeof(*ptr))tswap32(*(uint32_t *)(ptr));\
+ x = (typeof(*hptr))tswap32(*(uint32_t *)(hptr));\
break;\
case 8:\
- x = (typeof(*ptr))tswap64(*(uint64_t *)(ptr));\
+ x = (typeof(*hptr))tswap64(*(uint64_t *)(hptr));\
break;\
default:\
abort();\