Blame SOURCES/ltrace-0.7.91-aarch64.patch

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