summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/strace
diff options
context:
space:
mode:
authorNitin A Kamble <nitin.a.kamble@intel.com>2012-02-02 21:52:04 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-02-03 15:56:38 +0000
commit14e6b02ceb316490fc102fb86b5f2c263553bbb9 (patch)
tree8e16e88c2dccde67d3b27fa386a5644ddbd85ad5 /meta/recipes-devtools/strace
parente1be40cdd2b641928179f6198d8ccde499ac8c11 (diff)
downloadpoky-14e6b02ceb316490fc102fb86b5f2c263553bbb9.tar.gz
strace: add x32 support
This commits adds a patch to enable x32 support in the strace recipe. (From OE-Core rev: 2042d52ff5425e864740b330adc27c2632cc5dc7) Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/strace')
-rw-r--r--meta/recipes-devtools/strace/strace-4.6/strace-4.6_add_x32_support.patch1242
-rw-r--r--meta/recipes-devtools/strace/strace_4.6.bb3
2 files changed, 1244 insertions, 1 deletions
diff --git a/meta/recipes-devtools/strace/strace-4.6/strace-4.6_add_x32_support.patch b/meta/recipes-devtools/strace/strace-4.6/strace-4.6_add_x32_support.patch
new file mode 100644
index 0000000000..7be9da28b2
--- /dev/null
+++ b/meta/recipes-devtools/strace/strace-4.6/strace-4.6_add_x32_support.patch
@@ -0,0 +1,1242 @@
1Upstream-Status: Pending
2Received this patch from H J Lu.
32012/02/02
4Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
5
6diff --git a/ChangeLog.hjl b/ChangeLog.hjl
7new file mode 100644
8index 0000000..4636de6
9--- /dev/null
10+++ b/ChangeLog.hjl
11@@ -0,0 +1,34 @@
12+2012-02-02 H.J. Lu <hongjiu.lu@intel.com>
13+
14+ * resource.c (RLIM64_INFINITY): Define only if it isn't defined.
15+
16+2012-02-02 H.J. Lu <hongjiu.lu@intel.com>
17+
18+ * count.c (call_summary_pers): Cast to long.
19+ * ipc.c (sys_mq_open): Likewise.
20+ (printmqattr): Likewise.
21+ * quota.c (decode_cmd_data): Likewise.
22+ * resource.c (sys_sysinfo): Likewise.
23+ * time.c (tprint_timex): Likewise.
24+
25+2012-02-02 H.J. Lu <hongjiu.lu@intel.com>
26+
27+ * syscall.c (dumpio): Check sys_pread64 and sys_pwrite64 only if
28+ HAVE_LONG_LONG_OFF_T isn't defined.
29+
30+2012-02-02 H.J. Lu <hongjiu.lu@intel.com>
31+
32+ * io.c (sys_sendfile): Check HAVE_LONG_LONG_OFF_T when printing
33+ offset.
34+
35+2012-02-02 H.J. Lu <hongjiu.lu@intel.com>
36+
37+ * file.c (convertoldstat): Define only if HAVE_LONG_LONG_OFF_T
38+ isn't defined.
39+ (sys_oldstat): Likewise.
40+ (sys_oldfstat): Likewise.
41+ (sys_oldlstat): Likewise.
42+
43+2012-02-02 H.J. Lu <hongjiu.lu@intel.com>
44+
45+ * mem.c (sys_mmap64): Print NULL for zero address.
46diff --git a/ChangeLog.x32 b/ChangeLog.x32
47new file mode 100644
48index 0000000..512fc48
49--- /dev/null
50+++ b/ChangeLog.x32
51@@ -0,0 +1,67 @@
52+2012-02-02 H.J. Lu <hongjiu.lu@intel.com>
53+
54+ * configure.ac: Support X32.
55+
56+ * defs.h (LINUX_X32): New.
57+ (SUPPORTED_PERSONALITIES): Set to 3 for X86_64. Defined to 1
58+ for X32.
59+ (PERSONALITY2_WORDSIZE): Set to 4 for X86_64.
60+ (PERSONALITY0_WORDSIZE): Defined to 4 for X32.
61+ (tcb): Add ext_arg for LINUX_X32.
62+
63+ * file.c (stat): New for X32.
64+ (printstat64): Check current_personality != 1 for X86_64.
65+
66+ * io.c (sys_pread): Defined only if X32 isn't defined.
67+ (sys_pwrite): Likewise.
68+
69+ * ipc.c (indirect_ipccall): Check current_personality == 1
70+ for X86_64.
71+
72+ * mem.c (sys_mmap64): Also use tcp->u_arg for X32. Print NULL
73+ for zero address. Call printllval for offset for X32.
74+
75+ * pathtrace.c (pathtrace_match): Don't check sys_old_mmap for
76+ X32.
77+
78+ * process.c (ARG_FLAGS): Defined for X32.
79+ (ARG_STACK): Likewise.
80+ (ARG_PTID): Likewise.
81+ (change_syscall): Handle X32.
82+ (struct_user_offsets): Support X32.
83+ (sys_arch_prctl): Likewise.
84+
85+ * signal.c: Include <asm/sigcontext.h> for X32.
86+ (SA_RESTORER): Also define for X32.
87+
88+ * syscall.c (rax): Removed.
89+ (x86_64_regs): New.
90+ (__X32_SYSCALL_BIT): Define if not defined.
91+ (__X32_SYSCALL_MASK): Likewise.
92+ (get_scno): Use PTRACE_GETREGS for X86_64 and X32. Check DS
93+ register value for X32. Use __X32_SYSCALL_MASK on X32 system
94+ calls.
95+ (syscall_fixup): Use x86_64_regs.rax and support X32.
96+ (get_error): Likewise.
97+ (force_result): Likewise.
98+ (syscall_enter): Likewise.
99+
100+ * util.c (printllval): Use ext_arg for LINUX_X32.
101+ (printcall): Support X32.
102+ (arg0_offset): Likewise.
103+ (arg1_offset): Likewise.
104+
105+ * Makefile.am (EXTRA_DIST): Add linux/x32/errnoent.h,
106+ linux/x32/ioctlent.h.in, linux/x32/signalent.h,
107+ linux/x32/syscallent.h, linux/x86_64/errnoent2.h,
108+ linux/x86_64/ioctlent2.h, linux/x86_64/signalent2.h and
109+ linux/x86_64/syscallent2.h.
110+
111+ * linux/x32/errnoent.h: New.
112+ * linux/x32/ioctlent.h.in: Likewise.
113+ * linux/x32/signalent.h: Likewise.
114+ * linux/x32/syscallent.h: Likewise.
115+ * linux/x86_64/errnoent2.h: Likewise.
116+ * linux/x86_64/ioctlent2.h: Likewise.
117+ * linux/x86_64/signalent2.h: Likewise.
118+ * linux/x86_64/syscallent2.h: Likewise.
119diff --git a/Makefile.am b/Makefile.am
120index ba19a7d..cf26d78 100644
121--- a/Makefile.am
122+++ b/Makefile.am
123@@ -78,10 +78,14 @@ EXTRA_DIST = $(man_MANS) errnoent.sh signalent.sh syscallent.sh ioctlsort.c \
124 linux/sparc64/syscallent.h linux/sparc64/syscallent1.h \
125 linux/sparc64/syscallent2.h \
126 linux/tile/ioctlent.h.in linux/tile/syscallent.h \
127+ linux/x32/errnoent.h linux/x32/ioctlent.h.in \
128+ linux/x32/signalent.h linux/x32/syscallent.h \
129 linux/x86_64/ioctlent.h.in linux/x86_64/syscallent.h \
130 linux/x86_64/gentab.pl \
131 linux/x86_64/errnoent1.h linux/x86_64/ioctlent1.h \
132 linux/x86_64/signalent1.h linux/x86_64/syscallent1.h \
133+ linux/x86_64/errnoent2.h linux/x86_64/ioctlent2.h \
134+ linux/x86_64/signalent2.h linux/x86_64/syscallent2.h \
135 freebsd/ioctlent.sh \
136 freebsd/syscalls.cat freebsd/syscalls.pl freebsd/syscalls.print \
137 freebsd/i386/errnoent.h freebsd/i386/ioctlent.h \
138diff --git a/configure.ac b/configure.ac
139index 402f088..1458c8e 100644
140--- a/configure.ac
141+++ b/configure.ac
142@@ -8,6 +8,8 @@ AM_INIT_AUTOMAKE([foreign check-news dist-xz no-dist-gzip silent-rules])
143 AM_MAINTAINER_MODE
144 AC_CANONICAL_HOST
145
146+AC_PROG_CC
147+
148 AC_MSG_CHECKING([for supported operating system])
149 case "$host_os" in
150 *linux*)
151@@ -112,8 +114,13 @@ sh*)
152 AC_DEFINE([SH], 1, [Define for the SH architecture.])
153 ;;
154 x86?64*)
155- arch=x86_64
156- AC_DEFINE([X86_64], 1, [Define for the AMD x86-64 architecture.])
157+ if echo __LP64__ | ${CC-cc} $CFLAGS $CPPFLAGS -E - | grep __LP64__ > /dev/null; then
158+ arch=x32
159+ AC_DEFINE([X32], 1, [Define for the 32bit AMD x86-64 architecture.])
160+ else
161+ arch=x86_64
162+ AC_DEFINE([X86_64], 1, [Define for the 64bit AMD x86-64 architecture.])
163+ fi
164 ;;
165 cris|crisv10)
166 arch=crisv10
167@@ -144,11 +151,11 @@ AC_SUBST(arch)
168 AM_CONDITIONAL([LINUX], [test x$opsys = xlinux])
169 AM_CONDITIONAL([I386], [test x$arch = xi386])
170 AM_CONDITIONAL([X86_64], [test x$arch = xx86_64])
171+AM_CONDITIONAL([X32], [test x$arch = xx32])
172 AM_CONDITIONAL([SUNOS4], [test x$opsys = xsunos4])
173 AM_CONDITIONAL([SVR4], [test x$opsys = xsvr4])
174 AM_CONDITIONAL([FREEBSD], [test x$opsys = xfreebsd])
175
176-AC_PROG_CC
177 AC_GNU_SOURCE
178
179 AC_INCLUDEDIR
180diff --git a/count.c b/count.c
181index 92f7849..401ca6b 100644
182--- a/count.c
183+++ b/count.c
184@@ -211,7 +211,7 @@ call_summary_pers(FILE *outf)
185 / tv_float(&tv_cum));
186 fprintf(outf, "%6.2f %11.6f %11ld %9d %9.9s %s\n",
187 percent, tv_float(&counts[j].time),
188- (long) 1000000 * dtv.tv_sec + dtv.tv_usec,
189+ (long) (1000000 * dtv.tv_sec + dtv.tv_usec),
190 counts[j].calls,
191 error_str, sysent[j].sys_name);
192 }
193diff --git a/defs.h b/defs.h
194index 8be668a..6f31164 100644
195--- a/defs.h
196+++ b/defs.h
197@@ -103,6 +103,9 @@
198 # if defined(X86_64)
199 # define LINUX_X86_64
200 # endif
201+# if defined(X32)
202+# define LINUX_X32
203+# endif
204 # if defined(MIPS) && _MIPS_SIM == _MIPS_SIM_ABI32
205 # define LINUX_MIPSO32
206 # endif
207@@ -146,7 +149,8 @@
208 #include <sys/pioctl.h>
209 #endif /* FREEBSD */
210 #else /* !USE_PROCFS */
211-#if (defined(LINUXSPARC) || defined(LINUX_X86_64) || defined(LINUX_ARM) || defined(LINUX_AVR32)) && defined(__GLIBC__)
212+#if (defined(LINUXSPARC) || defined(LINUX_X86_64) || defined(LINUX_X32) \
213+ || defined(LINUX_ARM) || defined(LINUX_AVR32)) && defined(__GLIBC__)
214 #include <sys/ptrace.h>
215 #else
216 /* Work around awkward prototype in ptrace.h. */
217@@ -234,9 +238,16 @@ extern int ptrace(int, int, char *, int, ...);
218
219 #ifdef X86_64
220 #undef SUPPORTED_PERSONALITIES
221-#define SUPPORTED_PERSONALITIES 2
222+#define SUPPORTED_PERSONALITIES 3
223 #define PERSONALITY0_WORDSIZE 8
224 #define PERSONALITY1_WORDSIZE 4
225+#define PERSONALITY2_WORDSIZE 4
226+#endif
227+
228+#ifdef X32
229+#undef SUPPORTED_PERSONALITIES
230+#define SUPPORTED_PERSONALITIES 1
231+#define PERSONALITY0_WORDSIZE 4
232 #endif
233
234 #ifdef ARM
235@@ -346,7 +357,7 @@ struct tcb {
236 long scno; /* System call number */
237 int u_nargs; /* System call arguments */
238 long u_arg[MAX_ARGS]; /* System call arguments */
239-#if defined (LINUX_MIPSN32)
240+#if defined (LINUX_MIPSN32) || defined(LINUX_X32)
241 long long ext_arg[MAX_ARGS]; /* System call arguments */
242 #endif
243 int u_error; /* Error code */
244diff --git a/file.c b/file.c
245index 346f1e7..db09f7b 100644
246--- a/file.c
247+++ b/file.c
248@@ -87,6 +87,29 @@ struct stat_sparc64 {
249 # define stat kernel_stat
250 # include <asm/stat.h>
251 # undef stat
252+# elif defined(X32)
253+struct stat {
254+ unsigned long long st_dev;
255+ unsigned long long st_ino;
256+ unsigned long long st_nlink;
257+
258+ unsigned int st_mode;
259+ unsigned int st_uid;
260+ unsigned int st_gid;
261+ unsigned int __pad0;
262+ unsigned long long st_rdev;
263+ long long st_size;
264+ long long st_blksize;
265+ long long st_blocks;
266+
267+ unsigned long long st_atime;
268+ unsigned long long st_atime_nsec;
269+ unsigned long long st_mtime;
270+ unsigned long long st_mtime_nsec;
271+ unsigned long long st_ctime;
272+ unsigned long long st_ctime_nsec;
273+ long long __unused[3];
274+};
275 # else
276 # undef dev_t
277 # undef ino_t
278@@ -1154,7 +1177,7 @@ printstat64(struct tcb *tcp, long addr)
279 #endif /* LINUXSPARC */
280
281 #if defined LINUX && defined X86_64
282- if (current_personality == 0) {
283+ if (current_personality != 1) {
284 printstat(tcp, addr);
285 return;
286 }
287@@ -1241,7 +1264,8 @@ printstat64(struct tcb *tcp, long addr)
288 }
289 #endif /* HAVE_STAT64 */
290
291-#if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
292+#if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT) \
293+ && !defined(HAVE_LONG_LONG_OFF_T)
294 static void
295 convertoldstat(const struct __old_kernel_stat *oldbuf, struct stat *newbuf)
296 {
297@@ -1358,7 +1382,8 @@ sys_newfstatat(struct tcb *tcp)
298 }
299 #endif
300
301-#if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
302+#if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT) \
303+ && !defined(HAVE_LONG_LONG_OFF_T)
304 int
305 sys_oldstat(struct tcb *tcp)
306 {
307@@ -1402,7 +1427,8 @@ sys_fstat64(struct tcb *tcp)
308 #endif
309 }
310
311-#if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
312+#if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT) \
313+ && !defined(HAVE_LONG_LONG_OFF_T)
314 int
315 sys_oldfstat(struct tcb *tcp)
316 {
317@@ -1446,7 +1472,8 @@ sys_lstat64(struct tcb *tcp)
318 #endif
319 }
320
321-#if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
322+#if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT) \
323+ && !defined(HAVE_LONG_LONG_OFF_T)
324 int
325 sys_oldlstat(struct tcb *tcp)
326 {
327diff --git a/io.c b/io.c
328index 3f8757c..27759bd 100644
329--- a/io.c
330+++ b/io.c
331@@ -277,6 +277,7 @@ sys_sendfile(struct tcb *tcp)
332 #define PREAD_OFFSET_ARG 3
333 #endif
334
335+#if !defined X32
336 int
337 sys_pread(struct tcb *tcp)
338 {
339@@ -306,6 +307,7 @@ sys_pwrite(struct tcb *tcp)
340 }
341 return 0;
342 }
343+#endif
344
345 int
346 sys_sendfile(struct tcb *tcp)
347@@ -322,7 +324,11 @@ sys_sendfile(struct tcb *tcp)
348 else if (umove(tcp, tcp->u_arg[2], &offset) < 0)
349 tprintf("%#lx", tcp->u_arg[2]);
350 else
351+#ifdef HAVE_LONG_LONG_OFF_T
352+ tprintf("[%llu]", offset);
353+#else
354 tprintf("[%lu]", offset);
355+#endif
356 tprintf(", %lu", tcp->u_arg[3]);
357 }
358 return 0;
359diff --git a/ipc.c b/ipc.c
360index 4c902bf..7bbf07b 100644
361--- a/ipc.c
362+++ b/ipc.c
363@@ -188,7 +188,7 @@ struct tcb *tcp;
364 {
365 #ifdef LINUX
366 #ifdef X86_64
367- return current_personality > 0;
368+ return current_personality == 1;
369 #endif
370 #if defined IA64
371 return tcp->scno < 1024; /* ia32 emulation syscalls are low */
372@@ -487,7 +487,8 @@ sys_mq_open(struct tcb *tcp)
373 tprintf("{ ??? }");
374 else
375 tprintf("{mq_maxmsg=%ld, mq_msgsize=%ld}",
376- attr.mq_maxmsg, attr.mq_msgsize);
377+ (long) attr.mq_maxmsg,
378+ (long) attr.mq_msgsize);
379 # endif
380 }
381 }
382@@ -546,7 +547,8 @@ printmqattr(struct tcb *tcp, long addr)
383 tprintf("{mq_flags=");
384 tprint_open_modes(attr.mq_flags);
385 tprintf(", mq_maxmsg=%ld, mq_msgsize=%ld, mq_curmsg=%ld}",
386- attr.mq_maxmsg, attr.mq_msgsize, attr.mq_curmsgs);
387+ (long) attr.mq_maxmsg, (long) attr.mq_msgsize,
388+ (long) attr.mq_curmsgs);
389 # endif
390 }
391 }
392diff --git a/linux/x32/errnoent.h b/linux/x32/errnoent.h
393new file mode 100644
394index 0000000..00de57b
395--- /dev/null
396+++ b/linux/x32/errnoent.h
397@@ -0,0 +1,2 @@
398+/* Our third set is for x32. */
399+#include "../errnoent.h"
400diff --git a/linux/x32/ioctlent.h.in b/linux/x32/ioctlent.h.in
401new file mode 100644
402index 0000000..52ac99b
403--- /dev/null
404+++ b/linux/x32/ioctlent.h.in
405@@ -0,0 +1 @@
406+#include "../i386/ioctlent.h.in"
407diff --git a/linux/x32/signalent.h b/linux/x32/signalent.h
408new file mode 100644
409index 0000000..6fbcab1
410--- /dev/null
411+++ b/linux/x32/signalent.h
412@@ -0,0 +1,2 @@
413+/* Our third set is for x32. */
414+#include "../signalent.h"
415diff --git a/linux/x32/syscallent.h b/linux/x32/syscallent.h
416new file mode 100644
417index 0000000..2e301fb
418--- /dev/null
419+++ b/linux/x32/syscallent.h
420@@ -0,0 +1,333 @@
421+ { 3, TD, sys_read, "read" }, /* 0 */
422+ { 3, TD, sys_write, "write" }, /* 1 */
423+ { 3, TD|TF, sys_open, "open" }, /* 2 */
424+ { 1, TD, sys_close, "close" }, /* 3 */
425+ { 2, TF, sys_stat, "stat" }, /* 4 */
426+ { 2, TD, sys_fstat, "fstat" }, /* 5 */
427+ { 2, TF, sys_lstat, "lstat" }, /* 6 */
428+ { 3, TD, sys_poll, "poll" }, /* 7 */
429+ { 3, TD, sys_lseek, "lseek" }, /* 8 */
430+ { 6, TD, sys_mmap, "mmap" }, /* 9 */
431+ { 3, 0, sys_mprotect, "mprotect" }, /* 10 */
432+ { 2, 0, sys_munmap, "munmap" }, /* 11 */
433+ { 1, 0, sys_brk, "brk" }, /* 12 */
434+ { }, /* 13 */
435+ { }, /* 14 */
436+ { }, /* 15 */
437+ { }, /* 16 */
438+ { 5, TD, sys_pread, "pread" }, /* 17 */
439+ { 5, TD, sys_pwrite, "pwrite" }, /* 18 */
440+ { }, /* 19 */
441+ { }, /* 20 */
442+ { 2, TF, sys_access, "access" }, /* 21 */
443+ { 1, TD, sys_pipe, "pipe" }, /* 22 */
444+ { 5, TD, sys_select, "select" }, /* 23 */
445+ { 0, 0, sys_sched_yield, "sched_yield" }, /* 24 */
446+ { 5, 0, sys_mremap, "mremap" }, /* 25 */
447+ { 3, 0, sys_msync, "msync" }, /* 26 */
448+ { 3, 0, sys_mincore, "mincore" }, /* 27 */
449+ { 3, 0, sys_madvise, "madvise" }, /* 28 */
450+ { 4, TI, sys_shmget, "shmget" }, /* 29 */
451+ { 4, TI, sys_shmat, "shmat" }, /* 30 */
452+ { 4, TI, sys_shmctl, "shmctl" }, /* 31 */
453+ { 1, TD, sys_dup, "dup" }, /* 32 */
454+ { 2, TD, sys_dup2, "dup2" }, /* 33 */
455+ { 0, TS, sys_pause, "pause" }, /* 34 */
456+ { 2, 0, sys_nanosleep, "nanosleep" }, /* 35 */
457+ { 2, 0, sys_getitimer, "getitimer" }, /* 36 */
458+ { 1, 0, sys_alarm, "alarm" }, /* 37 */
459+ { 3, 0, sys_setitimer, "setitimer" }, /* 38 */
460+ { 0, 0, sys_getpid, "getpid" }, /* 39 */
461+ { 4, TD|TN, sys_sendfile, "sendfile" }, /* 40 */
462+ { 3, TN, sys_socket, "socket" }, /* 41 */
463+ { 3, TN, sys_connect, "connect" }, /* 42 */
464+ { 3, TN, sys_accept, "accept" }, /* 43 */
465+ { 6, TN, sys_sendto, "sendto" }, /* 44 */
466+ { }, /* 45 */
467+ { }, /* 46 */
468+ { }, /* 47 */
469+ { 2, TN, sys_shutdown, "shutdown" }, /* 48 */
470+ { 3, TN, sys_bind, "bind" }, /* 49 */
471+ { 2, TN, sys_listen, "listen" }, /* 50 */
472+ { 3, TN, sys_getsockname, "getsockname" }, /* 51 */
473+ { 3, TN, sys_getpeername, "getpeername" }, /* 52 */
474+ { 4, TN, sys_socketpair, "socketpair" }, /* 53 */
475+ { 5, TN, sys_setsockopt, "setsockopt" }, /* 54 */
476+ { 5, TN, sys_getsockopt, "getsockopt" }, /* 55 */
477+ { 5, TP, sys_clone, "clone" }, /* 56 */
478+ { 0, TP, sys_fork, "fork" }, /* 57 */
479+ { 0, TP, sys_vfork, "vfork" }, /* 58 */
480+ { }, /* 47 */
481+ { 1, TP, sys_exit, "_exit" }, /* 60 */
482+ { 4, TP, sys_wait4, "wait4" }, /* 61 */
483+ { 2, TS, sys_kill, "kill" }, /* 62 */
484+ { 1, 0, sys_uname, "uname" }, /* 63 */
485+ { 4, TI, sys_semget, "semget" }, /* 64 */
486+ { 4, TI, sys_semop, "semop" }, /* 65 */
487+ { 4, TI, sys_semctl, "semctl" }, /* 66 */
488+ { 4, TI, sys_shmdt, "shmdt" }, /* 67 */
489+ { 4, TI, sys_msgget, "msgget" }, /* 68 */
490+ { 4, TI, sys_msgsnd, "msgsnd" }, /* 69 */
491+ { 5, TI, sys_msgrcv, "msgrcv" }, /* 70 */
492+ { 3, TI, sys_msgctl, "msgctl" }, /* 71 */
493+ { 3, TD, sys_fcntl, "fcntl" }, /* 72 */
494+ { 2, TD, sys_flock, "flock" }, /* 73 */
495+ { 1, TD, sys_fsync, "fsync" }, /* 74 */
496+ { 1, TD, sys_fdatasync, "fdatasync" }, /* 75 */
497+ { 2, TF, sys_truncate, "truncate" }, /* 76 */
498+ { 2, TD, sys_ftruncate, "ftruncate" }, /* 77 */
499+ { }, /* 78 */
500+ { 2, TF, sys_getcwd, "getcwd" }, /* 79 */
501+ { 1, TF, sys_chdir, "chdir" }, /* 80 */
502+ { 1, TD, sys_fchdir, "fchdir" }, /* 81 */
503+ { 2, TF, sys_rename, "rename" }, /* 82 */
504+ { 2, TF, sys_mkdir, "mkdir" }, /* 83 */
505+ { 1, TF, sys_rmdir, "rmdir" }, /* 84 */
506+ { 2, TD|TF, sys_creat, "creat" }, /* 85 */
507+ { 2, TF, sys_link, "link" }, /* 86 */
508+ { 1, TF, sys_unlink, "unlink" }, /* 87 */
509+ { 2, TF, sys_symlink, "symlink" }, /* 88 */
510+ { 3, TF, sys_readlink, "readlink" }, /* 89 */
511+ { 2, TF, sys_chmod, "chmod" }, /* 90 */
512+ { 2, TD, sys_fchmod, "fchmod" }, /* 91 */
513+ { 3, TF, sys_chown, "chown" }, /* 92 */
514+ { 3, TD, sys_fchown, "fchown" }, /* 93 */
515+ { 3, TF, sys_chown, "lchown" }, /* 94 */
516+ { 1, 0, sys_umask, "umask" }, /* 95 */
517+ { 2, 0, sys_gettimeofday, "gettimeofday" }, /* 96 */
518+ { 2, 0, sys_getrlimit, "getrlimit" }, /* 97 */
519+ { 2, 0, sys_getrusage, "getrusage" }, /* 98 */
520+ { 1, 0, sys_sysinfo, "sysinfo" }, /* 99 */
521+ { }, /* 100 */
522+ { 4, 0, sys_ptrace, "ptrace" }, /* 101 */
523+ { 0, NF, sys_getuid, "getuid" }, /* 102 */
524+ { 3, 0, sys_syslog, "syslog" }, /* 103 */
525+ { 0, NF, sys_getgid, "getgid" }, /* 104 */
526+ { 1, 0, sys_setuid, "setuid" }, /* 105 */
527+ { 1, 0, sys_setgid, "setgid" }, /* 106 */
528+ { 0, NF, sys_geteuid, "geteuid" }, /* 107 */
529+ { 0, NF, sys_getegid, "getegid" }, /* 108 */
530+ { 2, 0, sys_setpgid, "setpgid" }, /* 109 */
531+ { 0, 0, sys_getppid, "getppid" }, /* 110 */
532+ { 0, 0, sys_getpgrp, "getpgrp" }, /* 111 */
533+ { 0, 0, sys_setsid, "setsid" }, /* 112 */
534+ { 2, 0, sys_setreuid, "setreuid" }, /* 113 */
535+ { 2, 0, sys_setregid, "setregid" }, /* 114 */
536+ { 2, 0, sys_getgroups, "getgroups" }, /* 115 */
537+ { 2, 0, sys_setgroups, "setgroups" }, /* 116 */
538+ { 3, 0, sys_setresuid, "setresuid" }, /* 117 */
539+ { 3, 0, sys_getresuid, "getresuid" }, /* 118 */
540+ { 3, 0, sys_setresgid, "setresgid" }, /* 119 */
541+ { 3, 0, sys_getresgid, "getresgid" }, /* 120 */
542+ { 1, 0, sys_getpgid, "getpgid" }, /* 121 */
543+ { 1, NF, sys_setfsuid, "setfsuid" }, /* 122 */
544+ { 1, NF, sys_setfsgid, "setfsgid" }, /* 123 */
545+ { 1, 0, sys_getsid, "getsid" }, /* 124 */
546+ { 2, 0, sys_capget, "capget" }, /* 125 */
547+ { 2, 0, sys_capset, "capset" }, /* 126 */
548+ { }, /* 127 */
549+ { }, /* 128 */
550+ { }, /* 129 */
551+ { 2, TS, sys_rt_sigsuspend, "rt_sigsuspend" }, /* 130 */
552+ { }, /* 131 */
553+ { 2, TF, sys_utime, "utime" }, /* 132 */
554+ { 3, TF, sys_mknod, "mknod" }, /* 133 */
555+ { }, /* 134 */
556+ { 1, 0, sys_personality, "personality" }, /* 135 */
557+ { 2, 0, sys_ustat, "ustat" }, /* 136 */
558+ { 2, TF, sys_statfs, "statfs" }, /* 137 */
559+ { 2, TD, sys_fstatfs, "fstatfs" }, /* 138 */
560+ { 3, 0, sys_sysfs, "sysfs" }, /* 139 */
561+ { 2, 0, sys_getpriority, "getpriority" }, /* 140 */
562+ { 3, 0, sys_setpriority, "setpriority" }, /* 141 */
563+ { 0, 0, sys_sched_setparam, "sched_setparam" }, /* 142 */
564+ { 2, 0, sys_sched_getparam, "sched_getparam" }, /* 143 */
565+ { 3, 0, sys_sched_setscheduler, "sched_setscheduler" }, /* 144 */
566+ { 1, 0, sys_sched_getscheduler, "sched_getscheduler" }, /* 145 */
567+ { 1, 0, sys_sched_get_priority_max, "sched_get_priority_max" }, /* 146 */
568+ { 1, 0, sys_sched_get_priority_min, "sched_get_priority_min" }, /* 147 */
569+ { 2, 0, sys_sched_rr_get_interval, "sched_rr_get_interval" }, /* 148 */
570+ { 2, 0, sys_mlock, "mlock" }, /* 149 */
571+ { 2, 0, sys_munlock, "munlock" }, /* 150 */
572+ { 1, 0, sys_mlockall, "mlockall" }, /* 151 */
573+ { 0, 0, sys_munlockall, "munlockall" }, /* 152 */
574+ { 0, 0, sys_vhangup, "vhangup" }, /* 153 */
575+ { 3, 0, sys_modify_ldt, "modify_ldt" }, /* 154 */
576+ { 2, TF, sys_pivotroot, "pivot_root" }, /* 155 */
577+ { }, /* 156 */
578+ { 5, 0, sys_prctl, "prctl" }, /* 157 */
579+ { 2, TP, sys_arch_prctl, "arch_prctl" }, /* 158 */
580+ { 1, 0, sys_adjtimex, "adjtimex" }, /* 159 */
581+ { 2, 0, sys_setrlimit, "setrlimit" }, /* 160 */
582+ { 1, TF, sys_chroot, "chroot" }, /* 161 */
583+ { 0, 0, sys_sync, "sync" }, /* 162 */
584+ { 1, TF, sys_acct, "acct" }, /* 163 */
585+ { 2, 0, sys_settimeofday, "settimeofday" }, /* 164 */
586+ { 5, TF, sys_mount, "mount" }, /* 165 */
587+ { 2, TF, sys_umount2, "umount" }, /* 166 */
588+ { 2, TF, sys_swapon, "swapon" }, /* 167 */
589+ { 1, TF, sys_swapoff, "swapoff" }, /* 168 */
590+ { 4, 0, sys_reboot, "reboot" }, /* 169 */
591+ { 2, 0, sys_sethostname, "sethostname" }, /* 170 */
592+ { 2, 0, sys_setdomainname, "setdomainname" }, /* 171 */
593+ { 1, 0, sys_iopl, "iopl" }, /* 172 */
594+ { 3, 0, sys_ioperm, "ioperm" }, /* 173 */
595+ { 2, 0, sys_create_module, "create_module" }, /* 174 */
596+ { 3, 0, sys_init_module, "init_module" }, /* 175 */
597+ { 2, 0, sys_delete_module, "delete_module" }, /* 176 */
598+ { }, /* 177 */
599+ { }, /* 178 */
600+ { 4, 0, sys_quotactl, "quotactl" }, /* 179 */
601+ { }, /* 180 */
602+ { }, /* 181 */
603+ { }, /* 182 */
604+ { }, /* 183 */
605+ { }, /* 184 */
606+ { }, /* 185 */
607+ { 0, 0, printargs, "gettid" }, /* 186 */
608+ { 4, TD, sys_readahead, "readahead" }, /* 187 */
609+ { 5, TF, sys_setxattr, "setxattr" }, /* 188 */
610+ { 5, TF, sys_setxattr, "lsetxattr" }, /* 189 */
611+ { 5, TD, sys_fsetxattr, "fsetxattr" }, /* 190 */
612+ { 4, TF, sys_getxattr, "getxattr" }, /* 191 */
613+ { 4, TF, sys_getxattr, "lgetxattr" }, /* 192 */
614+ { 4, TD, sys_fgetxattr, "fgetxattr" }, /* 193 */
615+ { 3, TF, sys_listxattr, "listxattr" }, /* 194 */
616+ { 3, TF, sys_listxattr, "llistxattr" }, /* 195 */
617+ { 3, TD, sys_flistxattr, "flistxattr" }, /* 196 */
618+ { 2, TF, sys_removexattr, "removexattr" }, /* 197 */
619+ { 2, TF, sys_removexattr, "lremovexattr" }, /* 198 */
620+ { 2, TD, sys_fremovexattr, "fremovexattr" }, /* 199 */
621+ { 2, 0, sys_kill, "tkill" }, /* 200 */
622+ { 1, 0, sys_time, "time" }, /* 201 */
623+ { 6, 0, sys_futex, "futex" }, /* 202 */
624+ { 3, 0, sys_sched_setaffinity, "sched_setaffinity" },/* 203 */
625+ { 3, 0, sys_sched_getaffinity, "sched_getaffinity" },/* 204 */
626+ { }, /* 205 */
627+ { 2, 0, sys_io_setup, "io_setup" }, /* 206 */
628+ { 1, 0, sys_io_destroy, "io_destroy" }, /* 207 */
629+ { 5, 0, sys_io_getevents, "io_getevents" }, /* 208 */
630+ { 3, 0, sys_io_submit, "io_submit" }, /* 209 */
631+ { 3, 0, sys_io_cancel, "io_cancel" }, /* 210 */
632+ { }, /* 211 */
633+ { 4, 0, printargs, "lookup_dcookie"}, /* 212 */
634+ { 1, TD, sys_epoll_create, "epoll_create" }, /* 213 */
635+ { }, /* 214 */
636+ { }, /* 215 */
637+ { 5, 0, sys_remap_file_pages, "remap_file_pages"}, /* 216 */
638+ { 3, TD, sys_getdents64, "getdents64" }, /* 217 */
639+ { 1, 0, printargs, "set_tid_address"}, /* 218 */
640+ { 0, 0, sys_restart_syscall, "restart_syscall"}, /* 219 */
641+ { 5, TI, sys_semtimedop, "semtimedop" }, /* 220 */
642+ { 4, TD, sys_fadvise64_64, "fadvise64" }, /* 221 */
643+ { }, /* 222 */
644+ { 4, 0, sys_timer_settime, "timer_settime" }, /* 223 */
645+ { 2, 0, sys_timer_gettime, "timer_gettime" }, /* 224 */
646+ { 1, 0, sys_timer_getoverrun, "timer_getoverrun"}, /* 225 */
647+ { 1, 0, sys_timer_delete, "timer_delete" }, /* 226 */
648+ { 2, 0, sys_clock_settime, "clock_settime" }, /* 227 */
649+ { 2, 0, sys_clock_gettime, "clock_gettime" }, /* 228 */
650+ { 2, 0, sys_clock_getres, "clock_getres" }, /* 229 */
651+ { 4, 0, sys_clock_nanosleep, "clock_nanosleep"}, /* 230 */
652+ { 1, TP, sys_exit, "exit_group" }, /* 231 */
653+ { 4, TD, sys_epoll_wait, "epoll_wait" }, /* 232 */
654+ { 4, TD, sys_epoll_ctl, "epoll_ctl" }, /* 233 */
655+ { 3, TS, sys_tgkill, "tgkill" }, /* 234 */
656+ { 2, TF, sys_utimes, "utimes" }, /* 235 */
657+ { }, /* 236 */
658+ { 6, 0, sys_mbind, "mbind" }, /* 237 */
659+ { 3, 0, sys_set_mempolicy, "set_mempolicy" }, /* 238 */
660+ { 5, 0, sys_get_mempolicy, "get_mempolicy" }, /* 239 */
661+ { 4, 0, sys_mq_open, "mq_open" }, /* 240 */
662+ { 1, 0, sys_mq_unlink, "mq_unlink" }, /* 241 */
663+ { 5, 0, sys_mq_timedsend, "mq_timedsend" }, /* 242 */
664+ { 5, 0, sys_mq_timedreceive, "mq_timedreceive" }, /* 243 */
665+ { }, /* 244 */
666+ { 3, 0, sys_mq_getsetattr, "mq_getsetattr" }, /* 245 */
667+ { }, /* 246 */
668+ { }, /* 247 */
669+ { 5, 0, printargs, "add_key" }, /* 248 */
670+ { 4, 0, printargs, "request_key" }, /* 249 */
671+ { 5, 0, printargs, "keyctl" }, /* 250 */
672+ { 3, 0, printargs, "ioprio_set" }, /* 251 */
673+ { 2, 0, printargs, "ioprio_get" }, /* 252 */
674+ { 0, TD, printargs, "inotify_init" }, /* 253 */
675+ { 3, TD, sys_inotify_add_watch, "inotify_add_watch" }, /* 254 */
676+ { 2, TD, sys_inotify_rm_watch, "inotify_rm_watch" }, /* 255 */
677+ { 4, 0, printargs, "migrate_pages" }, /* 256 */
678+ { 4, TD|TF, sys_openat, "openat" }, /* 257 */
679+ { 3, TD|TF, sys_mkdirat, "mkdirat" }, /* 258 */
680+ { 4, TD|TF, sys_mknodat, "mknodat" }, /* 259 */
681+ { 5, TD|TF, sys_fchownat, "fchownat" }, /* 260 */
682+ { 3, TD|TF, sys_futimesat, "futimesat" }, /* 261 */
683+ { 4, TD|TF, sys_newfstatat, "newfstatat" }, /* 262 */
684+ { 3, TD|TF, sys_unlinkat, "unlinkat" }, /* 263 */
685+ { 4, TD|TF, sys_renameat, "renameat" }, /* 264 */
686+ { 5, TD|TF, sys_linkat, "linkat" }, /* 265 */
687+ { 3, TD|TF, sys_symlinkat, "symlinkat" }, /* 266 */
688+ { 4, TD|TF, sys_readlinkat, "readlinkat" }, /* 267 */
689+ { 3, TD|TF, sys_fchmodat, "fchmodat" }, /* 268 */
690+ { 3, TD|TF, sys_faccessat, "faccessat" }, /* 269 */
691+ { 6, TD, sys_pselect6, "pselect6" }, /* 270 */
692+ { 5, TD, sys_ppoll, "ppoll" }, /* 271 */
693+ { 1, TP, sys_unshare, "unshare" }, /* 272 */
694+ { }, /* 273 */
695+ { }, /* 274 */
696+ { 6, TD, printargs, "splice" }, /* 275 */
697+ { 4, TD, printargs, "tee" }, /* 276 */
698+ { 4, TD, printargs, "sync_file_range" }, /* 277 */
699+ { }, /* 278 */
700+ { }, /* 279 */
701+ { 4, TD|TF, sys_utimensat, "utimensat" }, /* 280 */
702+ { 6, TD, sys_epoll_pwait, "epoll_pwait" }, /* 281 */
703+ { 3, TD|TS, sys_signalfd, "signalfd" }, /* 282 */
704+ { 2, TD, sys_timerfd_create, "timerfd_create"}, /* 283 */
705+ { 1, TD, sys_eventfd, "eventfd" }, /* 284 */
706+ { 6, TD, sys_fallocate, "fallocate" }, /* 285 */
707+ { 4, TD, sys_timerfd_settime, "timerfd_settime"}, /* 286 */
708+ { 2, TD, sys_timerfd_gettime, "timerfd_gettime"}, /* 287 */
709+ { 4, TN, sys_accept4, "accept4" }, /* 288 */
710+ { 4, TD|TS, sys_signalfd4, "signalfd4" }, /* 289 */
711+ { 2, TD, sys_eventfd2, "eventfd2" }, /* 290 */
712+ { 1, TD, sys_epoll_create1, "epoll_create1" }, /* 291 */
713+ { 3, TD, sys_dup3, "dup3" }, /* 292 */
714+ { 2, TD, sys_pipe2, "pipe2" }, /* 293 */
715+ { 1, TD, sys_inotify_init1, "inotify_init1" }, /* 294 */
716+ { }, /* 295 */
717+ { }, /* 296 */
718+ { }, /* 297 */
719+ { 5, TD, printargs, "perf_event_open"}, /* 298 */
720+ { }, /* 299 */
721+ { 2, TD, printargs, "fanotify_init" }, /* 300 */
722+ { 5, TD|TF, printargs, "fanotify_mark" }, /* 301 */
723+ { 4, 0, printargs, "prlimit64" }, /* 302 */
724+
725+ [302 ... 511] = {},
726+
727+ { 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 512 */
728+ { 4, TS, sys_rt_sigprocmask, "rt_sigprocmask"}, /* 513 */
729+ { 0, TS, printargs, "rt_sigreturn" }, /* 514 */
730+ { 3, TD, sys_ioctl, "ioctl" }, /* 515 */
731+ { 3, TD, sys_readv, "readv" }, /* 516 */
732+ { 3, TD, sys_writev, "writev" }, /* 517 */
733+ { 6, TN, sys_recvfrom, "recvfrom" }, /* 518 */
734+ { 3, TN, sys_sendmsg, "sendmsg" }, /* 519 */
735+ { 5, TN, sys_recvmsg, "recvmsg" }, /* 520 */
736+ { 3, TF|TP, sys_execve, "execve" }, /* 521 */
737+ { 1, 0, sys_times, "times" }, /* 522 */
738+ { 2, TS, sys_rt_sigpending, "rt_sigpending" }, /* 523 */
739+ { 4, TS, sys_rt_sigtimedwait, "rt_sigtimedwait" }, /* 524 */
740+ { 3, TS, sys_rt_sigqueueinfo, "rt_sigqueueinfo" }, /* 525 */
741+ { 2, TS, sys_sigaltstack, "sigaltstack" }, /* 526 */
742+ { 3, 0, sys_timer_create, "timer_create" }, /* 527 */
743+ { 5, TP, sys_waitid, "waitid" }, /* 528 */
744+ { 2, 0, sys_mq_notify, "mq_notify" }, /* 529 */
745+ { 4, 0, printargs, "kexec_load" }, /* 530 */
746+ { 2, 0, printargs, "set_robust_list" }, /* 531 */
747+ { 3, 0, printargs, "get_robust_list" }, /* 532 */
748+ { 4, TD, printargs, "vmsplice" }, /* 533 */
749+ { 6, 0, sys_move_pages, "move_pages" }, /* 534 */
750+ { 5, TD, printargs, "preadv" }, /* 535 */
751+ { 5, TD, printargs, "pwritev" }, /* 536 */
752+ { 4, TP|TS, printargs, "rt_tgsigqueueinfo"}, /* 537 */
753+ { 5, TN, sys_recvmmsg, "recvmmsg" }, /* 538 */
754diff --git a/linux/x86_64/errnoent2.h b/linux/x86_64/errnoent2.h
755new file mode 100644
756index 0000000..00de57b
757--- /dev/null
758+++ b/linux/x86_64/errnoent2.h
759@@ -0,0 +1,2 @@
760+/* Our third set is for x32. */
761+#include "../errnoent.h"
762diff --git a/linux/x86_64/ioctlent2.h b/linux/x86_64/ioctlent2.h
763new file mode 100644
764index 0000000..060003b
765--- /dev/null
766+++ b/linux/x86_64/ioctlent2.h
767@@ -0,0 +1,2 @@
768+/* Our third set is for x32. */
769+#include "linux/ioctlent.h"
770diff --git a/linux/x86_64/signalent2.h b/linux/x86_64/signalent2.h
771new file mode 100644
772index 0000000..6fbcab1
773--- /dev/null
774+++ b/linux/x86_64/signalent2.h
775@@ -0,0 +1,2 @@
776+/* Our third set is for x32. */
777+#include "../signalent.h"
778diff --git a/linux/x86_64/syscallent2.h b/linux/x86_64/syscallent2.h
779new file mode 100644
780index 0000000..33014af
781--- /dev/null
782+++ b/linux/x86_64/syscallent2.h
783@@ -0,0 +1,3 @@
784+/* Our third set is for x32. */
785+
786+#include "x32/syscallent.h"
787diff --git a/mem.c b/mem.c
788index d4c223a..355027a 100644
789--- a/mem.c
790+++ b/mem.c
791@@ -341,26 +341,29 @@ int
792 sys_mmap64(struct tcb *tcp)
793 {
794 #ifdef linux
795-#ifdef ALPHA
796+#if defined ALPHA || defined X32
797 long *u_arg = tcp->u_arg;
798-#else /* !ALPHA */
799+#else /* !ALPHA && !X32 */
800 long u_arg[7];
801-#endif /* !ALPHA */
802+#endif /* !ALPHA && !X32 */
803 #else /* !linux */
804 long *u_arg = tcp->u_arg;
805 #endif /* !linux */
806
807 if (entering(tcp)) {
808 #ifdef linux
809-#ifndef ALPHA
810+#if !defined ALPHA && !defined X32
811 if (umoven(tcp, tcp->u_arg[0], sizeof u_arg,
812 (char *) u_arg) == -1)
813 return 0;
814-#endif /* ALPHA */
815+#endif /* !ALPHA && !X32 */
816 #endif /* linux */
817
818 /* addr */
819- tprintf("%#lx, ", u_arg[0]);
820+ if (!u_arg[0])
821+ tprintf("NULL, ");
822+ else
823+ tprintf("%#lx, ", u_arg[0]);
824 /* len */
825 tprintf("%lu, ", u_arg[1]);
826 /* prot */
827diff --git a/process.c b/process.c
828index 6c1aa6b..7da30bc 100644
829--- a/process.c
830+++ b/process.c
831@@ -606,7 +606,7 @@ extern void print_ldt_entry();
832 # define ARG_PTID 2
833 # define ARG_CTID 3
834 # define ARG_TLS 4
835-# elif defined X86_64 || defined ALPHA
836+# elif defined X86_64 || defined X32 || defined ALPHA
837 # define ARG_FLAGS 0
838 # define ARG_STACK 1
839 # define ARG_PTID 2
840@@ -691,7 +691,7 @@ change_syscall(struct tcb *tcp, int new)
841 if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(ORIG_EAX * 4), new) < 0)
842 return -1;
843 return 0;
844-#elif defined(X86_64)
845+#elif defined(X86_64) || defined(X32)
846 /* Attempt to make vfork into fork, which we can follow. */
847 if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(ORIG_RAX * 8), new) < 0)
848 return -1;
849@@ -2662,7 +2662,7 @@ const struct xlat struct_user_offsets[] = {
850 { 4*EFL, "4*EFL" },
851 { 4*UESP, "4*UESP" },
852 { 4*SS, "4*SS" },
853-# elif defined(X86_64)
854+# elif defined(X86_64) || defined(X32)
855 { 8*R15, "8*R15" },
856 { 8*R14, "8*R14" },
857 { 8*R13, "8*R13" },
858@@ -3197,7 +3197,7 @@ const struct xlat struct_user_offsets[] = {
859 # if !defined(S390) && !defined(S390X) && !defined(MIPS) && !defined(SPARC64) && !defined(AVR32) && !defined(BFIN) && !defined(TILE)
860 { uoff(u_fpvalid), "offsetof(struct user, u_fpvalid)" },
861 # endif
862-# if defined(I386) || defined(X86_64)
863+# if defined(I386) || defined(X86_64) || defined(X32)
864 { uoff(i387), "offsetof(struct user, i387)" },
865 # endif
866 # if defined(M68K)
867@@ -3227,7 +3227,7 @@ const struct xlat struct_user_offsets[] = {
868 # endif
869 { uoff(magic), "offsetof(struct user, magic)" },
870 { uoff(u_comm), "offsetof(struct user, u_comm)" },
871-# if defined(I386) || defined(X86_64)
872+# if defined(I386) || defined(X86_64) || defined(X32)
873 { uoff(u_debugreg), "offsetof(struct user, u_debugreg)" },
874 # endif
875 # endif /* !defined(many arches) */
876@@ -3681,7 +3681,7 @@ sys_sched_get_priority_min(struct tcb *tcp)
877 return 0;
878 }
879
880-# ifdef X86_64
881+# if defined X86_64 || defined X32
882 # include <asm/prctl.h>
883
884 static const struct xlat archvals[] = {
885@@ -3715,7 +3715,7 @@ sys_arch_prctl(struct tcb *tcp)
886 }
887 return 0;
888 }
889-# endif /* X86_64 */
890+# endif /* X86_64 || X32 */
891
892
893 int
894diff --git a/quota.c b/quota.c
895index f07d1a1..39ae33c 100644
896--- a/quota.c
897+++ b/quota.c
898@@ -386,8 +386,8 @@ decode_cmd_data(struct tcb *tcp, u_int32_t cmd, unsigned long data)
899 tprintf("ihardlimit=%u, ", dq.dqb_ihardlimit);
900 tprintf("isoftlimit=%u, ", dq.dqb_isoftlimit);
901 tprintf("curinodes=%u, ", dq.dqb_curinodes);
902- tprintf("btime=%lu, ", dq.dqb_btime);
903- tprintf("itime=%lu}", dq.dqb_itime);
904+ tprintf("btime=%lu, ", (long) dq.dqb_btime);
905+ tprintf("itime=%lu}", (long) dq.dqb_itime);
906 break;
907 }
908 case Q_V2_GETQUOTA:
909@@ -411,8 +411,8 @@ decode_cmd_data(struct tcb *tcp, u_int32_t cmd, unsigned long data)
910 tprintf("bhardlimit=%u, ", dq.dqb_bhardlimit);
911 tprintf("bsoftlimit=%u, ", dq.dqb_bsoftlimit);
912 tprintf("curspace=%" PRIu64 ", ", dq.dqb_curspace);
913- tprintf("btime=%lu, ", dq.dqb_btime);
914- tprintf("itime=%lu}", dq.dqb_itime);
915+ tprintf("btime=%lu, ", (long) dq.dqb_btime);
916+ tprintf("itime=%lu}", (long) dq.dqb_itime);
917 break;
918 }
919 case Q_XGETQUOTA:
920diff --git a/resource.c b/resource.c
921index b9550b8..5beebbc 100644
922--- a/resource.c
923+++ b/resource.c
924@@ -49,7 +49,9 @@
925
926 #define rlimit64 rlimit /* Ugly hack */
927 #define rlim64_t rlim_t /* Ugly hack */
928+#ifndef RLIM64_INFINITY
929 #define RLIM64_INFINITY RLIM_INFINITY /* You guessed it */
930+#endif
931
932 #define sys_getrlimit64 sys_getrlimit
933 #define sys_setrlimit64 sys_setrlimit
934@@ -399,14 +401,15 @@ sys_sysinfo(struct tcb *tcp)
935 tprintf("{...}");
936 else {
937 tprintf("{uptime=%lu, loads=[%lu, %lu, %lu] ",
938- si.uptime, si.loads[0], si.loads[1],
939- si.loads[2]);
940+ (long) si.uptime, (long) si.loads[0],
941+ (long) si.loads[1], (long) si.loads[2]);
942 tprintf("totalram=%lu, freeram=%lu, ",
943- si.totalram, si.freeram);
944+ (long) si.totalram, (long) si.freeram);
945 tprintf("sharedram=%lu, bufferram=%lu} ",
946- si.sharedram, si.bufferram);
947+ (long) si.sharedram, (long) si.bufferram);
948 tprintf("totalswap=%lu, freeswap=%lu, procs=%hu}",
949- si.totalswap, si.freeswap, si.procs);
950+ (long) si.totalswap, (long) si.freeswap,
951+ si.procs);
952 }
953 }
954 return 0;
955diff --git a/signal.c b/signal.c
956index b47b831..cc4887c 100644
957--- a/signal.c
958+++ b/signal.c
959@@ -85,7 +85,7 @@ typedef struct {
960 int si_mask;
961 } m_siginfo_t;
962 #elif defined HAVE_ASM_SIGCONTEXT_H
963-#if !defined(IA64) && !defined(X86_64)
964+#if !defined(IA64) && !defined(X86_64) && !defined(X32)
965 #include <asm/sigcontext.h>
966 #endif /* !IA64 && !X86_64 */
967 #else /* !HAVE_ASM_SIGCONTEXT_H */
968@@ -176,7 +176,7 @@ static const struct xlat sigvec_flags[] = {
969
970 #ifdef HAVE_SIGACTION
971
972-#if defined LINUX && (defined I386 || defined X86_64)
973+#if defined LINUX && (defined I386 || defined X86_64 || defined X32)
974 /* The libc headers do not define this constant since it should only be
975 used by the implementation. So wwe define it here. */
976 # ifndef SA_RESTORER
977diff --git a/syscall.c b/syscall.c
978index e66ac0a..12a50a2 100644
979--- a/syscall.c
980+++ b/syscall.c
981@@ -482,7 +482,9 @@ dumpio(struct tcb *tcp)
982 if (qual_flags[tcp->u_arg[0]] & QUAL_READ) {
983 if (sysent[tcp->scno].sys_func == sys_read ||
984 sysent[tcp->scno].sys_func == sys_pread ||
985+#ifndef HAVE_LONG_LONG_OFF_T
986 sysent[tcp->scno].sys_func == sys_pread64 ||
987+#endif
988 sysent[tcp->scno].sys_func == sys_recv ||
989 sysent[tcp->scno].sys_func == sys_recvfrom)
990 dumpstr(tcp, tcp->u_arg[1], tcp->u_rval);
991@@ -493,7 +495,9 @@ dumpio(struct tcb *tcp)
992 if (qual_flags[tcp->u_arg[0]] & QUAL_WRITE) {
993 if (sysent[tcp->scno].sys_func == sys_write ||
994 sysent[tcp->scno].sys_func == sys_pwrite ||
995+#ifndef HAVE_LONG_LONG_OFF_T
996 sysent[tcp->scno].sys_func == sys_pwrite64 ||
997+#endif
998 sysent[tcp->scno].sys_func == sys_send ||
999 sysent[tcp->scno].sys_func == sys_sendto)
1000 dumpstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
1001@@ -715,8 +719,8 @@ internal_syscall(struct tcb *tcp)
1002 static long r0;
1003 #elif defined(SH64)
1004 static long r9;
1005-#elif defined(X86_64)
1006- static long rax;
1007+#elif defined(X86_64) || defined(X32)
1008+ static struct user_regs_struct x86_64_regs;
1009 #elif defined(CRISV10) || defined(CRISV32)
1010 static long r10;
1011 #elif defined(MICROBLAZE)
1012@@ -892,30 +896,45 @@ get_scno(struct tcb *tcp)
1013 # elif defined (I386)
1014 if (upeek(tcp, 4*ORIG_EAX, &scno) < 0)
1015 return -1;
1016-# elif defined (X86_64)
1017- if (upeek(tcp, 8*ORIG_RAX, &scno) < 0)
1018+# elif defined (X86_64) || defined(X32)
1019+# ifndef __X32_SYSCALL_BIT
1020+# define __X32_SYSCALL_BIT 0x40000000
1021+# endif
1022+# ifndef __X32_SYSCALL_MASK
1023+# define __X32_SYSCALL_MASK __X32_SYSCALL_BIT
1024+# endif
1025+ if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, (long) &x86_64_regs) < 0)
1026 return -1;
1027+ scno = x86_64_regs.orig_rax;
1028
1029+# ifdef X32
1030+ scno &= ~__X32_SYSCALL_MASK;
1031+# else
1032 if (!(tcp->flags & TCB_INSYSCALL)) {
1033 static int currpers = -1;
1034- long val;
1035 int pid = tcp->pid;
1036
1037 /* Check CS register value. On x86-64 linux it is:
1038 * 0x33 for long mode (64 bit)
1039 * 0x23 for compatibility mode (32 bit)
1040+ * Check DS register value. On x86-64 linux it is:
1041+ * 0x2b for x32 mode (x86-64 in 32 bit)
1042 * It takes only one ptrace and thus doesn't need
1043 * to be cached.
1044 */
1045- if (upeek(tcp, 8*CS, &val) < 0)
1046- return -1;
1047- switch (val) {
1048+ switch (x86_64_regs.cs) {
1049 case 0x23: currpers = 1; break;
1050- case 0x33: currpers = 0; break;
1051+ case 0x33:
1052+ if (x86_64_regs.ds == 0x2b) {
1053+ currpers = 2;
1054+ scno &= ~__X32_SYSCALL_MASK;
1055+ } else
1056+ currpers = 0;
1057+ break;
1058 default:
1059 fprintf(stderr, "Unknown value CS=0x%02X while "
1060 "detecting personality of process "
1061- "PID=%d\n", (int)val, pid);
1062+ "PID=%d\n", (int)x86_64_regs.cs, pid);
1063 currpers = current_personality;
1064 break;
1065 }
1066@@ -952,12 +971,13 @@ get_scno(struct tcb *tcp)
1067 }
1068 # endif
1069 if (currpers != current_personality) {
1070- static const char *const names[] = {"64 bit", "32 bit"};
1071+ static const char *const names[] = {"64 bit", "32 bit", "x32"};
1072 set_personality(currpers);
1073 fprintf(stderr, "[ Process PID=%d runs in %s mode. ]\n",
1074 pid, names[current_personality]);
1075 }
1076 }
1077+# endif
1078 # elif defined(IA64)
1079 # define IA64_PSR_IS ((long)1 << 34)
1080 if (upeek (tcp, PT_CR_IPSR, &psr) >= 0)
1081@@ -1419,9 +1439,8 @@ syscall_fixup(struct tcb *tcp)
1082 fprintf(stderr, "stray syscall exit: eax = %ld\n", eax);
1083 return 0;
1084 }
1085-#elif defined (X86_64)
1086- if (upeek(tcp, 8*RAX, &rax) < 0)
1087- return -1;
1088+#elif defined (X86_64) || defined (X32)
1089+ long rax = x86_64_regs.rax;
1090 if (current_personality == 1)
1091 rax = (long int)(int)rax; /* sign extend from 32 bits */
1092 if (rax != -ENOSYS && !(tcp->flags & TCB_INSYSCALL)) {
1093@@ -1550,14 +1569,17 @@ get_error(struct tcb *tcp)
1094 tcp->u_rval = eax;
1095 u_error = 0;
1096 }
1097-# elif defined(X86_64)
1098- if (check_errno && is_negated_errno(rax)) {
1099+# elif defined(X86_64) || defined(X32)
1100+ if (check_errno && is_negated_errno(x86_64_regs.rax)) {
1101 tcp->u_rval = -1;
1102- u_error = -rax;
1103+ u_error = -x86_64_regs.rax;
1104 }
1105 else {
1106- tcp->u_rval = rax;
1107+ tcp->u_rval = x86_64_regs.rax;
1108 u_error = 0;
1109+# ifdef X32
1110+ tcp->u_lrval = x86_64_regs.rax;
1111+# endif
1112 }
1113 # elif defined(IA64)
1114 if (ia32) {
1115@@ -1813,8 +1835,8 @@ force_result(tcp, error, rval)
1116 eax = error ? -error : rval;
1117 if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(EAX * 4), eax) < 0)
1118 return -1;
1119-# elif defined(X86_64)
1120- rax = error ? -error : rval;
1121+# elif defined(X86_64) || defined(X32)
1122+ long rax = error ? -error : rval;
1123 if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(RAX * 8), rax) < 0)
1124 return -1;
1125 # elif defined(IA64)
1126@@ -2214,22 +2236,34 @@ syscall_enter(struct tcb *tcp)
1127 }
1128 }
1129
1130-#elif defined(X86_64)
1131- {
1132- int i;
1133- static int argreg[SUPPORTED_PERSONALITIES][MAX_ARGS] = {
1134- {RDI,RSI,RDX,R10,R8,R9}, /* x86-64 ABI */
1135- {RBX,RCX,RDX,RSI,RDI,RBP} /* i386 ABI */
1136- };
1137-
1138- if (tcp->scno >= 0 && tcp->scno < nsyscalls && sysent[tcp->scno].nargs != -1)
1139- tcp->u_nargs = sysent[tcp->scno].nargs;
1140- else
1141- tcp->u_nargs = MAX_ARGS;
1142- for (i = 0; i < tcp->u_nargs; i++) {
1143- if (upeek(tcp, argreg[current_personality][i]*8, &tcp->u_arg[i]) < 0)
1144- return -1;
1145- }
1146+#elif defined(X86_64) || defined(X32)
1147+ if (tcp->scno >= 0 && tcp->scno < nsyscalls && sysent[tcp->scno].nargs != -1)
1148+ tcp->u_nargs = sysent[tcp->scno].nargs;
1149+ else
1150+ tcp->u_nargs = MAX_ARGS;
1151+ if (current_personality != 1) { /* x86-64 or x32 ABI */
1152+ tcp->u_arg[0] = x86_64_regs.rdi;
1153+ tcp->u_arg[1] = x86_64_regs.rsi;
1154+ tcp->u_arg[2] = x86_64_regs.rdx;
1155+ tcp->u_arg[3] = x86_64_regs.r10;
1156+ tcp->u_arg[4] = x86_64_regs.r8;
1157+ tcp->u_arg[5] = x86_64_regs.r9;
1158+# ifdef X32
1159+ tcp->ext_arg[0] = x86_64_regs.rdi;
1160+ tcp->ext_arg[1] = x86_64_regs.rsi;
1161+ tcp->ext_arg[2] = x86_64_regs.rdx;
1162+ tcp->ext_arg[3] = x86_64_regs.r10;
1163+ tcp->ext_arg[4] = x86_64_regs.r8;
1164+ tcp->ext_arg[5] = x86_64_regs.r9;
1165+# endif
1166+ } else { /* i386 ABI */
1167+ /* Zero-extend lower 32 bits */
1168+ tcp->u_arg[0] = (unsigned int)x86_64_regs.rbx;
1169+ tcp->u_arg[1] = (unsigned int)x86_64_regs.rcx;
1170+ tcp->u_arg[2] = (unsigned int)x86_64_regs.rdx;
1171+ tcp->u_arg[3] = (unsigned int)x86_64_regs.rsi;
1172+ tcp->u_arg[4] = (unsigned int)x86_64_regs.rdi;
1173+ tcp->u_arg[5] = (unsigned int)x86_64_regs.rbp;
1174 }
1175 #elif defined(MICROBLAZE)
1176 {
1177diff --git a/time.c b/time.c
1178index b5fdc52..1bef5c8 100644
1179--- a/time.c
1180+++ b/time.c
1181@@ -626,19 +626,19 @@ tprint_timex(struct tcb *tcp, long addr)
1182 tprintf("{modes=");
1183 printflags(adjtimex_modes, tx.modes, "ADJ_???");
1184 tprintf(", offset=%ld, freq=%ld, maxerror=%ld, ",
1185- tx.offset, tx.freq, tx.maxerror);
1186- tprintf("esterror=%lu, status=", tx.esterror);
1187+ (long) tx.offset, (long) tx.freq, (long) tx.maxerror);
1188+ tprintf("esterror=%lu, status=", (long) tx.esterror);
1189 printflags(adjtimex_status, tx.status, "STA_???");
1190 tprintf(", constant=%ld, precision=%lu, ",
1191- tx.constant, tx.precision);
1192- tprintf("tolerance=%ld, time=", tx.tolerance);
1193+ (long) tx.constant, (long) tx.precision);
1194+ tprintf("tolerance=%ld, time=", (long) tx.tolerance);
1195 tprint_timeval(tcp, &tx.time);
1196 tprintf(", tick=%ld, ppsfreq=%ld, jitter=%ld",
1197- tx.tick, tx.ppsfreq, tx.jitter);
1198+ (long) tx.tick, (long) tx.ppsfreq, (long) tx.jitter);
1199 tprintf(", shift=%d, stabil=%ld, jitcnt=%ld",
1200- tx.shift, tx.stabil, tx.jitcnt);
1201+ tx.shift, (long) tx.stabil, (long) tx.jitcnt);
1202 tprintf(", calcnt=%ld, errcnt=%ld, stbcnt=%ld",
1203- tx.calcnt, tx.errcnt, tx.stbcnt);
1204+ (long) tx.calcnt, (long) tx.errcnt, (long) tx.stbcnt);
1205 #endif
1206 tprintf("}");
1207 return 0;
1208diff --git a/util.c b/util.c
1209index 711e614..56134a6 100644
1210--- a/util.c
1211+++ b/util.c
1212@@ -271,7 +271,7 @@ printllval(struct tcb *tcp, const char *format, int llarg)
1213 # elif defined IA64 || defined ALPHA
1214 tprintf(format, tcp->u_arg[llarg]);
1215 llarg++;
1216-# elif defined LINUX_MIPSN32
1217+# elif defined LINUX_MIPSN32 || defined LINUX_X32
1218 tprintf(format, tcp->ext_arg[llarg]);
1219 llarg++;
1220 # else
1221@@ -1091,7 +1091,7 @@ printcall(struct tcb *tcp)
1222 tprintf("[%16lx] ", psw);
1223 # endif
1224
1225-# elif defined(X86_64)
1226+# elif defined(X86_64) || defined(X32)
1227 long rip;
1228
1229 if (upeek(tcp, 8*RIP, &rip) < 0) {
1230@@ -1414,9 +1414,9 @@ typedef struct pt_regs arg_setup_state;
1231 # elif defined (HPPA)
1232 # define arg0_offset PT_GR26
1233 # define arg1_offset (PT_GR26-4)
1234-# elif defined (X86_64)
1235-# define arg0_offset ((long)(8*(current_personality ? RBX : RDI)))
1236-# define arg1_offset ((long)(8*(current_personality ? RCX : RSI)))
1237+# elif defined (X86_64) || defined(X32)
1238+# define arg0_offset ((long)(8*(current_personality == 1 ? RBX : RDI)))
1239+# define arg1_offset ((long)(8*(current_personality == 1 ? RCX : RSI)))
1240 # elif defined (SH)
1241 # define arg0_offset (4*(REG_REG0+4))
1242 # define arg1_offset (4*(REG_REG0+5))
diff --git a/meta/recipes-devtools/strace/strace_4.6.bb b/meta/recipes-devtools/strace/strace_4.6.bb
index 05f6d9508a..1275bc1d31 100644
--- a/meta/recipes-devtools/strace/strace_4.6.bb
+++ b/meta/recipes-devtools/strace/strace_4.6.bb
@@ -3,7 +3,7 @@ HOMEPAGE = "http://strace.sourceforge.net"
3SECTION = "console/utils" 3SECTION = "console/utils"
4LICENSE = "BSD" 4LICENSE = "BSD"
5LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=4535377ede62550fdeaf39f595fd550a" 5LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=4535377ede62550fdeaf39f595fd550a"
6PR = "r0" 6PR = "r1"
7 7
8PACKAGES =+ "${PN}-graph " 8PACKAGES =+ "${PN}-graph "
9FILES_${PN}-graph = "${bindir}/strace-graph" 9FILES_${PN}-graph = "${bindir}/strace-graph"
@@ -11,6 +11,7 @@ RDEPENDS_${PN}-graph = "perl"
11 11
12SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.xz \ 12SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.xz \
13 file://sigmask.patch \ 13 file://sigmask.patch \
14 file://strace-4.6_add_x32_support.patch \
14 " 15 "
15 16
16SRC_URI[md5sum] = "e537b2b1afeec70c0e6e27a0d0fd671e" 17SRC_URI[md5sum] = "e537b2b1afeec70c0e6e27a0d0fd671e"