uint16_t err;
};
-#if defined LINUX_MIPSN32 || defined X32
-# define HAVE_STRUCT_TCB_EXT_ARG 1
-#else
-# define HAVE_STRUCT_TCB_EXT_ARG 0
-#endif
-
/* Trace Control Block */
struct tcb {
int flags; /* See below for TCB_ values */
unsigned long u_error; /* Error code */
kernel_ulong_t scno; /* System call number */
kernel_ulong_t u_arg[MAX_ARGS]; /* System call arguments */
-#if HAVE_STRUCT_TCB_EXT_ARG
- unsigned long long ext_arg[MAX_ARGS];
- long long u_lrval; /* long long return value */
-#endif
kernel_long_t u_rval; /* Return value */
#if SUPPORTED_PERSONALITIES > 1
unsigned int currpers; /* Personality at the time of scno update */
#define RVAL_HEX 001 /* hex format */
#define RVAL_OCTAL 002 /* octal format */
#define RVAL_UDECIMAL 003 /* unsigned decimal format */
-#if HAVE_STRUCT_TCB_EXT_ARG
-# if 0 /* unused so far */
-# define RVAL_LDECIMAL 004 /* long decimal format */
-# define RVAL_LHEX 005 /* long hex format */
-# define RVAL_LOCTAL 006 /* long octal format */
-# endif
-# define RVAL_LUDECIMAL 007 /* long unsigned decimal format */
-#endif /* HAVE_STRUCT_TCB_EXT_ARG */
#define RVAL_FD 010 /* file descriptor */
-#define RVAL_MASK 017 /* mask for these values */
+#define RVAL_MASK 013 /* mask for these values */
#define RVAL_STR 020 /* Print `auxstr' field after return val */
#define RVAL_NONE 040 /* Print nothing */
}
#elif SIZEOF_LONG > 4
# error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
-#elif HAVE_STRUCT_TCB_EXT_ARG
+#elif SIZEOF_KERNEL_LONG_T > SIZEOF_LONG
# ifndef current_klongsize
if (current_klongsize < SIZEOF_LONG_LONG) {
tprintf("%lld",
} else
# endif /* !current_klongsize */
{
- tprintf("%lld", tcp->ext_arg[arg]);
+ tprintf("%" PRI_kld, tcp->u_arg[arg]);
}
-#else /* SIZEOF_LONG_LONG > SIZEOF_LONG && !HAVE_STRUCT_TCB_EXT_ARG */
+#else /* SIZEOF_LONG_LONG > SIZEOF_LONG && SIZEOF_KERNEL_LONG_T == SIZEOF_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]));
tcp->u_error = mips_REG_V0;
} else {
tcp->u_rval = mips_REG_V0;
-#ifdef LINUX_MIPSN32
- /* tcp->u_rval contains a truncated value */
- tcp->u_lrval = mips_REG_V0;
-#endif
}
}
static int
get_syscall_args(struct tcb *tcp)
{
-#if defined LINUX_MIPSN64
+#if defined LINUX_MIPSN64 || defined LINUX_MIPSN32
tcp->u_arg[0] = mips_REG_A0;
tcp->u_arg[1] = mips_REG_A1;
tcp->u_arg[2] = mips_REG_A2;
tcp->u_arg[3] = mips_REG_A3;
tcp->u_arg[4] = mips_REG_A4;
tcp->u_arg[5] = mips_REG_A5;
-#elif defined LINUX_MIPSN32
- tcp->u_arg[0] = tcp->ext_arg[0] = mips_REG_A0;
- tcp->u_arg[1] = tcp->ext_arg[1] = mips_REG_A1;
- tcp->u_arg[2] = tcp->ext_arg[2] = mips_REG_A2;
- tcp->u_arg[3] = tcp->ext_arg[3] = mips_REG_A3;
- tcp->u_arg[4] = tcp->ext_arg[4] = mips_REG_A4;
- tcp->u_arg[5] = tcp->ext_arg[5] = mips_REG_A5;
#elif defined LINUX_MIPSO32
tcp->u_arg[0] = mips_REG_A0;
tcp->u_arg[1] = mips_REG_A1;
tcp->u_error = -rax;
} else {
tcp->u_rval = rax;
-#ifdef X32
- /* tcp->u_rval contains a truncated value */
- tcp->u_lrval = rax;
-#endif
}
}
* Use widen_to_long(tcp->u_arg[N]) in syscall handlers
* if you need to use *sign-extended* parameter.
*/
-#ifdef X32
- tcp->u_arg[0] = tcp->ext_arg[0] = (uint32_t) x86_64_regs.rdi;
- tcp->u_arg[1] = tcp->ext_arg[1] = (uint32_t) x86_64_regs.rsi;
- tcp->u_arg[2] = tcp->ext_arg[2] = (uint32_t) x86_64_regs.rdx;
- tcp->u_arg[3] = tcp->ext_arg[3] = (uint32_t) x86_64_regs.r10;
- tcp->u_arg[4] = tcp->ext_arg[4] = (uint32_t) x86_64_regs.r8;
- tcp->u_arg[5] = tcp->ext_arg[5] = (uint32_t) x86_64_regs.r9;
-#else
tcp->u_arg[0] = (uint32_t) x86_64_regs.rdi;
tcp->u_arg[1] = (uint32_t) x86_64_regs.rsi;
tcp->u_arg[2] = (uint32_t) x86_64_regs.rdx;
tcp->u_arg[3] = (uint32_t) x86_64_regs.r10;
tcp->u_arg[4] = (uint32_t) x86_64_regs.r8;
tcp->u_arg[5] = (uint32_t) x86_64_regs.r9;
-#endif
} else {
-#ifdef X32
- tcp->u_arg[0] = tcp->ext_arg[0] = x86_64_regs.rdi;
- tcp->u_arg[1] = tcp->ext_arg[1] = x86_64_regs.rsi;
- tcp->u_arg[2] = tcp->ext_arg[2] = x86_64_regs.rdx;
- tcp->u_arg[3] = tcp->ext_arg[3] = x86_64_regs.r10;
- tcp->u_arg[4] = tcp->ext_arg[4] = x86_64_regs.r8;
- tcp->u_arg[5] = tcp->ext_arg[5] = x86_64_regs.r9;
-#else
tcp->u_arg[0] = x86_64_regs.rdi;
tcp->u_arg[1] = x86_64_regs.rsi;
tcp->u_arg[2] = x86_64_regs.rdx;
tcp->u_arg[3] = x86_64_regs.r10;
tcp->u_arg[4] = x86_64_regs.r8;
tcp->u_arg[5] = x86_64_regs.r9;
-#endif
}
} else {
/*
* which means that on x32 we need to use tcp->ext_arg[N] to get offset argument.
* Use test/x32_lseek.c to test lseek decoding.
*/
-#if HAVE_STRUCT_TCB_EXT_ARG
+#if SIZEOF_KERNEL_LONG_T > SIZEOF_LONG
SYS_FUNC(lseek)
{
printfd(tcp, tcp->u_arg[0]);
long long offset;
# ifndef current_klongsize
- /* tcp->ext_arg is not initialized for compat personality */
- if (current_klongsize < sizeof(*tcp->ext_arg)) {
+ if (current_klongsize < sizeof(*tcp->u_arg)) {
offset = (long) tcp->u_arg[1];
} else
# endif /* !current_klongsize */
{
- offset = tcp->ext_arg[1];
+ offset = tcp->u_arg[1];
}
int whence = tcp->u_arg[2];
tprintf(", %lld, ", offset);
printxval(whence_codes, whence, "SEEK_???");
- return RVAL_DECODED | RVAL_LUDECIMAL;
+ return RVAL_DECODED | RVAL_UDECIMAL;
}
#else
SYS_FUNC(lseek)
/* Params are passed directly, offset is in bytes */
SYS_FUNC(mmap)
{
- unsigned long long offset =
-#if HAVE_STRUCT_TCB_EXT_ARG
- tcp->ext_arg[5]; /* try test/x32_mmap.c */
-#else
- tcp->u_arg[5];
-#endif
/* Example of kernel-side handling of this variety of mmap:
* arch/x86/kernel/sys_x86_64.c::SYSCALL_DEFINE6(mmap, ...) calls
* sys_mmap_pgoff(..., off >> PAGE_SHIFT); i.e. off is in bytes,
* since the above code converts off to pages.
*/
- print_mmap(tcp, tcp->u_arg, offset);
+ print_mmap(tcp, tcp->u_arg, tcp->u_arg[5]);
return RVAL_DECODED | RVAL_HEX;
}
else
tprintf("= %" PRI_kld, tcp->u_rval);
break;
-#if HAVE_STRUCT_TCB_EXT_ARG
- /*
- case RVAL_LHEX:
- tprintf("= %#llx", tcp->u_lrval);
- break;
- case RVAL_LOCTAL:
- tprintf("= %#llo", tcp->u_lrval);
- break;
- */
- case RVAL_LUDECIMAL:
- tprintf("= %llu", tcp->u_lrval);
- break;
- /*
- case RVAL_LDECIMAL:
- tprintf("= %lld", tcp->u_lrval);
- break;
- */
-#endif /* HAVE_STRUCT_TCB_EXT_ARG */
default:
error_msg("invalid rval format");
break;
zero_extend_signed_to_ull(tbuf.tms_cstime));
}
- return syserror(tcp) ? RVAL_DECIMAL :
-#if defined(RVAL_LUDECIMAL) && !defined(IN_MPERS)
- RVAL_LUDECIMAL;
-#else
- RVAL_UDECIMAL;
-#endif
+ return syserror(tcp) ? RVAL_DECIMAL : RVAL_UDECIMAL;
}
}
#elif SIZEOF_LONG > 4
# error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
-#elif HAVE_STRUCT_TCB_EXT_ARG
+#elif SIZEOF_KERNEL_LONG_T > SIZEOF_LONG
# ifndef current_klongsize
- if (current_klongsize < SIZEOF_LONG_LONG) {
+ if (current_klongsize < SIZEOF_KERNEL_LONG_T) {
*val = ULONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]);
arg_no += 2;
} else
# endif /* !current_klongsize */
{
- *val = tcp->ext_arg[arg_no];
+ *val = tcp->u_arg[arg_no];
arg_no++;
}
#else