diff options
author | H.J. Lu <hongjiu.lu@intel.com> | 2012-04-16 13:00:01 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2012-04-16 13:00:01 +0200 |
commit | 35be58119e3727a694d8c9f9b83f372401fcc4c0 (patch) | |
tree | 779d300f7d1cd8bc1056e1d47afc2265e15501b6 /process.c | |
parent | dd0130b963151e37cffc8b593bebe3e3de58dfd4 (diff) | |
download | strace-35be58119e3727a694d8c9f9b83f372401fcc4c0.tar.gz strace-35be58119e3727a694d8c9f9b83f372401fcc4c0.tar.bz2 strace-35be58119e3727a694d8c9f9b83f372401fcc4c0.tar.xz |
Add x32 support to strace
X32 support is added to Linux kernel 3.4. In a nutshell, x32 is x86-64 with
32bit pointers. At system call level, x32 is also identical to x86-64,
as shown by many changes like "defined(X86_64) || defined(X32)". The
main differerence bewteen x32 and x86-64 is off_t in x32 is long long
instead of long.
This patch adds x32 support to strace. Tested on Linux/x32.
* configure.ac: Support X32.
* defs.h: Set SUPPORTED_PERSONALITIES to 3 for X86_64,
Set PERSONALITY2_WORDSIZE to 4 for X86_64.
Add tcb::ext_arg for X32.
* file.c (stat): New for X32.
(sys_lseek): Use 64-bit version for X32.
(printstat64): Check current_personality != 1 for X86_64.
* ipc.c (indirect_ipccall): Check current_personality == 1
for X86_64.
* mem.c (sys_mmap64): Also use tcp->u_arg for X32. Print NULL
for zero address. Call printllval for offset for X32.
* pathtrace.c (pathtrace_match): Don't check sys_old_mmap for
X32.
* process.c (ARG_FLAGS): Defined for X32.
(ARG_STACK): Likewise.
(ARG_PTID): Likewise.
(change_syscall): Handle X32.
(struct_user_offsets): Support X32.
(sys_arch_prctl): Likewise.
* signal.c: Include <asm/sigcontext.h> for X32.
(SA_RESTORER): Also define for X32.
* syscall.c (update_personality): Support X32 for X86_64.
(is_restart_error): Likewise.
(syscall_fixup_on_sysenter): Likewise.
(get_syscall_args): Likewise.
(get_syscall_result): Likewise.
(get_error): Likewise.
(__X32_SYSCALL_BIT): Define if not defined.
(__X32_SYSCALL_MASK): Likewise.
(get_scno): Check DS register value for X32. Use
__X32_SYSCALL_MASK on X32 system calls.
* util.c (printllval): Use ext_arg for X32.
(printcall): Support X32.
(change_syscall): Likewise.
(arg0_offset): Likewise.
(arg1_offset): Likewise.
* Makefile.am (EXTRA_DIST): Add linux/x32/errnoent.h,
linux/x32/ioctlent.h.in, linux/x32/signalent.h,
linux/x32/syscallent.h, linux/x86_64/errnoent2.h,
linux/x86_64/ioctlent2.h, linux/x86_64/signalent2.h and
linux/x86_64/syscallent2.h.
* linux/x32/errnoent.h: New.
* linux/x32/ioctlent.h.in: Likewise.
* linux/x32/signalent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/errnoent2.h: Likewise.
* linux/x86_64/ioctlent2.h: Likewise.
* linux/x86_64/signalent2.h: Likewise.
* linux/x86_64/syscallent2.h: Likewise.
Signed-off-by: H.J. Lu <hongjiu.lu@intel.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'process.c')
-rw-r--r-- | process.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -465,7 +465,7 @@ extern void print_ldt_entry(); # define ARG_PTID 2 # define ARG_CTID 3 # define ARG_TLS 4 -#elif defined X86_64 || defined ALPHA +#elif defined X86_64 || defined X32 || defined ALPHA # define ARG_FLAGS 0 # define ARG_STACK 1 # define ARG_PTID 2 @@ -1589,7 +1589,7 @@ const struct xlat struct_user_offsets[] = { { 4*EFL, "4*EFL" }, { 4*UESP, "4*UESP" }, { 4*SS, "4*SS" }, -#elif defined(X86_64) +#elif defined(X86_64) || defined(X32) { 8*R15, "8*R15" }, { 8*R14, "8*R14" }, { 8*R13, "8*R13" }, @@ -2124,7 +2124,7 @@ const struct xlat struct_user_offsets[] = { # if !defined(S390) && !defined(S390X) && !defined(MIPS) && !defined(SPARC64) && !defined(AVR32) && !defined(BFIN) && !defined(TILE) { uoff(u_fpvalid), "offsetof(struct user, u_fpvalid)" }, # endif -# if defined(I386) || defined(X86_64) +# if defined(I386) || defined(X86_64) || defined(X32) { uoff(i387), "offsetof(struct user, i387)" }, # endif # if defined(M68K) @@ -2154,7 +2154,7 @@ const struct xlat struct_user_offsets[] = { # endif { uoff(magic), "offsetof(struct user, magic)" }, { uoff(u_comm), "offsetof(struct user, u_comm)" }, -# if defined(I386) || defined(X86_64) +# if defined(I386) || defined(X86_64) || defined(X32) { uoff(u_debugreg), "offsetof(struct user, u_debugreg)" }, # endif #endif /* !defined(many arches) */ @@ -2566,7 +2566,7 @@ sys_sched_rr_get_interval(struct tcb *tcp) return 0; } -#ifdef X86_64 +#if defined X86_64 || defined X32 # include <asm/prctl.h> static const struct xlat archvals[] = { @@ -2600,7 +2600,7 @@ sys_arch_prctl(struct tcb *tcp) } return 0; } -#endif /* X86_64 */ +#endif /* X86_64 || X32 */ int sys_getcpu(struct tcb *tcp) |