Blame SOURCES/ltrace-0.7.91-aarch64.patch

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