Blame SOURCES/ltrace-0.7.91-aarch64.patch

92319b
diff --git a/README b/README
92319b
index 414bdfb..a04b767 100644
92319b
--- a/README
92319b
+++ b/README
92319b
@@ -24,6 +24,7 @@ The following targets are currently (at least somewhat) supported.
92319b
 Some of them may be more or less broken in reality, it is not feasible
92319b
 to test each release comprehensively on each target.
92319b
 
92319b
+	aarch64-*-linux-gnu
92319b
 	armv6l-*-linux-gnueabi
92319b
 	armv7l-*-linux-gnueabihf
92319b
 	i[4567]86-*-linux-gnu
92319b
@@ -81,7 +82,7 @@ quick one-liner), it is advisable to send an e-mail beforehand.
92319b
 
92319b
 
92319b
 -------------------------------------------------------------------------------
92319b
-Copyright (C) 2012,2013 Petr Machata <pmachata@redhat.com>
92319b
+Copyright (C) 2012-2014 Petr Machata <pmachata@redhat.com>
92319b
 Copyright (C) 1997-2009 Juan Cespedes <cespedes@debian.org>
92319b
 This file is part of ltrace.
92319b
 
92319b
diff --git a/configure.ac b/configure.ac
92319b
index c6e6bf0..0e9a124 100644
92319b
--- a/configure.ac
92319b
+++ b/configure.ac
92319b
@@ -1,6 +1,6 @@
92319b
 # -*- Autoconf -*-
92319b
 # This file is part of ltrace.
92319b
-# Copyright (C) 2010,2012,2013 Petr Machata, Red Hat Inc.
92319b
+# Copyright (C) 2010,2012,2013,2014 Petr Machata, Red Hat Inc.
92319b
 # Copyright (C) 2010,2011 Joe Damato
92319b
 # Copyright (C) 2010 Marc Kleine-Budde
92319b
 # Copyright (C) 2010 Zachary T Welch
92319b
@@ -399,6 +399,7 @@ AC_CONFIG_FILES([
92319b
 	Makefile
92319b
 	sysdeps/Makefile
92319b
 	sysdeps/linux-gnu/Makefile
92319b
+	sysdeps/linux-gnu/aarch64/Makefile
92319b
 	sysdeps/linux-gnu/alpha/Makefile
92319b
 	sysdeps/linux-gnu/arm/Makefile
92319b
 	sysdeps/linux-gnu/cris/Makefile
92319b
diff --git a/etc/libc.so.conf b/etc/libc.so.conf
92319b
index 669c50a..48b3b01 100644
92319b
--- a/etc/libc.so.conf
92319b
+++ b/etc/libc.so.conf
92319b
@@ -1,5 +1,12 @@
92319b
 # See ltrace.conf(5) for description of syntax of this file.
92319b
 
92319b
+# XXX ltrace misses long double and long long support
92319b
+typedef ldouble = double;
92319b
+typedef llong = long;
92319b
+typedef ullong = ulong;
92319b
+
92319b
+void __libc_start_main(hide(void*), hide(int), array(string, arg2));
92319b
+
92319b
 # arpa/inet.h
92319b
 typedef in_addr = struct(hex(uint));
92319b
 int inet_aton(string, +in_addr*);
92319b
@@ -233,9 +240,22 @@ void setbuffer(file,addr,ulong);
92319b
 void setlinebuf(file);
92319b
 int rename(string,string);
92319b
 
92319b
+# xlocale.h
92319b
+typedef locale_t = void*;
92319b
+locale_t newlocale(hex(int), string, locale_t);
92319b
+
92319b
 # stdlib.h
92319b
-long __strtol_internal(string,addr,int);
92319b
-ulong __strtoul_internal(string,addr,int);
92319b
+long __strtol_internal(string, +string*, int);
92319b
+ulong __strtoul_internal(string, +string*, int);
92319b
+
92319b
+double strtod(string, +string*);
92319b
+float strtof(string, +string*);
92319b
+ldouble strtold(string, +string*);
92319b
+
92319b
+double strtod_l(string, +string*, locale_t);
92319b
+float strtof_l(string, +string*, locale_t);
92319b
+ldouble strtold_l(string, +string*, locale_t);
92319b
+
92319b
 int atexit(addr);
92319b
 addr bsearch(string, addr, ulong, ulong, addr);
92319b
 addr calloc(ulong, ulong);
92319b
@@ -343,6 +363,10 @@ addr gmtime(addr);
92319b
 addr localtime(addr);
92319b
 ulong strftime(+string2,ulong,string,addr);
92319b
 long time(addr);
92319b
+# XXX in fact (time_t, long), which may be (llong, long) on 32-bit
92319b
+# arches.  We don't have llong as of this writing.
92319b
+typedef timespec = struct(long, long);
92319b
+int nanosleep(timespec*, timespec*);
92319b
 
92319b
 # unistd.h
92319b
 void _exit(int);
92319b
diff --git a/etc/syscalls.conf b/etc/syscalls.conf
92319b
index 562f4e7..09d347d 100644
92319b
--- a/etc/syscalls.conf
92319b
+++ b/etc/syscalls.conf
92319b
@@ -1,6 +1,10 @@
92319b
 # syscall.conf -- system call prototypes
92319b
 # See ltrace.conf(5) for description of syntax of this file.
92319b
 
92319b
+# Special value used to indicate the *at functions should use the
92319b
+# current working directory.
92319b
+typedef at_dirfd_t = enum[int](AT_FDCWD=-100);
92319b
+
92319b
 addr brk(addr);
92319b
 int close(int);
92319b
 int execve(string,addr,addr);
92319b
@@ -14,7 +18,7 @@ int getpid();
92319b
 addr mmap(addr,ulong,int,int,int,long);
92319b
 
92319b
 int munmap(addr,ulong);
92319b
-int open(string,int,octal);
92319b
+int open(string, hex(uint), oct(uint));
92319b
 int personality(uint);
92319b
 long read(int,+string0,ulong);
92319b
 int stat(string,addr);
92319b
@@ -113,3 +117,30 @@ ulong writev(int,addr,int);
92319b
 int mprotect(addr,int,int);
92319b
 int access(string,octal);
92319b
 int getdents(uint, void *, uint);
92319b
+
92319b
+int openat(at_dirfd_t, string, hex(uint), oct(uint));
92319b
+int mknodat(at_dirfd_t, string, oct(uint), ushort)
92319b
+int mkdirat(at_dirfd_t, string, oct(uint));
92319b
+int unlinkat(at_dirfd_t, string, hex(uint));
92319b
+int symlinkat(string, at_dirfd_t, string);
92319b
+int linkat(at_dirfd_t, string, at_dirfd_t, string, hex(uint));
92319b
+int renameat(at_dirfd_t, string, at_dirfd_t, string);
92319b
+int faccessat(at_dirfd_t, string, oct(uint), hex(uint));
92319b
+int fchmodat(at_dirfd_t, string, oct(uint), hex(uint));
92319b
+int fchownat(at_dirfd_t, string, int, int, hex(uint));
92319b
+int readlinkat(at_dirfd_t, string, +string[arg4], ulong);
92319b
+int fstatat(at_dirfd_t, string, addr, hex(uint));
92319b
+int utimensat(at_dirfd_t, string, addr, hex(uint));
92319b
+int futimens(int, addr);
92319b
+int futimesat(at_dirfd_t, string, addr);
92319b
+addr shmat(int, addr, hex(uint));
92319b
+int shmdt(addr);
92319b
+
92319b
+typedef fid_type = enum(FILEID_ROOT=0, FILEID_INO32_GEN=1, FILEID_INO32_GEN_PARENT=2, FILEID_BTRFS_WITHOUT_PARENT=0x4d, FILEID_BTRFS_WITH_PARENT=0x4e, FILEID_BTRFS_WITH_PARENT_ROOT=0x4f, FILEID_UDF_WITHOUT_PARENT=0x51, FILEID_UDF_WITH_PARENT=0x52, FILEID_NILFS_WITHOUT_PARENT=0x61, FILEID_NILFS_WITH_PARENT=0x62);
92319b
+typedef file_handle = struct(uint, fid_type, array(hex(char), elt1)*);
92319b
+int name_to_handle_at(at_dirfd_t, string, file_handle, int*, hex(uint));
92319b
+int open_by_handle_at(at_dirfd_t, file_handle, hex(uint));
92319b
+
92319b
+int newfstatat(at_dirfd_t, string, addr, hex(uint));
92319b
+int creat(string, oct(int));
92319b
+int ustat(ushort, addr);
92319b
diff --git a/sysdeps/linux-gnu/Makefile.am b/sysdeps/linux-gnu/Makefile.am
92319b
index ecee577..ec26162 100644
92319b
--- a/sysdeps/linux-gnu/Makefile.am
92319b
+++ b/sysdeps/linux-gnu/Makefile.am
92319b
@@ -1,4 +1,5 @@
92319b
 # This file is part of ltrace.
92319b
+# Copyright (C) 2014 Petr Machata, Red Hat, Inc.
92319b
 # Copyright (C) 2010,2012 Marc Kleine-Budde, Pengutronix
92319b
 #
92319b
 # This program is free software; you can redistribute it and/or
92319b
@@ -16,7 +17,8 @@
92319b
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
92319b
 # 02110-1301 USA
92319b
 
92319b
-DIST_SUBDIRS = alpha arm cris ia64 m68k metag mips ppc s390 sparc x86
92319b
+DIST_SUBDIRS = aarch64 alpha arm cris ia64 m68k metag mips ppc s390	\
92319b
+	       sparc x86
92319b
 
92319b
 SUBDIRS = \
92319b
 	$(HOST_CPU)
92319b
diff --git a/sysdeps/linux-gnu/aarch64/Makefile.am b/sysdeps/linux-gnu/aarch64/Makefile.am
92319b
new file mode 100644
92319b
index 0000000..0af4e6e
92319b
--- /dev/null
92319b
+++ b/sysdeps/linux-gnu/aarch64/Makefile.am
92319b
@@ -0,0 +1,25 @@
92319b
+# This file is part of ltrace.
92319b
+# Copyright (C) 2014 Petr Machata, Red Hat, Inc.
92319b
+#
92319b
+# This program is free software; you can redistribute it and/or
92319b
+# modify it under the terms of the GNU General Public License as
92319b
+# published by the Free Software Foundation; either version 2 of the
92319b
+# License, or (at your option) any later version.
92319b
+#
92319b
+# This program is distributed in the hope that it will be useful, but
92319b
+# WITHOUT ANY WARRANTY; without even the implied warranty of
92319b
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
92319b
+# General Public License for more details.
92319b
+#
92319b
+# You should have received a copy of the GNU General Public License
92319b
+# along with this program; if not, write to the Free Software
92319b
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
92319b
+# 02110-1301 USA
92319b
+
92319b
+noinst_LTLIBRARIES = ../libcpu.la
92319b
+
92319b
+___libcpu_la_SOURCES = fetch.c plt.c regs.c trace.c
92319b
+
92319b
+noinst_HEADERS = arch.h ptrace.h signalent.h syscallent.h
92319b
+
92319b
+MAINTAINERCLEANFILES = Makefile.in
92319b
diff --git a/sysdeps/linux-gnu/aarch64/arch.h b/sysdeps/linux-gnu/aarch64/arch.h
92319b
new file mode 100644
92319b
index 0000000..4137613
92319b
--- /dev/null
92319b
+++ b/sysdeps/linux-gnu/aarch64/arch.h
92319b
@@ -0,0 +1,37 @@
92319b
+/*
92319b
+ * This file is part of ltrace.
92319b
+ * Copyright (C) 2014 Petr Machata, Red Hat, Inc.
92319b
+ *
92319b
+ * This program is free software; you can redistribute it and/or
92319b
+ * modify it under the terms of the GNU General Public License as
92319b
+ * published by the Free Software Foundation; either version 2 of the
92319b
+ * License, or (at your option) any later version.
92319b
+ *
92319b
+ * This program is distributed in the hope that it will be useful, but
92319b
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
92319b
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
92319b
+ * General Public License for more details.
92319b
+ *
92319b
+ * You should have received a copy of the GNU General Public License
92319b
+ * along with this program; if not, write to the Free Software
92319b
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
92319b
+ * 02110-1301 USA
92319b
+ */
92319b
+#ifndef LTRACE_AARCH64_ARCH_H
92319b
+#define LTRACE_AARCH64_ARCH_H
92319b
+
92319b
+/* | 31                 21 | 20       5 | 4       0 | *
92319b
+ * | 1 1 0 1 0 1 0 0 0 0 1 |    imm16   | 0 0 0 0 0 | */
92319b
+#define BREAKPOINT_VALUE { 0xd4, 0x20, 0, 0 }
92319b
+#define BREAKPOINT_LENGTH 4
92319b
+#define DECR_PC_AFTER_BREAK 0
92319b
+
92319b
+#define LT_ELFCLASS	ELFCLASS64
92319b
+#define LT_ELF_MACHINE	EM_AARCH64
92319b
+
92319b
+#define ARCH_HAVE_FETCH_ARG
92319b
+#define ARCH_ENDIAN_BIG
92319b
+#define ARCH_HAVE_SIZEOF
92319b
+#define ARCH_HAVE_ALIGNOF
92319b
+
92319b
+#endif /* LTRACE_AARCH64_ARCH_H */
92319b
diff --git a/sysdeps/linux-gnu/aarch64/fetch.c b/sysdeps/linux-gnu/aarch64/fetch.c
92319b
new file mode 100644
92319b
index 0000000..8779f03
92319b
--- /dev/null
92319b
+++ b/sysdeps/linux-gnu/aarch64/fetch.c
92319b
@@ -0,0 +1,365 @@
92319b
+/*
92319b
+ * This file is part of ltrace.
92319b
+ * Copyright (C) 2014 Petr Machata, Red Hat, Inc.
92319b
+ *
92319b
+ * This program is free software; you can redistribute it and/or
92319b
+ * modify it under the terms of the GNU General Public License as
92319b
+ * published by the Free Software Foundation; either version 2 of the
92319b
+ * License, or (at your option) any later version.
92319b
+ *
92319b
+ * This program is distributed in the hope that it will be useful, but
92319b
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
92319b
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
92319b
+ * General Public License for more details.
92319b
+ *
92319b
+ * You should have received a copy of the GNU General Public License
92319b
+ * along with this program; if not, write to the Free Software
92319b
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
92319b
+ * 02110-1301 USA
92319b
+ */
92319b
+
92319b
+#include <sys/ptrace.h>
92319b
+#include <asm/ptrace.h>
92319b
+#include <stdlib.h>
92319b
+#include <string.h>
92319b
+
92319b
+#include "fetch.h"
92319b
+#include "proc.h"
92319b
+#include "type.h"
92319b
+#include "value.h"
92319b
+
92319b
+int aarch64_read_gregs(struct process *proc, struct user_pt_regs *regs);
92319b
+int aarch64_read_fregs(struct process *proc, struct user_fpsimd_state *regs);
92319b
+
92319b
+
92319b
+struct fetch_context
92319b
+{
92319b
+	struct user_pt_regs gregs;
92319b
+	struct user_fpsimd_state fpregs;
92319b
+	arch_addr_t nsaa;
92319b
+	unsigned ngrn;
92319b
+	unsigned nsrn;
92319b
+	arch_addr_t x8;
92319b
+};
92319b
+
92319b
+static int
92319b
+context_init(struct fetch_context *context, struct process *proc)
92319b
+{
92319b
+	if (aarch64_read_gregs(proc, &context->gregs) < 0
92319b
+	    || aarch64_read_fregs(proc, &context->fpregs) < 0)
92319b
+		return -1;
92319b
+
92319b
+	context->ngrn = 0;
92319b
+	context->nsrn = 0;
92319b
+	/* XXX double cast */
92319b
+	context->nsaa = (arch_addr_t) (uintptr_t) context->gregs.sp;
92319b
+	context->x8 = 0;
92319b
+
92319b
+	return 0;
92319b
+}
92319b
+
92319b
+struct fetch_context *
92319b
+arch_fetch_arg_clone(struct process *proc, struct fetch_context *context)
92319b
+{
92319b
+	struct fetch_context *ret = malloc(sizeof(*ret));
92319b
+	if (ret == NULL)
92319b
+		return NULL;
92319b
+	return memcpy(ret, context, sizeof(*ret));
92319b
+}
92319b
+
92319b
+static void
92319b
+fetch_next_gpr(struct fetch_context *context, unsigned char *buf)
92319b
+{
92319b
+	uint64_t u = context->gregs.regs[context->ngrn++];
92319b
+	memcpy(buf, &u, 8);
92319b
+}
92319b
+
92319b
+static int
92319b
+fetch_gpr(struct fetch_context *context, struct value *value, size_t sz)
92319b
+{
92319b
+	if (sz < 8)
92319b
+		sz = 8;
92319b
+
92319b
+	unsigned char *buf = value_reserve(value, sz);
92319b
+	if (buf == NULL)
92319b
+		return -1;
92319b
+
92319b
+	size_t i;
92319b
+	for (i = 0; i < sz; i += 8)
92319b
+		fetch_next_gpr(context, buf + i);
92319b
+
92319b
+	return 0;
92319b
+}
92319b
+
92319b
+static void
92319b
+fetch_next_sse(struct fetch_context *context, unsigned char *buf, size_t sz)
92319b
+{
92319b
+	__int128 u = context->fpregs.vregs[context->nsrn++];
92319b
+	memcpy(buf, &u, sz);
92319b
+}
92319b
+
92319b
+static int
92319b
+fetch_sse(struct fetch_context *context, struct value *value, size_t sz)
92319b
+{
92319b
+	unsigned char *buf = value_reserve(value, sz);
92319b
+	if (buf == NULL)
92319b
+		return -1;
92319b
+
92319b
+	fetch_next_sse(context, buf, sz);
92319b
+	return 0;
92319b
+}
92319b
+
92319b
+static int
92319b
+fetch_hfa(struct fetch_context *context,
92319b
+	  struct value *value, struct arg_type_info *hfa_t, size_t count)
92319b
+{
92319b
+	size_t sz = type_sizeof(value->inferior, hfa_t);
92319b
+	unsigned char *buf = value_reserve(value, sz * count);
92319b
+	if (buf == NULL)
92319b
+		return -1;
92319b
+
92319b
+	size_t i;
92319b
+	for (i = 0; i < count; ++i) {
92319b
+		fetch_next_sse(context, buf, sz);
92319b
+		buf += sz;
92319b
+	}
92319b
+	return 0;
92319b
+}
92319b
+
92319b
+static int
92319b
+fetch_stack(struct fetch_context *context, struct value *value,
92319b
+	    size_t align, size_t sz)
92319b
+{
92319b
+	if (align < 8)
92319b
+		align = 8;
92319b
+	size_t amount = ((sz + align - 1) / align) * align;
92319b
+
92319b
+	/* XXX double casts */
92319b
+	uintptr_t sp = (uintptr_t) context->nsaa;
92319b
+	sp = ((sp + align - 1) / align) * align;
92319b
+
92319b
+	value_in_inferior(value, (arch_addr_t) sp);
92319b
+
92319b
+	sp += amount;
92319b
+	context->nsaa = (arch_addr_t) sp;
92319b
+
92319b
+	return 0;
92319b
+}
92319b
+
92319b
+enum convert_method {
92319b
+	CVT_ERR = -1,
92319b
+	CVT_NOP = 0,
92319b
+	CVT_BYREF,
92319b
+};
92319b
+
92319b
+enum fetch_method {
92319b
+	FETCH_NOP,
92319b
+	FETCH_STACK,
92319b
+	FETCH_GPR,
92319b
+	FETCH_SSE,
92319b
+	FETCH_HFA,
92319b
+};
92319b
+
92319b
+struct fetch_script {
92319b
+	enum convert_method c;
92319b
+	enum fetch_method f;
92319b
+	size_t sz;
92319b
+	struct arg_type_info *hfa_t;
92319b
+	size_t count;
92319b
+};
92319b
+
92319b
+static struct fetch_script
92319b
+pass_arg(struct fetch_context const *context,
92319b
+	 struct process *proc, struct arg_type_info *info)
92319b
+{
92319b
+	enum fetch_method cvt = CVT_NOP;
92319b
+
92319b
+	size_t sz = type_sizeof(proc, info);
92319b
+	if (sz == (size_t) -1)
92319b
+		return (struct fetch_script) { CVT_ERR, FETCH_NOP, sz };
92319b
+
92319b
+	switch (info->type) {
92319b
+	case ARGTYPE_VOID:
92319b
+		return (struct fetch_script) { cvt, FETCH_NOP, sz };
92319b
+
92319b
+	case ARGTYPE_STRUCT:
92319b
+	case ARGTYPE_ARRAY:;
92319b
+		size_t count;
92319b
+		struct arg_type_info *hfa_t = type_get_hfa_type(info, &count);
92319b
+		if (hfa_t != NULL && count <= 4) {
92319b
+			if (context->nsrn + count <= 8)
92319b
+				return (struct fetch_script)
92319b
+					{ cvt, FETCH_HFA, sz, hfa_t, count };
92319b
+			return (struct fetch_script)
92319b
+				{ cvt, FETCH_STACK, sz, hfa_t, count };
92319b
+		}
92319b
+
92319b
+		if (sz <= 16) {
92319b
+			size_t count = sz / 8;
92319b
+			if (context->ngrn + count <= 8)
92319b
+				return (struct fetch_script)
92319b
+					{ cvt, FETCH_GPR, sz };
92319b
+		}
92319b
+
92319b
+		cvt = CVT_BYREF;
92319b
+		sz = 8;
92319b
+		/* Fall through.  */
92319b
+
92319b
+	case ARGTYPE_POINTER:
92319b
+	case ARGTYPE_INT:
92319b
+	case ARGTYPE_UINT:
92319b
+	case ARGTYPE_LONG:
92319b
+	case ARGTYPE_ULONG:
92319b
+	case ARGTYPE_CHAR:
92319b
+	case ARGTYPE_SHORT:
92319b
+	case ARGTYPE_USHORT:
92319b
+		if (context->ngrn < 8 && sz <= 8)
92319b
+			return (struct fetch_script) { cvt, FETCH_GPR, sz };
92319b
+		/* We don't support types wider than 8 bytes as of
92319b
+		 * now.  */
92319b
+		assert(sz <= 8);
92319b
+
92319b
+		return (struct fetch_script) { cvt, FETCH_STACK, sz };
92319b
+
92319b
+	case ARGTYPE_FLOAT:
92319b
+	case ARGTYPE_DOUBLE:
92319b
+		if (context->nsrn < 8) {
92319b
+			/* ltrace doesn't support float128.  */
92319b
+			assert(sz <= 8);
92319b
+			return (struct fetch_script) { cvt, FETCH_SSE, sz };
92319b
+		}
92319b
+
92319b
+		return (struct fetch_script) { cvt, FETCH_STACK, sz };
92319b
+	}
92319b
+
92319b
+	assert(! "Failed to allocate argument.");
92319b
+	abort();
92319b
+}
92319b
+
92319b
+static int
92319b
+convert_arg(struct value *value, struct fetch_script how)
92319b
+{
92319b
+	switch (how.c) {
92319b
+	case CVT_NOP:
92319b
+		return 0;
92319b
+	case CVT_BYREF:
92319b
+		return value_pass_by_reference(value);
92319b
+	case CVT_ERR:
92319b
+		return -1;
92319b
+	}
92319b
+
92319b
+	assert(! "Don't know how to convert argument.");
92319b
+	abort();
92319b
+}
92319b
+
92319b
+static int
92319b
+fetch_arg(struct fetch_context *context,
92319b
+	  struct process *proc, struct arg_type_info *info,
92319b
+	  struct value *value, struct fetch_script how)
92319b
+{
92319b
+	if (convert_arg(value, how) < 0)
92319b
+		return -1;
92319b
+
92319b
+	switch (how.f) {
92319b
+	case FETCH_NOP:
92319b
+		return 0;
92319b
+
92319b
+	case FETCH_STACK:
92319b
+		if (how.hfa_t != NULL && how.count != 0 && how.count <= 8)
92319b
+			context->nsrn = 8;
92319b
+		return fetch_stack(context, value,
92319b
+				   type_alignof(proc, info), how.sz);
92319b
+
92319b
+	case FETCH_GPR:
92319b
+		return fetch_gpr(context, value, how.sz);
92319b
+
92319b
+	case FETCH_SSE:
92319b
+		return fetch_sse(context, value, how.sz);
92319b
+
92319b
+	case FETCH_HFA:
92319b
+		return fetch_hfa(context, value, how.hfa_t, how.count);
92319b
+	}
92319b
+
92319b
+	assert(! "Don't know how to fetch argument.");
92319b
+	abort();
92319b
+}
92319b
+
92319b
+struct fetch_context *
92319b
+arch_fetch_arg_init(enum tof type, struct process *proc,
92319b
+		    struct arg_type_info *ret_info)
92319b
+{
92319b
+	struct fetch_context *context = malloc(sizeof *context);
92319b
+	if (context == NULL || context_init(context, proc) < 0) {
92319b
+	fail:
92319b
+		free(context);
92319b
+		return NULL;
92319b
+	}
92319b
+
92319b
+	/* There's a provision in ARMv8 parameter passing convention
92319b
+	 * for returning types that, if passed as first argument to a
92319b
+	 * function, would be passed on stack.  For those types, x8
92319b
+	 * contains an address where the return argument should be
92319b
+	 * placed.  The callee doesn't need to preserve the value of
92319b
+	 * x8, so we need to fetch it now.
92319b
+	 *
92319b
+	 * To my knowledge, there are currently no types where this
92319b
+	 * holds, but the code is here, utterly untested.  */
92319b
+
92319b
+	struct fetch_script how = pass_arg(context, proc, ret_info);
92319b
+	if (how.c == CVT_ERR)
92319b
+		goto fail;
92319b
+	if (how.c == CVT_NOP && how.f == FETCH_STACK) {
92319b
+		/* XXX double cast.  */
92319b
+		context->x8 = (arch_addr_t) (uintptr_t) context->gregs.regs[8];
92319b
+		/* See the comment above about the assert.  */
92319b
+		assert(! "Unexpected: first argument passed on stack.");
92319b
+		abort();
92319b
+	}
92319b
+
92319b
+	return context;
92319b
+}
92319b
+
92319b
+int
92319b
+arch_fetch_arg_next(struct fetch_context *context, enum tof type,
92319b
+		    struct process *proc, struct arg_type_info *info,
92319b
+		    struct value *value)
92319b
+{
92319b
+	return fetch_arg(context, proc, info, value,
92319b
+			 pass_arg(context, proc, info));
92319b
+}
92319b
+
92319b
+int
92319b
+arch_fetch_retval(struct fetch_context *context, enum tof type,
92319b
+		  struct process *proc, struct arg_type_info *info,
92319b
+		  struct value *value)
92319b
+{
92319b
+	if (context->x8 != 0) {
92319b
+		value_in_inferior(value, context->x8);
92319b
+		return 0;
92319b
+	}
92319b
+
92319b
+	if (context_init(context, proc) < 0)
92319b
+		return -1;
92319b
+
92319b
+	return fetch_arg(context, proc, info, value,
92319b
+			 pass_arg(context, proc, info));
92319b
+}
92319b
+
92319b
+void
92319b
+arch_fetch_arg_done(struct fetch_context *context)
92319b
+{
92319b
+	if (context != NULL)
92319b
+		free(context);
92319b
+}
92319b
+
92319b
+size_t
92319b
+arch_type_sizeof(struct process *proc, struct arg_type_info *arg)
92319b
+{
92319b
+	return (size_t) -2;
92319b
+}
92319b
+
92319b
+size_t
92319b
+arch_type_alignof(struct process *proc, struct arg_type_info *arg)
92319b
+{
92319b
+	return (size_t) -2;
92319b
+}
92319b
diff --git a/sysdeps/linux-gnu/aarch64/plt.c b/sysdeps/linux-gnu/aarch64/plt.c
92319b
new file mode 100644
92319b
index 0000000..29dc4c9
92319b
--- /dev/null
92319b
+++ b/sysdeps/linux-gnu/aarch64/plt.c
92319b
@@ -0,0 +1,38 @@
92319b
+/*
92319b
+ * This file is part of ltrace.
92319b
+ * Copyright (C) 2014 Petr Machata, Red Hat, Inc.
92319b
+ *
92319b
+ * This program is free software; you can redistribute it and/or
92319b
+ * modify it under the terms of the GNU General Public License as
92319b
+ * published by the Free Software Foundation; either version 2 of the
92319b
+ * License, or (at your option) any later version.
92319b
+ *
92319b
+ * This program is distributed in the hope that it will be useful, but
92319b
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
92319b
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
92319b
+ * General Public License for more details.
92319b
+ *
92319b
+ * You should have received a copy of the GNU General Public License
92319b
+ * along with this program; if not, write to the Free Software
92319b
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
92319b
+ * 02110-1301 USA
92319b
+ */
92319b
+
92319b
+#include <gelf.h>
92319b
+
92319b
+#include "backend.h"
92319b
+#include "proc.h"
92319b
+#include "library.h"
92319b
+#include "ltrace-elf.h"
92319b
+
92319b
+arch_addr_t
92319b
+sym2addr(struct process *proc, struct library_symbol *sym)
92319b
+{
92319b
+	return sym->enter_addr;
92319b
+}
92319b
+
92319b
+GElf_Addr
92319b
+arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela *rela)
92319b
+{
92319b
+	return lte->plt_addr + 32 + ndx * 16;
92319b
+}
92319b
diff --git a/sysdeps/linux-gnu/aarch64/ptrace.h b/sysdeps/linux-gnu/aarch64/ptrace.h
92319b
new file mode 100644
92319b
index 0000000..283c314
92319b
--- /dev/null
92319b
+++ b/sysdeps/linux-gnu/aarch64/ptrace.h
92319b
@@ -0,0 +1,22 @@
92319b
+/*
92319b
+ * This file is part of ltrace.
92319b
+ * Copyright (C) 2014 Petr Machata, Red Hat, Inc.
92319b
+ *
92319b
+ * This program is free software; you can redistribute it and/or
92319b
+ * modify it under the terms of the GNU General Public License as
92319b
+ * published by the Free Software Foundation; either version 2 of the
92319b
+ * License, or (at your option) any later version.
92319b
+ *
92319b
+ * This program is distributed in the hope that it will be useful, but
92319b
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
92319b
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
92319b
+ * General Public License for more details.
92319b
+ *
92319b
+ * You should have received a copy of the GNU General Public License
92319b
+ * along with this program; if not, write to the Free Software
92319b
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
92319b
+ * 02110-1301 USA
92319b
+ */
92319b
+
92319b
+#include <sys/ptrace.h>
92319b
+#include <asm/ptrace.h>
92319b
diff --git a/sysdeps/linux-gnu/aarch64/regs.c b/sysdeps/linux-gnu/aarch64/regs.c
92319b
new file mode 100644
92319b
index 0000000..06eb72b
92319b
--- /dev/null
92319b
+++ b/sysdeps/linux-gnu/aarch64/regs.c
92319b
@@ -0,0 +1,131 @@
92319b
+/*
92319b
+ * This file is part of ltrace.
92319b
+ * Copyright (C) 2014 Petr Machata, Red Hat, Inc.
92319b
+ *
92319b
+ * This program is free software; you can redistribute it and/or
92319b
+ * modify it under the terms of the GNU General Public License as
92319b
+ * published by the Free Software Foundation; either version 2 of the
92319b
+ * License, or (at your option) any later version.
92319b
+ *
92319b
+ * This program is distributed in the hope that it will be useful, but
92319b
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
92319b
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
92319b
+ * General Public License for more details.
92319b
+ *
92319b
+ * You should have received a copy of the GNU General Public License
92319b
+ * along with this program; if not, write to the Free Software
92319b
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
92319b
+ * 02110-1301 USA
92319b
+ */
92319b
+
92319b
+#include <sys/ptrace.h>
92319b
+#include <asm/ptrace.h>
92319b
+#include <linux/uio.h>
92319b
+#include <assert.h>
92319b
+#include <stdlib.h>
92319b
+#include <stdio.h>
92319b
+
92319b
+#include "backend.h"
92319b
+#include "proc.h"
92319b
+
92319b
+#define PC_OFF (32 * 4)
92319b
+
92319b
+int
92319b
+aarch64_read_gregs(struct process *proc, struct user_pt_regs *regs)
92319b
+{
92319b
+	*regs = (struct user_pt_regs) {};
92319b
+	struct iovec iovec;
92319b
+	iovec.iov_base = regs;
92319b
+	iovec.iov_len = sizeof *regs;
92319b
+	return ptrace(PTRACE_GETREGSET, proc->pid, NT_PRSTATUS, &iovec) < 0
92319b
+		? -1 : 0;
92319b
+}
92319b
+
92319b
+int
92319b
+aarch64_write_gregs(struct process *proc, struct user_pt_regs *regs)
92319b
+{
92319b
+	struct iovec iovec;
92319b
+	iovec.iov_base = regs;
92319b
+	iovec.iov_len = sizeof *regs;
92319b
+	return ptrace(PTRACE_SETREGSET, proc->pid, NT_PRSTATUS, &iovec) < 0
92319b
+		? -1 : 0;
92319b
+}
92319b
+
92319b
+int
92319b
+aarch64_read_fregs(struct process *proc, struct user_fpsimd_state *regs)
92319b
+{
92319b
+	*regs = (struct user_fpsimd_state) {};
92319b
+	struct iovec iovec;
92319b
+	iovec.iov_base = regs;
92319b
+	iovec.iov_len = sizeof *regs;
92319b
+	return ptrace(PTRACE_GETREGSET, proc->pid, NT_FPREGSET, &iovec) < 0
92319b
+		? -1 : 0;
92319b
+}
92319b
+
92319b
+arch_addr_t
92319b
+get_instruction_pointer(struct process *proc)
92319b
+{
92319b
+	struct user_pt_regs regs;
92319b
+	if (aarch64_read_gregs(proc, &regs) < 0) {
92319b
+		fprintf(stderr, "get_instruction_pointer: "
92319b
+			"Couldn't read registers of %d.\n", proc->pid);
92319b
+		return 0;
92319b
+	}
92319b
+
92319b
+	/* 
92319b
+	char buf[128];
92319b
+	sprintf(buf, "cat /proc/%d/maps", proc->pid);
92319b
+	system(buf);
92319b
+	*/
92319b
+
92319b
+	/* XXX double cast */
92319b
+	return (arch_addr_t) (uintptr_t) regs.pc;
92319b
+}
92319b
+
92319b
+void
92319b
+set_instruction_pointer(struct process *proc, arch_addr_t addr)
92319b
+{
92319b
+	struct user_pt_regs regs;
92319b
+	if (aarch64_read_gregs(proc, &regs) < 0) {
92319b
+		fprintf(stderr, "get_instruction_pointer: "
92319b
+			"Couldn't read registers of %d.\n", proc->pid);
92319b
+		return;
92319b
+	}
92319b
+
92319b
+	/* XXX double cast */
92319b
+	regs.pc = (uint64_t) (uintptr_t) addr;
92319b
+
92319b
+	if (aarch64_write_gregs(proc, &regs) < 0) {
92319b
+		fprintf(stderr, "get_instruction_pointer: "
92319b
+			"Couldn't write registers of %d.\n", proc->pid);
92319b
+		return;
92319b
+	}
92319b
+}
92319b
+
92319b
+arch_addr_t
92319b
+get_stack_pointer(struct process *proc)
92319b
+{
92319b
+	struct user_pt_regs regs;
92319b
+	if (aarch64_read_gregs(proc, &regs) < 0) {
92319b
+		fprintf(stderr, "get_stack_pointer: "
92319b
+			"Couldn't read registers of %d.\n", proc->pid);
92319b
+		return 0;
92319b
+	}
92319b
+
92319b
+	/* XXX double cast */
92319b
+	return (arch_addr_t) (uintptr_t) regs.sp;
92319b
+}
92319b
+
92319b
+arch_addr_t
92319b
+get_return_addr(struct process *proc, arch_addr_t stack_pointer)
92319b
+{
92319b
+	struct user_pt_regs regs;
92319b
+	if (aarch64_read_gregs(proc, &regs) < 0) {
92319b
+		fprintf(stderr, "get_return_addr: "
92319b
+			"Couldn't read registers of %d.\n", proc->pid);
92319b
+		return 0;
92319b
+	}
92319b
+
92319b
+	/* XXX double cast */
92319b
+	return (arch_addr_t) (uintptr_t) regs.regs[30];
92319b
+}
92319b
diff --git a/sysdeps/linux-gnu/aarch64/signalent.h b/sysdeps/linux-gnu/aarch64/signalent.h
92319b
new file mode 100644
92319b
index 0000000..bf56ebc
92319b
--- /dev/null
92319b
+++ b/sysdeps/linux-gnu/aarch64/signalent.h
92319b
@@ -0,0 +1,52 @@
92319b
+/*
92319b
+ * This file is part of ltrace.
92319b
+ * Copyright (C) 2006 Ian Wienand
92319b
+ *
92319b
+ * This program is free software; you can redistribute it and/or
92319b
+ * modify it under the terms of the GNU General Public License as
92319b
+ * published by the Free Software Foundation; either version 2 of the
92319b
+ * License, or (at your option) any later version.
92319b
+ *
92319b
+ * This program is distributed in the hope that it will be useful, but
92319b
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
92319b
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
92319b
+ * General Public License for more details.
92319b
+ *
92319b
+ * You should have received a copy of the GNU General Public License
92319b
+ * along with this program; if not, write to the Free Software
92319b
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
92319b
+ * 02110-1301 USA
92319b
+ */
92319b
+
92319b
+	"SIG_0",			/* 0 */
92319b
+	"SIGHUP",			/* 1 */
92319b
+	"SIGINT",			/* 2 */
92319b
+	"SIGQUIT",			/* 3 */
92319b
+	"SIGILL",			/* 4 */
92319b
+	"SIGTRAP",			/* 5 */
92319b
+	"SIGABRT",			/* 6 */
92319b
+	"SIGBUS",			/* 7 */
92319b
+	"SIGFPE",			/* 8 */
92319b
+	"SIGKILL",			/* 9 */
92319b
+	"SIGUSR1",			/* 10 */
92319b
+	"SIGSEGV",			/* 11 */
92319b
+	"SIGUSR2",			/* 12 */
92319b
+	"SIGPIPE",			/* 13 */
92319b
+	"SIGALRM",			/* 14 */
92319b
+	"SIGTERM",			/* 15 */
92319b
+	"SIGSTKFLT",			/* 16 */
92319b
+	"SIGCHLD",			/* 17 */
92319b
+	"SIGCONT",			/* 18 */
92319b
+	"SIGSTOP",			/* 19 */
92319b
+	"SIGTSTP",			/* 20 */
92319b
+	"SIGTTIN",			/* 21 */
92319b
+	"SIGTTOU",			/* 22 */
92319b
+	"SIGURG",			/* 23 */
92319b
+	"SIGXCPU",			/* 24 */
92319b
+	"SIGXFSZ",			/* 25 */
92319b
+	"SIGVTALRM",			/* 26 */
92319b
+	"SIGPROF",			/* 27 */
92319b
+	"SIGWINCH",			/* 28 */
92319b
+	"SIGIO",			/* 29 */
92319b
+	"SIGPWR",			/* 30 */
92319b
+	"SIGSYS",			/* 31 */
92319b
diff --git a/sysdeps/linux-gnu/aarch64/syscallent.h b/sysdeps/linux-gnu/aarch64/syscallent.h
92319b
new file mode 100644
92319b
index 0000000..aca8191
92319b
--- /dev/null
92319b
+++ b/sysdeps/linux-gnu/aarch64/syscallent.h
92319b
@@ -0,0 +1,1100 @@
92319b
+/*
92319b
+ * This file is part of ltrace.
92319b
+ * Copyright (C) 2014 Petr Machata, Red Hat, Inc.
92319b
+ *
92319b
+ * This program is free software; you can redistribute it and/or
92319b
+ * modify it under the terms of the GNU General Public License as
92319b
+ * published by the Free Software Foundation; either version 2 of the
92319b
+ * License, or (at your option) any later version.
92319b
+ *
92319b
+ * This program is distributed in the hope that it will be useful, but
92319b
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
92319b
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
92319b
+ * General Public License for more details.
92319b
+ *
92319b
+ * You should have received a copy of the GNU General Public License
92319b
+ * along with this program; if not, write to the Free Software
92319b
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
92319b
+ * 02110-1301 USA
92319b
+ */
92319b
+
92319b
+	"io_setup",                        /* 0 */
92319b
+	"io_destroy",                      /* 1 */
92319b
+	"io_submit",                       /* 2 */
92319b
+	"io_cancel",                       /* 3 */
92319b
+	"io_getevents",                    /* 4 */
92319b
+	"setxattr",                        /* 5 */
92319b
+	"lsetxattr",                       /* 6 */
92319b
+	"fsetxattr",                       /* 7 */
92319b
+	"getxattr",                        /* 8 */
92319b
+	"lgetxattr",                       /* 9 */
92319b
+	"fgetxattr",                       /* 10 */
92319b
+	"listxattr",                       /* 11 */
92319b
+	"llistxattr",                      /* 12 */
92319b
+	"flistxattr",                      /* 13 */
92319b
+	"removexattr",                     /* 14 */
92319b
+	"lremovexattr",                    /* 15 */
92319b
+	"fremovexattr",                    /* 16 */
92319b
+	"getcwd",                          /* 17 */
92319b
+	"lookup_dcookie",                  /* 18 */
92319b
+	"eventfd2",                        /* 19 */
92319b
+	"epoll_create1",                   /* 20 */
92319b
+	"epoll_ctl",                       /* 21 */
92319b
+	"epoll_pwait",                     /* 22 */
92319b
+	"dup",                             /* 23 */
92319b
+	"dup3",                            /* 24 */
92319b
+	"fcntl",                           /* 25 */
92319b
+	"inotify_init1",                   /* 26 */
92319b
+	"inotify_add_watch",               /* 27 */
92319b
+	"inotify_rm_watch",                /* 28 */
92319b
+	"ioctl",                           /* 29 */
92319b
+	"ioprio_set",                      /* 30 */
92319b
+	"ioprio_get",                      /* 31 */
92319b
+	"flock",                           /* 32 */
92319b
+	"mknodat",                         /* 33 */
92319b
+	"mkdirat",                         /* 34 */
92319b
+	"unlinkat",                        /* 35 */
92319b
+	"symlinkat",                       /* 36 */
92319b
+	"linkat",                          /* 37 */
92319b
+	"renameat",                        /* 38 */
92319b
+	"umount2",                         /* 39 */
92319b
+	"mount",                           /* 40 */
92319b
+	"pivot_root",                      /* 41 */
92319b
+	"nfsservctl",                      /* 42 */
92319b
+	"statfs",                          /* 43 */
92319b
+	"fstatfs",                         /* 44 */
92319b
+	"truncate",                        /* 45 */
92319b
+	"ftruncate",                       /* 46 */
92319b
+	"fallocate",                       /* 47 */
92319b
+	"faccessat",                       /* 48 */
92319b
+	"chdir",                           /* 49 */
92319b
+	"fchdir",                          /* 50 */
92319b
+	"chroot",                          /* 51 */
92319b
+	"fchmod",                          /* 52 */
92319b
+	"fchmodat",                        /* 53 */
92319b
+	"fchownat",                        /* 54 */
92319b
+	"fchown",                          /* 55 */
92319b
+	"openat",                          /* 56 */
92319b
+	"close",                           /* 57 */
92319b
+	"vhangup",                         /* 58 */
92319b
+	"pipe2",                           /* 59 */
92319b
+	"quotactl",                        /* 60 */
92319b
+	"getdents64",                      /* 61 */
92319b
+	"lseek",                           /* 62 */
92319b
+	"read",                            /* 63 */
92319b
+	"write",                           /* 64 */
92319b
+	"readv",                           /* 65 */
92319b
+	"writev",                          /* 66 */
92319b
+	"pread64",                         /* 67 */
92319b
+	"pwrite64",                        /* 68 */
92319b
+	"preadv",                          /* 69 */
92319b
+	"pwritev",                         /* 70 */
92319b
+	"sendfile",                        /* 71 */
92319b
+	"pselect6",                        /* 72 */
92319b
+	"ppoll",                           /* 73 */
92319b
+	"signalfd4",                       /* 74 */
92319b
+	"vmsplice",                        /* 75 */
92319b
+	"splice",                          /* 76 */
92319b
+	"tee",                             /* 77 */
92319b
+	"readlinkat",                      /* 78 */
92319b
+	"fstatat",                         /* 79 */
92319b
+	"fstat",                           /* 80 */
92319b
+	"sync",                            /* 81 */
92319b
+	"fsync",                           /* 82 */
92319b
+	"fdatasync",                       /* 83 */
92319b
+	"sync_file_range",                 /* 84 */
92319b
+	"timerfd_create",                  /* 85 */
92319b
+	"timerfd_settime",                 /* 86 */
92319b
+	"timerfd_gettime",                 /* 87 */
92319b
+	"utimensat",                       /* 88 */
92319b
+	"acct",                            /* 89 */
92319b
+	"capget",                          /* 90 */
92319b
+	"capset",                          /* 91 */
92319b
+	"personality",                     /* 92 */
92319b
+	"exit",                            /* 93 */
92319b
+	"exit_group",                      /* 94 */
92319b
+	"waitid",                          /* 95 */
92319b
+	"set_tid_address",                 /* 96 */
92319b
+	"unshare",                         /* 97 */
92319b
+	"futex",                           /* 98 */
92319b
+	"set_robust_list",                 /* 99 */
92319b
+	"get_robust_list",                 /* 100 */
92319b
+	"nanosleep",                       /* 101 */
92319b
+	"getitimer",                       /* 102 */
92319b
+	"setitimer",                       /* 103 */
92319b
+	"kexec_load",                      /* 104 */
92319b
+	"init_module",                     /* 105 */
92319b
+	"delete_module",                   /* 106 */
92319b
+	"timer_create",                    /* 107 */
92319b
+	"timer_gettime",                   /* 108 */
92319b
+	"timer_getoverrun",                /* 109 */
92319b
+	"timer_settime",                   /* 110 */
92319b
+	"timer_delete",                    /* 111 */
92319b
+	"clock_settime",                   /* 112 */
92319b
+	"clock_gettime",                   /* 113 */
92319b
+	"clock_getres",                    /* 114 */
92319b
+	"clock_nanosleep",                 /* 115 */
92319b
+	"syslog",                          /* 116 */
92319b
+	"ptrace",                          /* 117 */
92319b
+	"sched_setparam",                  /* 118 */
92319b
+	"sched_setscheduler",              /* 119 */
92319b
+	"sched_getscheduler",              /* 120 */
92319b
+	"sched_getparam",                  /* 121 */
92319b
+	"sched_setaffinity",               /* 122 */
92319b
+	"sched_getaffinity",               /* 123 */
92319b
+	"sched_yield",                     /* 124 */
92319b
+	"sched_get_priority_max",          /* 125 */
92319b
+	"sched_get_priority_min",          /* 126 */
92319b
+	"sched_rr_get_interval",           /* 127 */
92319b
+	"restart_syscall",                 /* 128 */
92319b
+	"kill",                            /* 129 */
92319b
+	"tkill",                           /* 130 */
92319b
+	"tgkill",                          /* 131 */
92319b
+	"sigaltstack",                     /* 132 */
92319b
+	"rt_sigsuspend",                   /* 133 */
92319b
+	"rt_sigaction",                    /* 134 */
92319b
+	"rt_sigprocmask",                  /* 135 */
92319b
+	"rt_sigpending",                   /* 136 */
92319b
+	"rt_sigtimedwait",                 /* 137 */
92319b
+	"rt_sigqueueinfo",                 /* 138 */
92319b
+	"rt_sigreturn",                    /* 139 */
92319b
+	"setpriority",                     /* 140 */
92319b
+	"getpriority",                     /* 141 */
92319b
+	"reboot",                          /* 142 */
92319b
+	"setregid",                        /* 143 */
92319b
+	"setgid",                          /* 144 */
92319b
+	"setreuid",                        /* 145 */
92319b
+	"setuid",                          /* 146 */
92319b
+	"setresuid",                       /* 147 */
92319b
+	"getresuid",                       /* 148 */
92319b
+	"setresgid",                       /* 149 */
92319b
+	"getresgid",                       /* 150 */
92319b
+	"setfsuid",                        /* 151 */
92319b
+	"setfsgid",                        /* 152 */
92319b
+	"times",                           /* 153 */
92319b
+	"setpgid",                         /* 154 */
92319b
+	"getpgid",                         /* 155 */
92319b
+	"getsid",                          /* 156 */
92319b
+	"setsid",                          /* 157 */
92319b
+	"getgroups",                       /* 158 */
92319b
+	"setgroups",                       /* 159 */
92319b
+	"uname",                           /* 160 */
92319b
+	"sethostname",                     /* 161 */
92319b
+	"setdomainname",                   /* 162 */
92319b
+	"getrlimit",                       /* 163 */
92319b
+	"setrlimit",                       /* 164 */
92319b
+	"getrusage",                       /* 165 */
92319b
+	"umask",                           /* 166 */
92319b
+	"prctl",                           /* 167 */
92319b
+	"getcpu",                          /* 168 */
92319b
+	"gettimeofday",                    /* 169 */
92319b
+	"settimeofday",                    /* 170 */
92319b
+	"adjtimex",                        /* 171 */
92319b
+	"getpid",                          /* 172 */
92319b
+	"getppid",                         /* 173 */
92319b
+	"getuid",                          /* 174 */
92319b
+	"geteuid",                         /* 175 */
92319b
+	"getgid",                          /* 176 */
92319b
+	"getegid",                         /* 177 */
92319b
+	"gettid",                          /* 178 */
92319b
+	"sysinfo",                         /* 179 */
92319b
+	"mq_open",                         /* 180 */
92319b
+	"mq_unlink",                       /* 181 */
92319b
+	"mq_timedsend",                    /* 182 */
92319b
+	"mq_timedreceive",                 /* 183 */
92319b
+	"mq_notify",                       /* 184 */
92319b
+	"mq_getsetattr",                   /* 185 */
92319b
+	"msgget",                          /* 186 */
92319b
+	"msgctl",                          /* 187 */
92319b
+	"msgrcv",                          /* 188 */
92319b
+	"msgsnd",                          /* 189 */
92319b
+	"semget",                          /* 190 */
92319b
+	"semctl",                          /* 191 */
92319b
+	"semtimedop",                      /* 192 */
92319b
+	"semop",                           /* 193 */
92319b
+	"shmget",                          /* 194 */
92319b
+	"shmctl",                          /* 195 */
92319b
+	"shmat",                           /* 196 */
92319b
+	"shmdt",                           /* 197 */
92319b
+	"socket",                          /* 198 */
92319b
+	"socketpair",                      /* 199 */
92319b
+	"bind",                            /* 200 */
92319b
+	"listen",                          /* 201 */
92319b
+	"accept",                          /* 202 */
92319b
+	"connect",                         /* 203 */
92319b
+	"getsockname",                     /* 204 */
92319b
+	"getpeername",                     /* 205 */
92319b
+	"sendto",                          /* 206 */
92319b
+	"recvfrom",                        /* 207 */
92319b
+	"setsockopt",                      /* 208 */
92319b
+	"getsockopt",                      /* 209 */
92319b
+	"shutdown",                        /* 210 */
92319b
+	"sendmsg",                         /* 211 */
92319b
+	"recvmsg",                         /* 212 */
92319b
+	"readahead",                       /* 213 */
92319b
+	"brk",                             /* 214 */
92319b
+	"munmap",                          /* 215 */
92319b
+	"mremap",                          /* 216 */
92319b
+	"add_key",                         /* 217 */
92319b
+	"request_key",                     /* 218 */
92319b
+	"keyctl",                          /* 219 */
92319b
+	"clone",                           /* 220 */
92319b
+	"execve",                          /* 221 */
92319b
+	"mmap",                            /* 222 */
92319b
+	"fadvise64",                       /* 223 */
92319b
+	"swapon",                          /* 224 */
92319b
+	"swapoff",                         /* 225 */
92319b
+	"mprotect",                        /* 226 */
92319b
+	"msync",                           /* 227 */
92319b
+	"mlock",                           /* 228 */
92319b
+	"munlock",                         /* 229 */
92319b
+	"mlockall",                        /* 230 */
92319b
+	"munlockall",                      /* 231 */
92319b
+	"mincore",                         /* 232 */
92319b
+	"madvise",                         /* 233 */
92319b
+	"remap_file_pages",                /* 234 */
92319b
+	"mbind",                           /* 235 */
92319b
+	"get_mempolicy",                   /* 236 */
92319b
+	"set_mempolicy",                   /* 237 */
92319b
+	"migrate_pages",                   /* 238 */
92319b
+	"move_pages",                      /* 239 */
92319b
+	"rt_tgsigqueueinfo",               /* 240 */
92319b
+	"perf_event_open",                 /* 241 */
92319b
+	"accept4",                         /* 242 */
92319b
+	"recvmmsg",                        /* 243 */
92319b
+	"arch_specific_syscall",           /* 244 */
92319b
+	"245",                             /* 245 */
92319b
+	"246",                             /* 246 */
92319b
+	"247",                             /* 247 */
92319b
+	"248",                             /* 248 */
92319b
+	"249",                             /* 249 */
92319b
+	"250",                             /* 250 */
92319b
+	"251",                             /* 251 */
92319b
+	"252",                             /* 252 */
92319b
+	"253",                             /* 253 */
92319b
+	"254",                             /* 254 */
92319b
+	"255",                             /* 255 */
92319b
+	"256",                             /* 256 */
92319b
+	"257",                             /* 257 */
92319b
+	"258",                             /* 258 */
92319b
+	"259",                             /* 259 */
92319b
+	"wait4",                           /* 260 */
92319b
+	"prlimit64",                       /* 261 */
92319b
+	"fanotify_init",                   /* 262 */
92319b
+	"fanotify_mark",                   /* 263 */
92319b
+	"name_to_handle_at",               /* 264 */
92319b
+	"open_by_handle_at",               /* 265 */
92319b
+	"clock_adjtime",                   /* 266 */
92319b
+	"syncfs",                          /* 267 */
92319b
+	"setns",                           /* 268 */
92319b
+	"sendmmsg",                        /* 269 */
92319b
+	"process_vm_readv",                /* 270 */
92319b
+	"process_vm_writev",               /* 271 */
92319b
+	"kcmp",                            /* 272 */
92319b
+	"finit_module",                    /* 273 */
92319b
+	"syscalls",                        /* 274 */
92319b
+	"275",                             /* 275 */
92319b
+	"276",                             /* 276 */
92319b
+	"277",                             /* 277 */
92319b
+	"278",                             /* 278 */
92319b
+	"279",                             /* 279 */
92319b
+	"280",                             /* 280 */
92319b
+	"281",                             /* 281 */
92319b
+	"282",                             /* 282 */
92319b
+	"283",                             /* 283 */
92319b
+	"284",                             /* 284 */
92319b
+	"285",                             /* 285 */
92319b
+	"286",                             /* 286 */
92319b
+	"287",                             /* 287 */
92319b
+	"288",                             /* 288 */
92319b
+	"289",                             /* 289 */
92319b
+	"290",                             /* 290 */
92319b
+	"291",                             /* 291 */
92319b
+	"292",                             /* 292 */
92319b
+	"293",                             /* 293 */
92319b
+	"294",                             /* 294 */
92319b
+	"295",                             /* 295 */
92319b
+	"296",                             /* 296 */
92319b
+	"297",                             /* 297 */
92319b
+	"298",                             /* 298 */
92319b
+	"299",                             /* 299 */
92319b
+	"300",                             /* 300 */
92319b
+	"301",                             /* 301 */
92319b
+	"302",                             /* 302 */
92319b
+	"303",                             /* 303 */
92319b
+	"304",                             /* 304 */
92319b
+	"305",                             /* 305 */
92319b
+	"306",                             /* 306 */
92319b
+	"307",                             /* 307 */
92319b
+	"308",                             /* 308 */
92319b
+	"309",                             /* 309 */
92319b
+	"310",                             /* 310 */
92319b
+	"311",                             /* 311 */
92319b
+	"312",                             /* 312 */
92319b
+	"313",                             /* 313 */
92319b
+	"314",                             /* 314 */
92319b
+	"315",                             /* 315 */
92319b
+	"316",                             /* 316 */
92319b
+	"317",                             /* 317 */
92319b
+	"318",                             /* 318 */
92319b
+	"319",                             /* 319 */
92319b
+	"320",                             /* 320 */
92319b
+	"321",                             /* 321 */
92319b
+	"322",                             /* 322 */
92319b
+	"323",                             /* 323 */
92319b
+	"324",                             /* 324 */
92319b
+	"325",                             /* 325 */
92319b
+	"326",                             /* 326 */
92319b
+	"327",                             /* 327 */
92319b
+	"328",                             /* 328 */
92319b
+	"329",                             /* 329 */
92319b
+	"330",                             /* 330 */
92319b
+	"331",                             /* 331 */
92319b
+	"332",                             /* 332 */
92319b
+	"333",                             /* 333 */
92319b
+	"334",                             /* 334 */
92319b
+	"335",                             /* 335 */
92319b
+	"336",                             /* 336 */
92319b
+	"337",                             /* 337 */
92319b
+	"338",                             /* 338 */
92319b
+	"339",                             /* 339 */
92319b
+	"340",                             /* 340 */
92319b
+	"341",                             /* 341 */
92319b
+	"342",                             /* 342 */
92319b
+	"343",                             /* 343 */
92319b
+	"344",                             /* 344 */
92319b
+	"345",                             /* 345 */
92319b
+	"346",                             /* 346 */
92319b
+	"347",                             /* 347 */
92319b
+	"348",                             /* 348 */
92319b
+	"349",                             /* 349 */
92319b
+	"350",                             /* 350 */
92319b
+	"351",                             /* 351 */
92319b
+	"352",                             /* 352 */
92319b
+	"353",                             /* 353 */
92319b
+	"354",                             /* 354 */
92319b
+	"355",                             /* 355 */
92319b
+	"356",                             /* 356 */
92319b
+	"357",                             /* 357 */
92319b
+	"358",                             /* 358 */
92319b
+	"359",                             /* 359 */
92319b
+	"360",                             /* 360 */
92319b
+	"361",                             /* 361 */
92319b
+	"362",                             /* 362 */
92319b
+	"363",                             /* 363 */
92319b
+	"364",                             /* 364 */
92319b
+	"365",                             /* 365 */
92319b
+	"366",                             /* 366 */
92319b
+	"367",                             /* 367 */
92319b
+	"368",                             /* 368 */
92319b
+	"369",                             /* 369 */
92319b
+	"370",                             /* 370 */
92319b
+	"371",                             /* 371 */
92319b
+	"372",                             /* 372 */
92319b
+	"373",                             /* 373 */
92319b
+	"374",                             /* 374 */
92319b
+	"375",                             /* 375 */
92319b
+	"376",                             /* 376 */
92319b
+	"377",                             /* 377 */
92319b
+	"378",                             /* 378 */
92319b
+	"379",                             /* 379 */
92319b
+	"380",                             /* 380 */
92319b
+	"381",                             /* 381 */
92319b
+	"382",                             /* 382 */
92319b
+	"383",                             /* 383 */
92319b
+	"384",                             /* 384 */
92319b
+	"385",                             /* 385 */
92319b
+	"386",                             /* 386 */
92319b
+	"387",                             /* 387 */
92319b
+	"388",                             /* 388 */
92319b
+	"389",                             /* 389 */
92319b
+	"390",                             /* 390 */
92319b
+	"391",                             /* 391 */
92319b
+	"392",                             /* 392 */
92319b
+	"393",                             /* 393 */
92319b
+	"394",                             /* 394 */
92319b
+	"395",                             /* 395 */
92319b
+	"396",                             /* 396 */
92319b
+	"397",                             /* 397 */
92319b
+	"398",                             /* 398 */
92319b
+	"399",                             /* 399 */
92319b
+	"400",                             /* 400 */
92319b
+	"401",                             /* 401 */
92319b
+	"402",                             /* 402 */
92319b
+	"403",                             /* 403 */
92319b
+	"404",                             /* 404 */
92319b
+	"405",                             /* 405 */
92319b
+	"406",                             /* 406 */
92319b
+	"407",                             /* 407 */
92319b
+	"408",                             /* 408 */
92319b
+	"409",                             /* 409 */
92319b
+	"410",                             /* 410 */
92319b
+	"411",                             /* 411 */
92319b
+	"412",                             /* 412 */
92319b
+	"413",                             /* 413 */
92319b
+	"414",                             /* 414 */
92319b
+	"415",                             /* 415 */
92319b
+	"416",                             /* 416 */
92319b
+	"417",                             /* 417 */
92319b
+	"418",                             /* 418 */
92319b
+	"419",                             /* 419 */
92319b
+	"420",                             /* 420 */
92319b
+	"421",                             /* 421 */
92319b
+	"422",                             /* 422 */
92319b
+	"423",                             /* 423 */
92319b
+	"424",                             /* 424 */
92319b
+	"425",                             /* 425 */
92319b
+	"426",                             /* 426 */
92319b
+	"427",                             /* 427 */
92319b
+	"428",                             /* 428 */
92319b
+	"429",                             /* 429 */
92319b
+	"430",                             /* 430 */
92319b
+	"431",                             /* 431 */
92319b
+	"432",                             /* 432 */
92319b
+	"433",                             /* 433 */
92319b
+	"434",                             /* 434 */
92319b
+	"435",                             /* 435 */
92319b
+	"436",                             /* 436 */
92319b
+	"437",                             /* 437 */
92319b
+	"438",                             /* 438 */
92319b
+	"439",                             /* 439 */
92319b
+	"440",                             /* 440 */
92319b
+	"441",                             /* 441 */
92319b
+	"442",                             /* 442 */
92319b
+	"443",                             /* 443 */
92319b
+	"444",                             /* 444 */
92319b
+	"445",                             /* 445 */
92319b
+	"446",                             /* 446 */
92319b
+	"447",                             /* 447 */
92319b
+	"448",                             /* 448 */
92319b
+	"449",                             /* 449 */
92319b
+	"450",                             /* 450 */
92319b
+	"451",                             /* 451 */
92319b
+	"452",                             /* 452 */
92319b
+	"453",                             /* 453 */
92319b
+	"454",                             /* 454 */
92319b
+	"455",                             /* 455 */
92319b
+	"456",                             /* 456 */
92319b
+	"457",                             /* 457 */
92319b
+	"458",                             /* 458 */
92319b
+	"459",                             /* 459 */
92319b
+	"460",                             /* 460 */
92319b
+	"461",                             /* 461 */
92319b
+	"462",                             /* 462 */
92319b
+	"463",                             /* 463 */
92319b
+	"464",                             /* 464 */
92319b
+	"465",                             /* 465 */
92319b
+	"466",                             /* 466 */
92319b
+	"467",                             /* 467 */
92319b
+	"468",                             /* 468 */
92319b
+	"469",                             /* 469 */
92319b
+	"470",                             /* 470 */
92319b
+	"471",                             /* 471 */
92319b
+	"472",                             /* 472 */
92319b
+	"473",                             /* 473 */
92319b
+	"474",                             /* 474 */
92319b
+	"475",                             /* 475 */
92319b
+	"476",                             /* 476 */
92319b
+	"477",                             /* 477 */
92319b
+	"478",                             /* 478 */
92319b
+	"479",                             /* 479 */
92319b
+	"480",                             /* 480 */
92319b
+	"481",                             /* 481 */
92319b
+	"482",                             /* 482 */
92319b
+	"483",                             /* 483 */
92319b
+	"484",                             /* 484 */
92319b
+	"485",                             /* 485 */
92319b
+	"486",                             /* 486 */
92319b
+	"487",                             /* 487 */
92319b
+	"488",                             /* 488 */
92319b
+	"489",                             /* 489 */
92319b
+	"490",                             /* 490 */
92319b
+	"491",                             /* 491 */
92319b
+	"492",                             /* 492 */
92319b
+	"493",                             /* 493 */
92319b
+	"494",                             /* 494 */
92319b
+	"495",                             /* 495 */
92319b
+	"496",                             /* 496 */
92319b
+	"497",                             /* 497 */
92319b
+	"498",                             /* 498 */
92319b
+	"499",                             /* 499 */
92319b
+	"500",                             /* 500 */
92319b
+	"501",                             /* 501 */
92319b
+	"502",                             /* 502 */
92319b
+	"503",                             /* 503 */
92319b
+	"504",                             /* 504 */
92319b
+	"505",                             /* 505 */
92319b
+	"506",                             /* 506 */
92319b
+	"507",                             /* 507 */
92319b
+	"508",                             /* 508 */
92319b
+	"509",                             /* 509 */
92319b
+	"510",                             /* 510 */
92319b
+	"511",                             /* 511 */
92319b
+	"512",                             /* 512 */
92319b
+	"513",                             /* 513 */
92319b
+	"514",                             /* 514 */
92319b
+	"515",                             /* 515 */
92319b
+	"516",                             /* 516 */
92319b
+	"517",                             /* 517 */
92319b
+	"518",                             /* 518 */
92319b
+	"519",                             /* 519 */
92319b
+	"520",                             /* 520 */
92319b
+	"521",                             /* 521 */
92319b
+	"522",                             /* 522 */
92319b
+	"523",                             /* 523 */
92319b
+	"524",                             /* 524 */
92319b
+	"525",                             /* 525 */
92319b
+	"526",                             /* 526 */
92319b
+	"527",                             /* 527 */
92319b
+	"528",                             /* 528 */
92319b
+	"529",                             /* 529 */
92319b
+	"530",                             /* 530 */
92319b
+	"531",                             /* 531 */
92319b
+	"532",                             /* 532 */
92319b
+	"533",                             /* 533 */
92319b
+	"534",                             /* 534 */
92319b
+	"535",                             /* 535 */
92319b
+	"536",                             /* 536 */
92319b
+	"537",                             /* 537 */
92319b
+	"538",                             /* 538 */
92319b
+	"539",                             /* 539 */
92319b
+	"540",                             /* 540 */
92319b
+	"541",                             /* 541 */
92319b
+	"542",                             /* 542 */
92319b
+	"543",                             /* 543 */
92319b
+	"544",                             /* 544 */
92319b
+	"545",                             /* 545 */
92319b
+	"546",                             /* 546 */
92319b
+	"547",                             /* 547 */
92319b
+	"548",                             /* 548 */
92319b
+	"549",                             /* 549 */
92319b
+	"550",                             /* 550 */
92319b
+	"551",                             /* 551 */
92319b
+	"552",                             /* 552 */
92319b
+	"553",                             /* 553 */
92319b
+	"554",                             /* 554 */
92319b
+	"555",                             /* 555 */
92319b
+	"556",                             /* 556 */
92319b
+	"557",                             /* 557 */
92319b
+	"558",                             /* 558 */
92319b
+	"559",                             /* 559 */
92319b
+	"560",                             /* 560 */
92319b
+	"561",                             /* 561 */
92319b
+	"562",                             /* 562 */
92319b
+	"563",                             /* 563 */
92319b
+	"564",                             /* 564 */
92319b
+	"565",                             /* 565 */
92319b
+	"566",                             /* 566 */
92319b
+	"567",                             /* 567 */
92319b
+	"568",                             /* 568 */
92319b
+	"569",                             /* 569 */
92319b
+	"570",                             /* 570 */
92319b
+	"571",                             /* 571 */
92319b
+	"572",                             /* 572 */
92319b
+	"573",                             /* 573 */
92319b
+	"574",                             /* 574 */
92319b
+	"575",                             /* 575 */
92319b
+	"576",                             /* 576 */
92319b
+	"577",                             /* 577 */
92319b
+	"578",                             /* 578 */
92319b
+	"579",                             /* 579 */
92319b
+	"580",                             /* 580 */
92319b
+	"581",                             /* 581 */
92319b
+	"582",                             /* 582 */
92319b
+	"583",                             /* 583 */
92319b
+	"584",                             /* 584 */
92319b
+	"585",                             /* 585 */
92319b
+	"586",                             /* 586 */
92319b
+	"587",                             /* 587 */
92319b
+	"588",                             /* 588 */
92319b
+	"589",                             /* 589 */
92319b
+	"590",                             /* 590 */
92319b
+	"591",                             /* 591 */
92319b
+	"592",                             /* 592 */
92319b
+	"593",                             /* 593 */
92319b
+	"594",                             /* 594 */
92319b
+	"595",                             /* 595 */
92319b
+	"596",                             /* 596 */
92319b
+	"597",                             /* 597 */
92319b
+	"598",                             /* 598 */
92319b
+	"599",                             /* 599 */
92319b
+	"600",                             /* 600 */
92319b
+	"601",                             /* 601 */
92319b
+	"602",                             /* 602 */
92319b
+	"603",                             /* 603 */
92319b
+	"604",                             /* 604 */
92319b
+	"605",                             /* 605 */
92319b
+	"606",                             /* 606 */
92319b
+	"607",                             /* 607 */
92319b
+	"608",                             /* 608 */
92319b
+	"609",                             /* 609 */
92319b
+	"610",                             /* 610 */
92319b
+	"611",                             /* 611 */
92319b
+	"612",                             /* 612 */
92319b
+	"613",                             /* 613 */
92319b
+	"614",                             /* 614 */
92319b
+	"615",                             /* 615 */
92319b
+	"616",                             /* 616 */
92319b
+	"617",                             /* 617 */
92319b
+	"618",                             /* 618 */
92319b
+	"619",                             /* 619 */
92319b
+	"620",                             /* 620 */
92319b
+	"621",                             /* 621 */
92319b
+	"622",                             /* 622 */
92319b
+	"623",                             /* 623 */
92319b
+	"624",                             /* 624 */
92319b
+	"625",                             /* 625 */
92319b
+	"626",                             /* 626 */
92319b
+	"627",                             /* 627 */
92319b
+	"628",                             /* 628 */
92319b
+	"629",                             /* 629 */
92319b
+	"630",                             /* 630 */
92319b
+	"631",                             /* 631 */
92319b
+	"632",                             /* 632 */
92319b
+	"633",                             /* 633 */
92319b
+	"634",                             /* 634 */
92319b
+	"635",                             /* 635 */
92319b
+	"636",                             /* 636 */
92319b
+	"637",                             /* 637 */
92319b
+	"638",                             /* 638 */
92319b
+	"639",                             /* 639 */
92319b
+	"640",                             /* 640 */
92319b
+	"641",                             /* 641 */
92319b
+	"642",                             /* 642 */
92319b
+	"643",                             /* 643 */
92319b
+	"644",                             /* 644 */
92319b
+	"645",                             /* 645 */
92319b
+	"646",                             /* 646 */
92319b
+	"647",                             /* 647 */
92319b
+	"648",                             /* 648 */
92319b
+	"649",                             /* 649 */
92319b
+	"650",                             /* 650 */
92319b
+	"651",                             /* 651 */
92319b
+	"652",                             /* 652 */
92319b
+	"653",                             /* 653 */
92319b
+	"654",                             /* 654 */
92319b
+	"655",                             /* 655 */
92319b
+	"656",                             /* 656 */
92319b
+	"657",                             /* 657 */
92319b
+	"658",                             /* 658 */
92319b
+	"659",                             /* 659 */
92319b
+	"660",                             /* 660 */
92319b
+	"661",                             /* 661 */
92319b
+	"662",                             /* 662 */
92319b
+	"663",                             /* 663 */
92319b
+	"664",                             /* 664 */
92319b
+	"665",                             /* 665 */
92319b
+	"666",                             /* 666 */
92319b
+	"667",                             /* 667 */
92319b
+	"668",                             /* 668 */
92319b
+	"669",                             /* 669 */
92319b
+	"670",                             /* 670 */
92319b
+	"671",                             /* 671 */
92319b
+	"672",                             /* 672 */
92319b
+	"673",                             /* 673 */
92319b
+	"674",                             /* 674 */
92319b
+	"675",                             /* 675 */
92319b
+	"676",                             /* 676 */
92319b
+	"677",                             /* 677 */
92319b
+	"678",                             /* 678 */
92319b
+	"679",                             /* 679 */
92319b
+	"680",                             /* 680 */
92319b
+	"681",                             /* 681 */
92319b
+	"682",                             /* 682 */
92319b
+	"683",                             /* 683 */
92319b
+	"684",                             /* 684 */
92319b
+	"685",                             /* 685 */
92319b
+	"686",                             /* 686 */
92319b
+	"687",                             /* 687 */
92319b
+	"688",                             /* 688 */
92319b
+	"689",                             /* 689 */
92319b
+	"690",                             /* 690 */
92319b
+	"691",                             /* 691 */
92319b
+	"692",                             /* 692 */
92319b
+	"693",                             /* 693 */
92319b
+	"694",                             /* 694 */
92319b
+	"695",                             /* 695 */
92319b
+	"696",                             /* 696 */
92319b
+	"697",                             /* 697 */
92319b
+	"698",                             /* 698 */
92319b
+	"699",                             /* 699 */
92319b
+	"700",                             /* 700 */
92319b
+	"701",                             /* 701 */
92319b
+	"702",                             /* 702 */
92319b
+	"703",                             /* 703 */
92319b
+	"704",                             /* 704 */
92319b
+	"705",                             /* 705 */
92319b
+	"706",                             /* 706 */
92319b
+	"707",                             /* 707 */
92319b
+	"708",                             /* 708 */
92319b
+	"709",                             /* 709 */
92319b
+	"710",                             /* 710 */
92319b
+	"711",                             /* 711 */
92319b
+	"712",                             /* 712 */
92319b
+	"713",                             /* 713 */
92319b
+	"714",                             /* 714 */
92319b
+	"715",                             /* 715 */
92319b
+	"716",                             /* 716 */
92319b
+	"717",                             /* 717 */
92319b
+	"718",                             /* 718 */
92319b
+	"719",                             /* 719 */
92319b
+	"720",                             /* 720 */
92319b
+	"721",                             /* 721 */
92319b
+	"722",                             /* 722 */
92319b
+	"723",                             /* 723 */
92319b
+	"724",                             /* 724 */
92319b
+	"725",                             /* 725 */
92319b
+	"726",                             /* 726 */
92319b
+	"727",                             /* 727 */
92319b
+	"728",                             /* 728 */
92319b
+	"729",                             /* 729 */
92319b
+	"730",                             /* 730 */
92319b
+	"731",                             /* 731 */
92319b
+	"732",                             /* 732 */
92319b
+	"733",                             /* 733 */
92319b
+	"734",                             /* 734 */
92319b
+	"735",                             /* 735 */
92319b
+	"736",                             /* 736 */
92319b
+	"737",                             /* 737 */
92319b
+	"738",                             /* 738 */
92319b
+	"739",                             /* 739 */
92319b
+	"740",                             /* 740 */
92319b
+	"741",                             /* 741 */
92319b
+	"742",                             /* 742 */
92319b
+	"743",                             /* 743 */
92319b
+	"744",                             /* 744 */
92319b
+	"745",                             /* 745 */
92319b
+	"746",                             /* 746 */
92319b
+	"747",                             /* 747 */
92319b
+	"748",                             /* 748 */
92319b
+	"749",                             /* 749 */
92319b
+	"750",                             /* 750 */
92319b
+	"751",                             /* 751 */
92319b
+	"752",                             /* 752 */
92319b
+	"753",                             /* 753 */
92319b
+	"754",                             /* 754 */
92319b
+	"755",                             /* 755 */
92319b
+	"756",                             /* 756 */
92319b
+	"757",                             /* 757 */
92319b
+	"758",                             /* 758 */
92319b
+	"759",                             /* 759 */
92319b
+	"760",                             /* 760 */
92319b
+	"761",                             /* 761 */
92319b
+	"762",                             /* 762 */
92319b
+	"763",                             /* 763 */
92319b
+	"764",                             /* 764 */
92319b
+	"765",                             /* 765 */
92319b
+	"766",                             /* 766 */
92319b
+	"767",                             /* 767 */
92319b
+	"768",                             /* 768 */
92319b
+	"769",                             /* 769 */
92319b
+	"770",                             /* 770 */
92319b
+	"771",                             /* 771 */
92319b
+	"772",                             /* 772 */
92319b
+	"773",                             /* 773 */
92319b
+	"774",                             /* 774 */
92319b
+	"775",                             /* 775 */
92319b
+	"776",                             /* 776 */
92319b
+	"777",                             /* 777 */
92319b
+	"778",                             /* 778 */
92319b
+	"779",                             /* 779 */
92319b
+	"780",                             /* 780 */
92319b
+	"781",                             /* 781 */
92319b
+	"782",                             /* 782 */
92319b
+	"783",                             /* 783 */
92319b
+	"784",                             /* 784 */
92319b
+	"785",                             /* 785 */
92319b
+	"786",                             /* 786 */
92319b
+	"787",                             /* 787 */
92319b
+	"788",                             /* 788 */
92319b
+	"789",                             /* 789 */
92319b
+	"790",                             /* 790 */
92319b
+	"791",                             /* 791 */
92319b
+	"792",                             /* 792 */
92319b
+	"793",                             /* 793 */
92319b
+	"794",                             /* 794 */
92319b
+	"795",                             /* 795 */
92319b
+	"796",                             /* 796 */
92319b
+	"797",                             /* 797 */
92319b
+	"798",                             /* 798 */
92319b
+	"799",                             /* 799 */
92319b
+	"800",                             /* 800 */
92319b
+	"801",                             /* 801 */
92319b
+	"802",                             /* 802 */
92319b
+	"803",                             /* 803 */
92319b
+	"804",                             /* 804 */
92319b
+	"805",                             /* 805 */
92319b
+	"806",                             /* 806 */
92319b
+	"807",                             /* 807 */
92319b
+	"808",                             /* 808 */
92319b
+	"809",                             /* 809 */
92319b
+	"810",                             /* 810 */
92319b
+	"811",                             /* 811 */
92319b
+	"812",                             /* 812 */
92319b
+	"813",                             /* 813 */
92319b
+	"814",                             /* 814 */
92319b
+	"815",                             /* 815 */
92319b
+	"816",                             /* 816 */
92319b
+	"817",                             /* 817 */
92319b
+	"818",                             /* 818 */
92319b
+	"819",                             /* 819 */
92319b
+	"820",                             /* 820 */
92319b
+	"821",                             /* 821 */
92319b
+	"822",                             /* 822 */
92319b
+	"823",                             /* 823 */
92319b
+	"824",                             /* 824 */
92319b
+	"825",                             /* 825 */
92319b
+	"826",                             /* 826 */
92319b
+	"827",                             /* 827 */
92319b
+	"828",                             /* 828 */
92319b
+	"829",                             /* 829 */
92319b
+	"830",                             /* 830 */
92319b
+	"831",                             /* 831 */
92319b
+	"832",                             /* 832 */
92319b
+	"833",                             /* 833 */
92319b
+	"834",                             /* 834 */
92319b
+	"835",                             /* 835 */
92319b
+	"836",                             /* 836 */
92319b
+	"837",                             /* 837 */
92319b
+	"838",                             /* 838 */
92319b
+	"839",                             /* 839 */
92319b
+	"840",                             /* 840 */
92319b
+	"841",                             /* 841 */
92319b
+	"842",                             /* 842 */
92319b
+	"843",                             /* 843 */
92319b
+	"844",                             /* 844 */
92319b
+	"845",                             /* 845 */
92319b
+	"846",                             /* 846 */
92319b
+	"847",                             /* 847 */
92319b
+	"848",                             /* 848 */
92319b
+	"849",                             /* 849 */
92319b
+	"850",                             /* 850 */
92319b
+	"851",                             /* 851 */
92319b
+	"852",                             /* 852 */
92319b
+	"853",                             /* 853 */
92319b
+	"854",                             /* 854 */
92319b
+	"855",                             /* 855 */
92319b
+	"856",                             /* 856 */
92319b
+	"857",                             /* 857 */
92319b
+	"858",                             /* 858 */
92319b
+	"859",                             /* 859 */
92319b
+	"860",                             /* 860 */
92319b
+	"861",                             /* 861 */
92319b
+	"862",                             /* 862 */
92319b
+	"863",                             /* 863 */
92319b
+	"864",                             /* 864 */
92319b
+	"865",                             /* 865 */
92319b
+	"866",                             /* 866 */
92319b
+	"867",                             /* 867 */
92319b
+	"868",                             /* 868 */
92319b
+	"869",                             /* 869 */
92319b
+	"870",                             /* 870 */
92319b
+	"871",                             /* 871 */
92319b
+	"872",                             /* 872 */
92319b
+	"873",                             /* 873 */
92319b
+	"874",                             /* 874 */
92319b
+	"875",                             /* 875 */
92319b
+	"876",                             /* 876 */
92319b
+	"877",                             /* 877 */
92319b
+	"878",                             /* 878 */
92319b
+	"879",                             /* 879 */
92319b
+	"880",                             /* 880 */
92319b
+	"881",                             /* 881 */
92319b
+	"882",                             /* 882 */
92319b
+	"883",                             /* 883 */
92319b
+	"884",                             /* 884 */
92319b
+	"885",                             /* 885 */
92319b
+	"886",                             /* 886 */
92319b
+	"887",                             /* 887 */
92319b
+	"888",                             /* 888 */
92319b
+	"889",                             /* 889 */
92319b
+	"890",                             /* 890 */
92319b
+	"891",                             /* 891 */
92319b
+	"892",                             /* 892 */
92319b
+	"893",                             /* 893 */
92319b
+	"894",                             /* 894 */
92319b
+	"895",                             /* 895 */
92319b
+	"896",                             /* 896 */
92319b
+	"897",                             /* 897 */
92319b
+	"898",                             /* 898 */
92319b
+	"899",                             /* 899 */
92319b
+	"900",                             /* 900 */
92319b
+	"901",                             /* 901 */
92319b
+	"902",                             /* 902 */
92319b
+	"903",                             /* 903 */
92319b
+	"904",                             /* 904 */
92319b
+	"905",                             /* 905 */
92319b
+	"906",                             /* 906 */
92319b
+	"907",                             /* 907 */
92319b
+	"908",                             /* 908 */
92319b
+	"909",                             /* 909 */
92319b
+	"910",                             /* 910 */
92319b
+	"911",                             /* 911 */
92319b
+	"912",                             /* 912 */
92319b
+	"913",                             /* 913 */
92319b
+	"914",                             /* 914 */
92319b
+	"915",                             /* 915 */
92319b
+	"916",                             /* 916 */
92319b
+	"917",                             /* 917 */
92319b
+	"918",                             /* 918 */
92319b
+	"919",                             /* 919 */
92319b
+	"920",                             /* 920 */
92319b
+	"921",                             /* 921 */
92319b
+	"922",                             /* 922 */
92319b
+	"923",                             /* 923 */
92319b
+	"924",                             /* 924 */
92319b
+	"925",                             /* 925 */
92319b
+	"926",                             /* 926 */
92319b
+	"927",                             /* 927 */
92319b
+	"928",                             /* 928 */
92319b
+	"929",                             /* 929 */
92319b
+	"930",                             /* 930 */
92319b
+	"931",                             /* 931 */
92319b
+	"932",                             /* 932 */
92319b
+	"933",                             /* 933 */
92319b
+	"934",                             /* 934 */
92319b
+	"935",                             /* 935 */
92319b
+	"936",                             /* 936 */
92319b
+	"937",                             /* 937 */
92319b
+	"938",                             /* 938 */
92319b
+	"939",                             /* 939 */
92319b
+	"940",                             /* 940 */
92319b
+	"941",                             /* 941 */
92319b
+	"942",                             /* 942 */
92319b
+	"943",                             /* 943 */
92319b
+	"944",                             /* 944 */
92319b
+	"945",                             /* 945 */
92319b
+	"946",                             /* 946 */
92319b
+	"947",                             /* 947 */
92319b
+	"948",                             /* 948 */
92319b
+	"949",                             /* 949 */
92319b
+	"950",                             /* 950 */
92319b
+	"951",                             /* 951 */
92319b
+	"952",                             /* 952 */
92319b
+	"953",                             /* 953 */
92319b
+	"954",                             /* 954 */
92319b
+	"955",                             /* 955 */
92319b
+	"956",                             /* 956 */
92319b
+	"957",                             /* 957 */
92319b
+	"958",                             /* 958 */
92319b
+	"959",                             /* 959 */
92319b
+	"960",                             /* 960 */
92319b
+	"961",                             /* 961 */
92319b
+	"962",                             /* 962 */
92319b
+	"963",                             /* 963 */
92319b
+	"964",                             /* 964 */
92319b
+	"965",                             /* 965 */
92319b
+	"966",                             /* 966 */
92319b
+	"967",                             /* 967 */
92319b
+	"968",                             /* 968 */
92319b
+	"969",                             /* 969 */
92319b
+	"970",                             /* 970 */
92319b
+	"971",                             /* 971 */
92319b
+	"972",                             /* 972 */
92319b
+	"973",                             /* 973 */
92319b
+	"974",                             /* 974 */
92319b
+	"975",                             /* 975 */
92319b
+	"976",                             /* 976 */
92319b
+	"977",                             /* 977 */
92319b
+	"978",                             /* 978 */
92319b
+	"979",                             /* 979 */
92319b
+	"980",                             /* 980 */
92319b
+	"981",                             /* 981 */
92319b
+	"982",                             /* 982 */
92319b
+	"983",                             /* 983 */
92319b
+	"984",                             /* 984 */
92319b
+	"985",                             /* 985 */
92319b
+	"986",                             /* 986 */
92319b
+	"987",                             /* 987 */
92319b
+	"988",                             /* 988 */
92319b
+	"989",                             /* 989 */
92319b
+	"990",                             /* 990 */
92319b
+	"991",                             /* 991 */
92319b
+	"992",                             /* 992 */
92319b
+	"993",                             /* 993 */
92319b
+	"994",                             /* 994 */
92319b
+	"995",                             /* 995 */
92319b
+	"996",                             /* 996 */
92319b
+	"997",                             /* 997 */
92319b
+	"998",                             /* 998 */
92319b
+	"999",                             /* 999 */
92319b
+	"1000",                            /* 1000 */
92319b
+	"1001",                            /* 1001 */
92319b
+	"1002",                            /* 1002 */
92319b
+	"1003",                            /* 1003 */
92319b
+	"1004",                            /* 1004 */
92319b
+	"1005",                            /* 1005 */
92319b
+	"1006",                            /* 1006 */
92319b
+	"1007",                            /* 1007 */
92319b
+	"1008",                            /* 1008 */
92319b
+	"1009",                            /* 1009 */
92319b
+	"1010",                            /* 1010 */
92319b
+	"1011",                            /* 1011 */
92319b
+	"1012",                            /* 1012 */
92319b
+	"1013",                            /* 1013 */
92319b
+	"1014",                            /* 1014 */
92319b
+	"1015",                            /* 1015 */
92319b
+	"1016",                            /* 1016 */
92319b
+	"1017",                            /* 1017 */
92319b
+	"1018",                            /* 1018 */
92319b
+	"1019",                            /* 1019 */
92319b
+	"1020",                            /* 1020 */
92319b
+	"1021",                            /* 1021 */
92319b
+	"1022",                            /* 1022 */
92319b
+	"1023",                            /* 1023 */
92319b
+	"open",                            /* 1024 */
92319b
+	"link",                            /* 1025 */
92319b
+	"unlink",                          /* 1026 */
92319b
+	"mknod",                           /* 1027 */
92319b
+	"chmod",                           /* 1028 */
92319b
+	"chown",                           /* 1029 */
92319b
+	"mkdir",                           /* 1030 */
92319b
+	"rmdir",                           /* 1031 */
92319b
+	"lchown",                          /* 1032 */
92319b
+	"access",                          /* 1033 */
92319b
+	"rename",                          /* 1034 */
92319b
+	"readlink",                        /* 1035 */
92319b
+	"symlink",                         /* 1036 */
92319b
+	"utimes",                          /* 1037 */
92319b
+	"stat",                            /* 1038 */
92319b
+	"lstat",                           /* 1039 */
92319b
+	"pipe",                            /* 1040 */
92319b
+	"dup2",                            /* 1041 */
92319b
+	"epoll_create",                    /* 1042 */
92319b
+	"inotify_init",                    /* 1043 */
92319b
+	"eventfd",                         /* 1044 */
92319b
+	"signalfd",                        /* 1045 */
92319b
+	"sendfile",                        /* 1046 */
92319b
+	"ftruncate",                       /* 1047 */
92319b
+	"truncate",                        /* 1048 */
92319b
+	"stat",                            /* 1049 */
92319b
+	"lstat",                           /* 1050 */
92319b
+	"fstat",                           /* 1051 */
92319b
+	"fcntl",                           /* 1052 */
92319b
+	"fadvise64",                       /* 1053 */
92319b
+	"newfstatat",                      /* 1054 */
92319b
+	"fstatfs",                         /* 1055 */
92319b
+	"statfs",                          /* 1056 */
92319b
+	"lseek",                           /* 1057 */
92319b
+	"mmap",                            /* 1058 */
92319b
+	"alarm",                           /* 1059 */
92319b
+	"getpgrp",                         /* 1060 */
92319b
+	"pause",                           /* 1061 */
92319b
+	"time",                            /* 1062 */
92319b
+	"utime",                           /* 1063 */
92319b
+	"creat",                           /* 1064 */
92319b
+	"getdents",                        /* 1065 */
92319b
+	"futimesat",                       /* 1066 */
92319b
+	"select",                          /* 1067 */
92319b
+	"poll",                            /* 1068 */
92319b
+	"epoll_wait",                      /* 1069 */
92319b
+	"ustat",                           /* 1070 */
92319b
+	"vfork",                           /* 1071 */
92319b
+	"oldwait4",                        /* 1072 */
92319b
+	"recv",                            /* 1073 */
92319b
+	"send",                            /* 1074 */
92319b
+	"bdflush",                         /* 1075 */
92319b
+	"umount",                          /* 1076 */
92319b
+	"uselib",                          /* 1077 */
92319b
+	"_sysctl",                         /* 1078 */
92319b
+	"fork",                            /* 1079 */
92319b
diff --git a/sysdeps/linux-gnu/aarch64/trace.c b/sysdeps/linux-gnu/aarch64/trace.c
92319b
new file mode 100644
92319b
index 0000000..5544b51
92319b
--- /dev/null
92319b
+++ b/sysdeps/linux-gnu/aarch64/trace.c
92319b
@@ -0,0 +1,84 @@
92319b
+/*
92319b
+ * This file is part of ltrace.
92319b
+ * Copyright (C) 2014 Petr Machata, Red Hat, Inc.
92319b
+ *
92319b
+ * This program is free software; you can redistribute it and/or
92319b
+ * modify it under the terms of the GNU General Public License as
92319b
+ * published by the Free Software Foundation; either version 2 of the
92319b
+ * License, or (at your option) any later version.
92319b
+ *
92319b
+ * This program is distributed in the hope that it will be useful, but
92319b
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
92319b
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
92319b
+ * General Public License for more details.
92319b
+ *
92319b
+ * You should have received a copy of the GNU General Public License
92319b
+ * along with this program; if not, write to the Free Software
92319b
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
92319b
+ * 02110-1301 USA
92319b
+ */
92319b
+
92319b
+#include <sys/ptrace.h>
92319b
+#include <sys/types.h>
92319b
+#include <sys/wait.h>
92319b
+#include <asm/ptrace.h>
92319b
+#include <string.h>
92319b
+#include <errno.h>
92319b
+#include <stdio.h>
92319b
+
92319b
+#include "backend.h"
92319b
+#include "proc.h"
92319b
+
92319b
+void
92319b
+get_arch_dep(struct process *proc)
92319b
+{
92319b
+}
92319b
+
92319b
+int aarch64_read_gregs(struct process *proc, struct user_pt_regs *regs);
92319b
+
92319b
+/* The syscall instruction is:
92319b
+ * | 31                   21 | 20    5 | 4       0 |
92319b
+ * | 1 1 0 1 0 1 0 0 | 0 0 0 |  imm16  | 0 0 0 0 1 | */
92319b
+#define SVC_MASK  0xffe0001f
92319b
+#define SVC_VALUE 0xd4000001
92319b
+
92319b
+int
92319b
+syscall_p(struct process *proc, int status, int *sysnum)
92319b
+{
92319b
+	if (WIFSTOPPED(status)
92319b
+	    && WSTOPSIG(status) == (SIGTRAP | proc->tracesysgood)) {
92319b
+
92319b
+		struct user_pt_regs regs;
92319b
+		if (aarch64_read_gregs(proc, &regs) < 0) {
92319b
+			fprintf(stderr, "syscall_p: "
92319b
+				"Couldn't read registers of %d.\n", proc->pid);
92319b
+			return -1;
92319b
+		}
92319b
+
92319b
+		errno = 0;
92319b
+		unsigned long insn = (unsigned long) ptrace(PTRACE_PEEKTEXT,
92319b
+							    proc->pid,
92319b
+							    regs.pc - 4, 0);
92319b
+		if (insn == -1UL && errno != 0) {
92319b
+			fprintf(stderr, "syscall_p: "
92319b
+				"Couldn't peek into %d: %s\n", proc->pid,
92319b
+				strerror(errno));
92319b
+			return -1;
92319b
+		}
92319b
+
92319b
+		insn &= 0xffffffffUL;
92319b
+		if ((insn & SVC_MASK) == SVC_VALUE) {
92319b
+			*sysnum = regs.regs[8];
92319b
+
92319b
+			size_t d1 = proc->callstack_depth - 1;
92319b
+			if (proc->callstack_depth > 0
92319b
+			    && proc->callstack[d1].is_syscall
92319b
+			    && proc->callstack[d1].c_un.syscall == *sysnum)
92319b
+				return 2;
92319b
+
92319b
+			return 1;
92319b
+		}
92319b
+	}
92319b
+
92319b
+	return 0;
92319b
+}
92319b
diff --git a/testsuite/ltrace.main/system_call_params.exp b/testsuite/ltrace.main/system_call_params.exp
92319b
index 787e342..2ccf840 100644
92319b
--- a/testsuite/ltrace.main/system_call_params.exp
92319b
+++ b/testsuite/ltrace.main/system_call_params.exp
92319b
@@ -1,5 +1,5 @@
92319b
 # This file is part of ltrace.
92319b
-# Copyright (C) 2013 Petr Machata, Red Hat Inc.
92319b
+# Copyright (C) 2013, 2014 Petr Machata, Red Hat Inc.
92319b
 #
92319b
 # This program is free software; you can redistribute it and/or
92319b
 # modify it under the terms of the GNU General Public License as
92319b
@@ -17,11 +17,25 @@
92319b
 # 02110-1301 USA
92319b
 
92319b
 set bin [ltraceCompile {} [ltraceSource c {
92319b
+    #define _GNU_SOURCE
92319b
     #include <sys/types.h>
92319b
     #include <sys/stat.h>
92319b
     #include <fcntl.h>
92319b
+    #include <unistd.h>
92319b
+    #include <sys/syscall.h>   /* For SYS_xxx definitions */
92319b
+
92319b
+    #ifndef SYS_open
92319b
+    # if defined(__aarch64__)
92319b
+    #  /* Linux doesn't actually implement SYS_open on AArch64, but for merely
92319b
+    #   * recording the syscall, it's fine.  */
92319b
+    #  define SYS_open 1024
92319b
+    # else
92319b
+    #  error SYS_open not available.
92319b
+    # endif
92319b
+    #endif
92319b
+
92319b
     int main(void) {
92319b
-	open("/some/path", O_RDONLY);
92319b
+	syscall(SYS_open, "/some/path", O_RDONLY);
92319b
 	write(1, "something", 10);
92319b
 	mount("source", "target", "filesystemtype", 0, 0);
92319b
     }
92319b
diff --git a/testsuite/ltrace.main/system_calls.c b/testsuite/ltrace.main/system_calls.c
92319b
deleted file mode 100644
92319b
index 7be3d04..0000000
92319b
--- a/testsuite/ltrace.main/system_calls.c
92319b
+++ /dev/null
92319b
@@ -1,68 +0,0 @@
92319b
-/* Ltrace Test : system_calls.c.
92319b
-   Objectives  : Verify that Ltrace can trace all the system calls in
92319b
-   execution.
92319b
-
92319b
-   You can add new system calls in it and add its verification in 
92319b
-   system_calls correspondingly.
92319b
-
92319b
-   This file was written by Yao Qi <qiyao@cn.ibm.com>. */
92319b
-
92319b
-#include <stdio.h>
92319b
-#include <unistd.h>
92319b
-#include <sys/syscall.h>
92319b
-#include <sys/stat.h>
92319b
-#include <errno.h>
92319b
-
92319b
-void exit (int);
92319b
-
92319b
-#define	BUF_SIZE	100
92319b
-
92319b
-int 
92319b
-main ()
92319b
-{
92319b
-  FILE* fp;
92319b
-  char s[]="system_calls";
92319b
-  char buffer[BUF_SIZE];
92319b
-  struct stat state;
92319b
-  
92319b
-  /*  SYS_open.  */
92319b
-  fp = fopen ("system_calls.tmp", "w");
92319b
-  if (fp == NULL)
92319b
-    {
92319b
-      printf("Can not create system_calls.tmp\n");
92319b
-      exit (0);
92319b
-    }
92319b
-  /*  SYS_write.  */
92319b
-  fwrite(s, sizeof(s), 1, fp);
92319b
-  /*  SYS_lseek.  */
92319b
-  fseek (fp, 0, SEEK_CUR);
92319b
-  /*  SYS_read.  */
92319b
-  fread(buffer, sizeof(s), 1, fp);
92319b
-  /*  SYS_close.  */
92319b
-  fclose(fp);
92319b
-
92319b
-  /*  SYS_getcwd.  */
92319b
-  getcwd (buffer, BUF_SIZE);
92319b
-  /*  SYS_chdir.  */
92319b
-  chdir (".");
92319b
-  /*  SYS_symlink.  */
92319b
-  symlink ("system_calls.tmp", "system_calls.link");
92319b
-  /*  SYS_unlink.  */
92319b
-  remove("system_calls.link");
92319b
-  /*  SYS_rename.  */
92319b
-  rename ("system_calls.tmp", "system_calls.tmp1");
92319b
-  /*  SYS_stat.  */
92319b
-  stat ("system_calls.tmp", &state);
92319b
-  /*  SYS_access.  */
92319b
-  access ("system_calls.tmp", R_OK);
92319b
-  remove("system_calls.tmp1");
92319b
-  
92319b
-  /*  SYS_mkdir.  */
92319b
-  mkdir ("system_call_mkdir", 0777);
92319b
-  /*  SYS_rmdir.  */
92319b
-  rmdir ("system_call_mkdir");
92319b
-  
92319b
-  return 0;
92319b
-}
92319b
-
92319b
-
92319b
diff --git a/testsuite/ltrace.main/system_calls.exp b/testsuite/ltrace.main/system_calls.exp
92319b
index a74fa04..f60e319 100644
92319b
--- a/testsuite/ltrace.main/system_calls.exp
92319b
+++ b/testsuite/ltrace.main/system_calls.exp
92319b
@@ -1,67 +1,146 @@
92319b
-# This file was written by Yao Qi <qiyao@cn.ibm.com>.
92319b
+# This file is part of ltrace.
92319b
+# Copyright (C) 2014 Petr Machata, Red Hat Inc.
92319b
+# Copyright (C) 2006 Yao Qi <qiyao@cn.ibm.com>, IBM Corporation
92319b
+#
92319b
+# This program is free software; you can redistribute it and/or
92319b
+# modify it under the terms of the GNU General Public License as
92319b
+# published by the Free Software Foundation; either version 2 of the
92319b
+# License, or (at your option) any later version.
92319b
+#
92319b
+# This program is distributed in the hope that it will be useful, but
92319b
+# WITHOUT ANY WARRANTY; without even the implied warranty of
92319b
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
92319b
+# General Public License for more details.
92319b
+#
92319b
+# You should have received a copy of the GNU General Public License
92319b
+# along with this program; if not, write to the Free Software
92319b
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
92319b
+# 02110-1301 USA
92319b
 
92319b
-set testfile "system_calls"
92319b
-set srcfile ${testfile}.c
92319b
-set binfile ${testfile}
92319b
+# Objectives: Verify that Ltrace can trace all the system calls in
92319b
+# execution.  Note that this test is necessarily noisy.  Dynamic
92319b
+# linker adds a bunch of system calls of its own.
92319b
 
92319b
+set empty [ltraceCompile {} [ltraceSource c {
92319b
+    int main (void) { return 0; }
92319b
+}]]
92319b
 
92319b
-verbose "compiling source file now....."
92319b
-# Build the shared libraries this test case needs.
92319b
-if  { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${objdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
92319b
-     send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
92319b
+set bin [ltraceCompile {} [ltraceSource c {
92319b
+    #include <stdio.h>
92319b
+    #include <unistd.h>
92319b
+    #include <sys/syscall.h>
92319b
+    #include <sys/stat.h>
92319b
+    #include <errno.h>
92319b
+    #include <stdlib.h>
92319b
+
92319b
+    int
92319b
+    main ()
92319b
+    {
92319b
+      FILE* fp;
92319b
+      char s[]="system_calls";
92319b
+      char buffer[1024];
92319b
+      struct stat state;
92319b
+
92319b
+      fp = fopen ("system_calls.tmp", "w");
92319b
+      if (fp == NULL)
92319b
+	{
92319b
+	  printf("Can not create system_calls.tmp\n");
92319b
+	  exit (0);
92319b
+	}
92319b
+      fwrite(s, sizeof(s), 1, fp);
92319b
+      fseek (fp, 0, SEEK_CUR);
92319b
+      fread(buffer, sizeof(s), 1, fp);
92319b
+      fclose(fp);
92319b
+
92319b
+      getcwd (buffer, sizeof buffer);
92319b
+      chdir (".");
92319b
+      symlink ("system_calls.tmp", "system_calls.link");
92319b
+      remove("system_calls.link");
92319b
+      rename ("system_calls.tmp", "system_calls.tmp1");
92319b
+      stat ("system_calls.tmp", &state);
92319b
+      access ("system_calls.tmp", R_OK);
92319b
+      remove("system_calls.tmp1");
92319b
+
92319b
+      mkdir ("system_call_mkdir", 0777);
92319b
+      rmdir ("system_call_mkdir");
92319b
+
92319b
+      return 0;
92319b
+    }
92319b
+}]]
92319b
+
92319b
+proc Calls {logfile} {
92319b
+    set fp [open $logfile]
92319b
+    set ret {}
92319b
+
92319b
+    while {[gets $fp line] >= 0} {
92319b
+	if [regexp -- {^[a-zA-Z0-9]*@SYS} $line] {
92319b
+	    set call [lindex [split $line @] 0]
92319b
+	    dict incr ret $call
92319b
+	}
92319b
+    }
92319b
+
92319b
+    close $fp
92319b
+    return $ret
92319b
+}
92319b
+
92319b
+proc GetDefault {d key def} {
92319b
+    if {[dict exists $d $key]} {
92319b
+	return [dict get $d $key]
92319b
+    } else {
92319b
+	return $def
92319b
+    }
92319b
 }
92319b
 
92319b
-# set options for ltrace.
92319b
-ltrace_options "-S"
92319b
+proc Diff {d1 d2} {
92319b
+    set keys [lsort -unique [concat [dict keys $d1] [dict keys $d2]]]
92319b
+    set ret {}
92319b
+    foreach key $keys {
92319b
+	set n1 [GetDefault $d1 $key 0]
92319b
+	set n2 [GetDefault $d2 $key 0]
92319b
+	set sum [expr $n1 - $n2]
92319b
+	if {[expr $sum != 0]} {
92319b
+		dict set ret $key $sum
92319b
+	}
92319b
+    }
92319b
+    return $ret
92319b
+}
92319b
+
92319b
+proc Match {d patterns} {
92319b
+    foreach line $patterns {
92319b
+	set pattern [lindex $line 0]
92319b
+	set op [lindex $line 1]
92319b
+	set expect [lindex $line 2]
92319b
 
92319b
-#Run PUT for ltarce.
92319b
-set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
92319b
+	set count 0
92319b
+	foreach key [dict keys $d] {
92319b
+	    if [regexp -- $pattern $key] {
92319b
+		incr count [dict get $d $key]
92319b
+	    }
92319b
+	}
92319b
 
92319b
-#check the output of this program.
92319b
-verbose "ltrace runtest output: $exec_output\n"
92319b
+	set msgMain "$pattern was recorded $count times"
92319b
 
92319b
-if [regexp {ELF from incompatible architecture} $exec_output] {
92319b
-	fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!"
92319b
-        return
92319b
-} elseif [ regexp {Couldn't get .hash data} $exec_output ] {
92319b
-	fail "Couldn't get .hash data!"
92319b
-	return
92319b
+	if {[eval expr $count $op $expect]} {
92319b
+	    pass $msgMain
92319b
+	} else {
92319b
+	    fail "$msgMain, expected $op $expect"
92319b
+	}
92319b
+    }
92319b
 }
92319b
 
92319b
+Match [Diff [Calls [ltraceRun -L -S -- $bin]] \
92319b
+	   [Calls [ltraceRun -L -S -- $empty]]] {
92319b
+    { {^write$} == 1 }
92319b
+    { {^unlink(at)?$} >= 2 }
92319b
+    { {^open(at)?$} == 1 }
92319b
+    { {^(new|f)?stat(64)?$} == 1 }
92319b
+    { {^close$} == 1 }
92319b
+    { {^getcwd$} == 1 }
92319b
+    { {^chdir$} == 1 }
92319b
+    { {^symlink(at)?$} == 1 }
92319b
+    { {^f?access(at)?$} == 1 }
92319b
+    { {^rename(at)?$} == 1 }
92319b
+    { {^mkdir(at)?$} == 1 }
92319b
+}
92319b
 
92319b
-set pattern "^munmap@SYS"
92319b
-ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 2
92319b
-set pattern "^write@SYS"
92319b
-ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
92319b
-set pattern "^unlink@SYS"
92319b
-ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
92319b
-
92319b
-set pattern "^brk@SYS"
92319b
-ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
92319b
-set pattern "^open@SYS"
92319b
-ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
92319b
-set pattern "^(new)?fstat(64)?@SYS"
92319b
-ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1 egrep
92319b
-set pattern "^(old_)?mmap2?@SYS"
92319b
-ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1 egrep
92319b
-set pattern "^close@SYS"
92319b
-ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
92319b
-
92319b
-set pattern "^getcwd@SYS"
92319b
-ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
92319b
-set pattern "^chdir@SYS"
92319b
-ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
92319b
-set pattern "^symlink@SYS"
92319b
-ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
92319b
-set pattern "^unlink@SYS"
92319b
-ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
92319b
-set pattern "^(new)?stat(64)?@SYS"
92319b
-ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1 egrep
92319b
-set pattern "^access@SYS"
92319b
-ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
92319b
-set pattern "^rename@SYS"
92319b
-ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
92319b
-set pattern "^mkdir@SYS"
92319b
-ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
92319b
-set pattern "^rmdir@SYS"
92319b
-ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
92319b
+ltraceDone
92319b
diff --git a/testsuite/ltrace.minor/trace-clone.c b/testsuite/ltrace.minor/trace-clone.c
92319b
index db1936d..ded930c 100644
92319b
--- a/testsuite/ltrace.minor/trace-clone.c
92319b
+++ b/testsuite/ltrace.minor/trace-clone.c
92319b
@@ -8,6 +8,7 @@
92319b
 #include <sys/types.h>
92319b
 #include <stdlib.h>
92319b
 #include <sched.h>
92319b
+#include <unistd.h>
92319b
 
92319b
 int child ()
92319b
 {
92319b
@@ -22,7 +23,8 @@ typedef int (* myfunc)();
92319b
 int main ()
92319b
 {
92319b
   pid_t pid;
92319b
-  static char stack[STACK_SIZE];
92319b
+  static __attribute__ ((aligned (16))) char stack[STACK_SIZE];
92319b
+
92319b
 #ifdef __ia64__
92319b
   pid = __clone2((myfunc)&child, stack, STACK_SIZE, CLONE_FS, NULL);
92319b
 #else