summaryrefslogtreecommitdiffstats
path: root/runtime/loc2c-runtime.h
diff options
context:
space:
mode:
authorjistone <jistone>2007-02-06 22:55:59 +0000
committerjistone <jistone>2007-02-06 22:55:59 +0000
commit88b3808b6ce58165aa4c526eafca3dc08daf8f88 (patch)
treeebbc6c1deee029efbb2134a4d2361b2653e9f9fe /runtime/loc2c-runtime.h
parentf902d9596b3f7ee135d180ec0bae01c05d9a97bd (diff)
downloadsystemtap-steved-88b3808b6ce58165aa4c526eafca3dc08daf8f88.tar.gz
systemtap-steved-88b3808b6ce58165aa4c526eafca3dc08daf8f88.tar.xz
systemtap-steved-88b3808b6ce58165aa4c526eafca3dc08daf8f88.zip
2007-02-06 Josh Stone <joshua.i.stone@intel.com>
runtime/ * loc2c-runtime.h (kread): Let it work with const types. testsuite/ * systemtap.base/deref.stp: Test kread with const sources.
Diffstat (limited to 'runtime/loc2c-runtime.h')
-rw-r--r--runtime/loc2c-runtime.h16
1 files changed, 6 insertions, 10 deletions
diff --git a/runtime/loc2c-runtime.h b/runtime/loc2c-runtime.h
index 7ed9d415..8ccc9826 100644
--- a/runtime/loc2c-runtime.h
+++ b/runtime/loc2c-runtime.h
@@ -467,16 +467,12 @@
/* x86 can't do 8-byte put/get_user_asm, so we have to split it */
-#define kread(ptr) \
- ({ \
- union { typeof(*(ptr)) v; u32 l[2]; } _kr; \
- if (sizeof(*(ptr)) == 8) { \
- _kr.l[0] = (u32) deref(4, &((u32 *)(ptr))[0]); \
- _kr.l[1] = (u32) deref(4, &((u32 *)(ptr))[1]); \
- } else \
- _kr.v = (typeof(*(ptr))) deref(sizeof(*(ptr)), (ptr)); \
- _kr.v; \
- })
+#define kread(ptr) \
+ ((sizeof(*(ptr)) == 8) ? \
+ *(typeof(ptr))&(u32[2]) { \
+ (u32) deref(4, &((u32 *)(ptr))[0]), \
+ (u32) deref(4, &((u32 *)(ptr))[1]) } \
+ : (typeof(*(ptr))) deref(sizeof(*(ptr)), (ptr)))
#define kwrite(ptr, value) \
({ \