umove_kulong_array_or_printaddr(struct tcb *tcp, const long addr,
kernel_ulong_t *ptr, size_t n)
{
-#if defined X86_64 || defined X32
- if (current_personality == 1) {
-#else
- if (current_wordsize < sizeof(*ptr)) {
-#endif
+#ifndef current_klongsize
+ if (current_klongsize < sizeof(*ptr)) {
uint32_t ptr32[n];
int r = umove_or_printaddr(tcp, addr, &ptr32);
if (!r) {
}
return r;
}
+#endif /* !current_klongsize */
return umoven_or_printaddr(tcp, addr, n * sizeof(*ptr), ptr);
}
print_lld_from_low_high_val(struct tcb *tcp, int arg)
{
#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
-# if SUPPORTED_PERSONALITIES > 1
-# ifdef X86_64
- if (current_personality != 1)
-# else
- if (current_wordsize == sizeof(long))
-# endif
-# endif
- tprintf("%ld", tcp->u_arg[arg]);
-# if SUPPORTED_PERSONALITIES > 1
- else
+# ifndef current_klongsize
+ if (current_klongsize < SIZEOF_LONG) {
tprintf("%ld", (tcp->u_arg[arg + 1] << current_wordsize * 8)
| tcp->u_arg[arg]);
-# endif
+ } else
+# endif /* !current_klongsize */
+ {
+ tprintf("%ld", tcp->u_arg[arg]);
+ }
#elif SIZEOF_LONG > 4
# error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
#elif HAVE_STRUCT_TCB_EXT_ARG
-# if SUPPORTED_PERSONALITIES > 1
- if (current_personality == 1) {
+# ifndef current_klongsize
+ if (current_klongsize < SIZEOF_LONG_LONG) {
tprintf("%lld",
(zero_extend_signed_to_ull(tcp->u_arg[arg + 1]) << sizeof(long) * 8)
| zero_extend_signed_to_ull(tcp->u_arg[arg]));
} else
-# endif
+# endif /* !current_klongsize */
{
tprintf("%lld", tcp->ext_arg[arg]);
}
printfd(tcp, tcp->u_arg[0]);
long long offset;
-# if SUPPORTED_PERSONALITIES > 1
+# ifndef current_klongsize
/* tcp->ext_arg is not initialized for compat personality */
- if (current_personality == 1) {
+ if (current_klongsize < sizeof(*tcp->ext_arg)) {
offset = (long) tcp->u_arg[1];
} else
-# endif
+# endif /* !current_klongsize */
{
offset = tcp->ext_arg[1];
}
printfd(tcp, tcp->u_arg[0]);
long offset =
-# if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
-# ifdef X86_64
- current_personality == 1 ?
- (long) (int) tcp->u_arg[1] : (long) tcp->u_arg[1];
-# else
- current_wordsize == 4 ?
+# ifndef current_klongsize
+ current_klongsize < sizeof(long) ?
(long) (int) tcp->u_arg[1] : (long) tcp->u_arg[1];
-# endif
# else
tcp->u_arg[1];
# endif
static void
decode_rlimit(struct tcb *tcp, unsigned long addr)
{
-# if defined(X86_64) || defined(X32)
/*
* i386 is the only personality on X86_64 and X32
* with 32-bit rlim_t.
* When current_personality is X32, current_wordsize
* equals to 4 but rlim_t is 64-bit.
*/
- if (current_personality == 1)
-# else
- if (current_wordsize == 4)
-# endif
+ if (current_klongsize == 4)
print_rlimit32(tcp, addr);
else
print_rlimit64(tcp, addr);
/* Linux kernel defines MAX_ERRNO to 4095. */
kernel_ulong_t max = -(kernel_long_t) 4095;
-#if defined X86_64 || defined X32
- /*
- * current_wordsize is 4 for x32 personality
- * but truncation _must not_ be done in it, so
- * check current_personality instead.
- */
- if (current_personality == 1) {
- val = (uint32_t) val;
- max = (uint32_t) max;
- }
-#elif SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
- if (current_wordsize < sizeof(val)) {
+#ifndef current_klongsize
+ if (current_klongsize < sizeof(val)) {
val = (uint32_t) val;
max = (uint32_t) max;
}
-#endif
+#endif /* !current_klongsize */
return val >= max;
}
getllval(struct tcb *tcp, unsigned long long *val, int arg_no)
{
#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
-# if SUPPORTED_PERSONALITIES > 1
-# ifdef X86_64
- if (current_personality != 1) {
-# else
- if (current_wordsize > 4) {
-# endif
-# endif
- *val = tcp->u_arg[arg_no];
- arg_no++;
-# if SUPPORTED_PERSONALITIES > 1
- } else {
+# ifndef current_klongsize
+ if (current_klongsize < SIZEOF_LONG) {
# if defined(AARCH64) || defined(POWERPC64)
/* Align arg_no to the next even number. */
arg_no = (arg_no + 1) & 0xe;
# endif /* AARCH64 || POWERPC64 */
*val = LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]);
arg_no += 2;
+ } else
+# endif /* !current_klongsize */
+ {
+ *val = tcp->u_arg[arg_no];
+ arg_no++;
}
-# endif /* SUPPORTED_PERSONALITIES > 1 */
#elif SIZEOF_LONG > 4
# error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
#elif HAVE_STRUCT_TCB_EXT_ARG
-# if SUPPORTED_PERSONALITIES > 1
- if (current_personality == 1) {
+# ifndef current_klongsize
+ if (current_klongsize < SIZEOF_LONG_LONG) {
*val = LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]);
arg_no += 2;
} else
-# endif
+# endif /* !current_klongsize */
{
*val = tcp->ext_arg[arg_no];
arg_no++;
getarg_klu(struct tcb *tcp, int argn)
{
#if HAVE_STRUCT_TCB_EXT_ARG
-# if SUPPORTED_PERSONALITIES > 1
- if (current_personality == 1)
+# ifndef current_klongsize
+ if (current_klongsize < sizeof(*tcp->ext_arg)) {
return tcp->u_arg[argn];
- else
-# endif
- return tcp->ext_arg[argn];
+ } else
+# endif /* !current_klongsize */
+ {
+ return tcp->ext_arg[argn];
+ }
#else
return tcp->u_arg[argn];
#endif