diff options
-rw-r--r-- | defs.h | 10 | ||||
-rw-r--r-- | mem.c | 2 | ||||
-rw-r--r-- | syscall.c | 16 | ||||
-rw-r--r-- | util.c | 8 |
4 files changed, 20 insertions, 16 deletions
@@ -796,6 +796,10 @@ extern unsigned current_klongsize; # endif #endif +#define ANY_WORDSIZE_LESS_THAN_KERNEL_LONG \ + (SIZEOF_KERNEL_LONG_T > 4 \ + && (SIZEOF_LONG < SIZEOF_KERNEL_LONG_T || !defined(current_wordsize))) + #define DECL_PRINTNUM(name) \ extern bool \ printnum_ ## name(struct tcb *, kernel_ulong_t addr, const char *fmt) \ @@ -864,8 +868,7 @@ DECL_PRINTPAIR(int64); static inline kernel_long_t truncate_klong_to_current_wordsize(const kernel_long_t v) { -#if SIZEOF_KERNEL_LONG_T > 4 \ - && (SIZEOF_LONG < SIZEOF_KERNEL_LONG_T || !defined current_wordsize) +#if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG if (current_wordsize < sizeof(v)) { return (int) v; } else @@ -878,8 +881,7 @@ truncate_klong_to_current_wordsize(const kernel_long_t v) static inline kernel_ulong_t truncate_kulong_to_current_wordsize(const kernel_ulong_t v) { -#if SIZEOF_KERNEL_LONG_T > 4 \ - && (SIZEOF_LONG < SIZEOF_KERNEL_LONG_T || !defined current_wordsize) +#if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG if (current_wordsize < sizeof(v)) { return (unsigned int) v; } else @@ -94,7 +94,7 @@ print_mmap(struct tcb *tcp, kernel_ulong_t *u_arg, unsigned long long offset) SYS_FUNC(old_mmap) { kernel_ulong_t u_arg[6]; -# ifndef current_klongsize +# if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG /* We are here only in a 32-bit personality. */ unsigned int narrow_arg[6]; if (umove_or_printaddr(tcp, tcp->u_arg[0], &narrow_arg)) @@ -901,26 +901,30 @@ trace_syscall_exiting(struct tcb *tcp) else { switch (sys_res & RVAL_MASK) { case RVAL_HEX: -#if SUPPORTED_PERSONALITIES > 1 - if (current_wordsize < sizeof(tcp->u_rval)) +#if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG + if (current_wordsize < sizeof(tcp->u_rval)) { tprintf("= %#x", (unsigned int) tcp->u_rval); - else + } else #endif + { tprintf("= %#" PRI_klx, tcp->u_rval); + } break; case RVAL_OCTAL: tprints("= "); print_numeric_long_umask(tcp->u_rval); break; case RVAL_UDECIMAL: -#if SUPPORTED_PERSONALITIES > 1 - if (current_wordsize < sizeof(tcp->u_rval)) +#if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG + if (current_wordsize < sizeof(tcp->u_rval)) { tprintf("= %u", (unsigned int) tcp->u_rval); - else + } else #endif + { tprintf("= %" PRI_klu, tcp->u_rval); + } break; case RVAL_DECIMAL: tprintf("= %" PRI_kld, tcp->u_rval); @@ -942,7 +942,7 @@ void dumpiov_upto(struct tcb *const tcp, const int len, const kernel_ulong_t addr, kernel_ulong_t data_size) { -#if SUPPORTED_PERSONALITIES > 1 +#if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG union { struct { uint32_t base; uint32_t len; } *iov32; struct { uint64_t base; uint64_t len; } *iov64; @@ -1141,8 +1141,7 @@ umoven(struct tcb *const tcp, kernel_ulong_t addr, unsigned int len, char x[sizeof(long)]; } u; -#if SIZEOF_KERNEL_LONG_T > 4 \ - && (SIZEOF_LONG < SIZEOF_KERNEL_LONG_T || !defined current_wordsize) +#if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG if (current_wordsize < sizeof(addr) && (addr & (~ (kernel_ulong_t) -1U))) { return -1; @@ -1290,8 +1289,7 @@ umovestr(struct tcb *const tcp, kernel_ulong_t addr, unsigned int len, char *lad char x[sizeof(long)]; } u; -#if SIZEOF_KERNEL_LONG_T > 4 \ - && (SIZEOF_LONG < SIZEOF_KERNEL_LONG_T || !defined current_wordsize) +#if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG if (current_wordsize < sizeof(addr) && (addr & (~ (kernel_ulong_t) -1U))) { return -1; |