From 88b3808b6ce58165aa4c526eafca3dc08daf8f88 Mon Sep 17 00:00:00 2001 From: jistone Date: Tue, 6 Feb 2007 22:55:59 +0000 Subject: 2007-02-06 Josh Stone runtime/ * loc2c-runtime.h (kread): Let it work with const types. testsuite/ * systemtap.base/deref.stp: Test kread with const sources. --- runtime/loc2c-runtime.h | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'runtime/loc2c-runtime.h') 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) \ ({ \ -- cgit