AVR32 support by Hans-Christian Egtvedt
(hans-christian.egtvedt AT atmel.com).
* configure.ac: Make it recognize avr32.
* defs.h: Define LINUX_AVR32.
* linux/avr32/syscallent.h: New file.
* Makefile.am: Reference linux/avr32/syscallent.h.
* proc.c (change_syscall, setarg): Add support for avr32.
(struct xlat struct_user_offsets[]): Ditto.
* syscall.c (get_scno): Ditto.
(get_error, force_result, syscall_enter): Ditto.
* util.c (getpc, printcall): Ditto.
diff --git a/ChangeLog b/ChangeLog
index aa01b18..eb8026a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2009-02-27  Denys Vlasenko  <dvlasenk@redhat.com>
+
+	AVR32 support by Hans-Christian Egtvedt
+	(hans-christian.egtvedt AT atmel.com).
+	* configure.ac: Make it recognize avr32.
+	* defs.h: Define LINUX_AVR32.
+	* linux/avr32/syscallent.h: New file.
+	* Makefile.am: Reference linux/avr32/syscallent.h.
+	* proc.c (change_syscall, setarg): Add support for avr32.
+	(struct xlat struct_user_offsets[]): Ditto.
+	* syscall.c (get_scno): Ditto.
+	(get_error, force_result, syscall_enter): Ditto.
+	* util.c (getpc, printcall): Ditto.
+
 2009-02-25  Denys Vlasenko  <dvlasenk@redhat.com>
 
 	CRIS support by Hinko Kocevar (hinko.kocevar AT cetrtapot.si)
diff --git a/Makefile.am b/Makefile.am
index d1cfe41..de8b170 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -34,6 +34,7 @@
 	     linux/arm/syscallent.h linux/arm/syscallent1.h \
 	     linux/arm/signalent1.h linux/arm/ioctlent1.h \
 	     linux/arm/errnoent1.h \
+	     linux/avr32/syscallent.h \
 	     linux/bfin/ioctlent.h linux/bfin/syscallent.h \
 	     linux/hppa/errnoent.h linux/hppa/ioctlent.h \
 	     linux/hppa/signalent.h linux/hppa/syscallent.h \
diff --git a/configure.ac b/configure.ac
index 47267c5..ffbfeb4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -83,6 +83,10 @@
 	arch=arm
 	AC_DEFINE([ARM], 1, [Define for the ARM architecture.])
 	;;
+avr32*)
+	arch=avr32
+	AC_DEFINE([AVR32], 1, [Define for the AVR32 architecture.])
+	;;
 s390)
 	arch=s390
 	AC_DEFINE([S390], 1, [Define for the S390 architecture.])
diff --git a/defs.h b/defs.h
index 7c88a1c..4314e86 100644
--- a/defs.h
+++ b/defs.h
@@ -113,6 +113,9 @@
 #  if defined(ARM)
 #     define LINUX_ARM
 #  endif
+#  if defined(AVR32)
+#     define LINUX_AVR32
+#  endif
 #endif
 
 #if defined(SVR4) || defined(FREEBSD)
@@ -139,7 +142,7 @@
 #include <sys/pioctl.h>
 #endif /* FREEBSD */
 #else /* !USE_PROCFS */
-#if (defined(LINUXSPARC) || defined(LINUX_X86_64) || defined(LINUX_ARM)) && defined(__GLIBC__)
+#if (defined(LINUXSPARC) || defined(LINUX_X86_64) || defined(LINUX_ARM) || defined(LINUX_AVR32)) && defined(__GLIBC__)
 #include <sys/ptrace.h>
 #else
 /* Work around awkward prototype in ptrace.h. */
@@ -370,7 +373,7 @@
  * without using TCB_WAITEXECVE flag.
  * I guess we can remove it from the source somewhere around year 2010 :)
  */
-# if defined(ALPHA) || defined(SPARC) || defined(SPARC64) || defined(POWERPC) || defined(IA64) || defined(HPPA) || defined(SH) || defined(SH64) || defined(S390) || defined(S390X) || defined(ARM) || defined(MIPS) || defined(BFIN)
+# if defined(ALPHA) || defined(AVR32) || defined(SPARC) || defined(SPARC64) || defined(POWERPC) || defined(IA64) || defined(HPPA) || defined(SH) || defined(SH64) || defined(S390) || defined(S390X) || defined(ARM) || defined(MIPS) || defined(BFIN)
 #  define TCB_WAITEXECVE 02000	/* ignore SIGTRAP after exceve */
 # endif
 # define TCB_CLONE_DETACHED 04000 /* CLONE_DETACHED set in creating syscall */
diff --git a/desc.c b/desc.c
index c4c5a69..cd6259a 100644
--- a/desc.c
+++ b/desc.c
@@ -336,7 +336,7 @@
 			printflock64(tcp, tcp->u_arg[2], 0);
 			break;
 #endif
- 		}
+		}
 	}
 	else {
 		switch (tcp->u_arg[1]) {
@@ -368,7 +368,7 @@
 			printflock64(tcp, tcp->u_arg[2], 1);
 			break;
 #endif
- 		default:
+		default:
 			tprintf(", %#lx", tcp->u_arg[2]);
 			break;
 		}
diff --git a/file.c b/file.c
index 899efb7..3496bb2 100644
--- a/file.c
+++ b/file.c
@@ -982,10 +982,10 @@
 	struct stat statbuf;
 
 #ifdef LINUXSPARC
- 	if (current_personality == 1) {
- 		printstatsol(tcp, addr);
- 		return;
- 	}
+	if (current_personality == 1) {
+		printstatsol(tcp, addr);
+		return;
+	}
 #ifdef SPARC64
 	else if (current_personality == 2) {
 		printstat_sparc64(tcp, addr);
@@ -1056,10 +1056,10 @@
 #endif
 
 #ifdef LINUXSPARC
- 	if (current_personality == 1) {
- 		printstatsol(tcp, addr);
- 		return;
- 	}
+	if (current_personality == 1) {
+		printstatsol(tcp, addr);
+		return;
+	}
 #ifdef SPARC64
 	else if (current_personality == 2) {
 		printstat_sparc64(tcp, addr);
@@ -1188,10 +1188,10 @@
 	struct stat newstatbuf;
 
 #ifdef LINUXSPARC
- 	if (current_personality == 1) {
- 		printstatsol(tcp, addr);
- 		return;
- 	}
+	if (current_personality == 1) {
+		printstatsol(tcp, addr);
+		return;
+	}
 #endif /* LINUXSPARC */
 
 	if (!addr) {
diff --git a/linux/avr32/syscallent.h b/linux/avr32/syscallent.h
new file mode 100644
index 0000000..1bfd68a
--- /dev/null
+++ b/linux/avr32/syscallent.h
@@ -0,0 +1,311 @@
+/*
+ * Copyright (c) 2004-2009 Atmel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *	$Id$
+ */
+
+	{ 0,	0,	sys_setup,		"setup"		}, /* 0 */
+	{ 1,	TP,	sys_exit,		"_exit"		}, /* 1 */
+	{ 0,	TP,	sys_fork,		"fork"		}, /* 2 */
+	{ 3,	TD,	sys_read,		"read"		}, /* 3 */
+	{ 3,	TD,	sys_write,		"write"		}, /* 4 */
+	{ 3,	TD|TF,	sys_open,		"open"		}, /* 5 */
+	{ 1,	TD,	sys_close,		"close"		}, /* 6 */
+	{ 1,	0,	sys_umask,		"umask"		}, /* 7 */
+	{ 2,	TD|TF,	sys_creat,		"creat"		}, /* 8 */
+	{ 2,	TF,	sys_link,		"link"		}, /* 9 */
+	{ 1,	TF,	sys_unlink,		"unlink"	}, /* 10 */
+	{ 3,	TF|TP,	sys_execve,		"execve"	}, /* 11 */
+	{ 1,	TF,	sys_chdir,		"chdir"		}, /* 12 */
+	{ 1,	0,	sys_time,		"time"		}, /* 13 */
+	{ 3,	TF,	sys_mknod,		"mknod"		}, /* 14 */
+	{ 2,	TF,	sys_chmod,		"chmod"		}, /* 15 */
+	{ 3,	TF,	sys_chown,		"chown"		}, /* 16 */
+	{ 3,	TF,	sys_chown,		"lchown"	}, /* 17 */
+	{ 3,	TD,	sys_lseek,		"lseek"		}, /* 18 */
+	{ 5,	TD,	sys_llseek,		"_llseek"	}, /* 19 */
+	{ 0,	0,	sys_getpid,		"getpid"	}, /* 20 */
+	{ 5,	TF,	sys_mount,		"mount"		}, /* 21 */
+	{ 2,	TF,	sys_umount,		"umount"	}, /* 22 */
+	{ 1,	0,	sys_setuid,		"setuid"	}, /* 23 */
+	{ 0,	0,	sys_getuid,		"getuid"	}, /* 24 */
+	{ 1,	0,	sys_stime,		"stime"		}, /* 25 */
+	{ 4,	0,	sys_ptrace,		"ptrace"	}, /* 26 */
+	{ 1,	0,	sys_alarm,		"alarm"		}, /* 27 */
+	{ 0,	TS,	sys_pause,		"pause"		}, /* 28 */
+	{ 2,	TF,	sys_utime,		"utime"		}, /* 29 */
+	{ 2,	TF,	sys_stat,		"stat"		}, /* 30 */
+	{ 2,	TD,	sys_fstat,		"fstat"		}, /* 31 */
+	{ 2,	TF,	sys_lstat,		"lstat"		}, /* 32 */
+	{ 2,	TF,	sys_access,		"access"	}, /* 33 */
+	{ 1,	TF,	sys_chroot,		"chroot"	}, /* 34 */
+	{ 0,	0,	sys_sync,		"sync"		}, /* 35 */
+	{ 1,	TD,	sys_fsync,		"fsync"		}, /* 36 */
+	{ 2,	TS,	sys_kill,		"kill"		}, /* 37 */
+	{ 2,	TF,	sys_rename,		"rename"	}, /* 38 */
+	{ 2,	TF,	sys_mkdir,		"mkdir"		}, /* 39 */
+	{ 1,	TF,	sys_rmdir,		"rmdir"		}, /* 40 */
+	{ 1,	TD,	sys_dup,		"dup"		}, /* 41 */
+	{ 1,	TD,	sys_pipe,		"pipe"		}, /* 42 */
+	{ 1,	0,	sys_times,		"times"		}, /* 43 */
+	{ 5,	TP,	sys_clone,		"clone"		}, /* 44 */
+	{ 1,	0,	sys_brk,		"brk"		}, /* 45 */
+	{ 1,	0,	sys_setgid,		"setgid"	}, /* 46 */
+	{ 0,	0,	sys_getgid,		"getgid"	}, /* 47 */
+	{ 2,	TF,	sys_getcwd,		"getcwd"	}, /* 48 */
+	{ 0,	0,	sys_geteuid,		"geteuid"	}, /* 49 */
+	{ 0,	0,	sys_getegid,		"getegid"	}, /* 50 */
+	{ 1,	TF,	sys_acct,		"acct"		}, /* 51 */
+	{ 1,	0,	sys_setfsuid,		"setfsuid"	}, /* 52 */
+	{ 1,	0,	sys_setfsgid,		"setfsgid"	}, /* 53 */
+	{ 3,	TD,	sys_ioctl,		"ioctl"		}, /* 54 */
+	{ 3,	TD,	sys_fcntl,		"fcntl"		}, /* 55 */
+	{ 2,	0,	sys_setpgid,		"setpgid"	}, /* 56 */
+	{ 4,	0,	sys_mremap,		"mremap"	}, /* 57 */
+	{ 3,	0,	sys_setresuid,		"setresuid"	}, /* 58 */
+	{ 3,	0,	sys_getresuid,		"getresuid"	}, /* 59 */
+	{ 2,	0,	sys_setreuid,		"setreuid"	}, /* 60 */
+	{ 2,	0,	sys_setregid,		"setregid"	}, /* 61 */
+	{ 2,	0,	sys_ustat,		"ustat"		}, /* 62 */
+	{ 2,	TD,	sys_dup2,		"dup2"		}, /* 63 */
+	{ 0,	0,	sys_getppid,		"getppid"	}, /* 64 */
+	{ 0,	0,	sys_getpgrp,		"getpgrp"	}, /* 65 */
+	{ 0,	0,	sys_setsid,		"setsid"	}, /* 66 */
+	{ 4,	TS,	sys_rt_sigaction,	"rt_sigaction"  }, /* 67 */
+	{ 1,	TS,	printargs,		"rt_sigreturn"	}, /* 68 */
+	{ 4,	TS,	sys_rt_sigprocmask,	"rt_sigprocmask"}, /* 69 */
+	{ 2,	TS,	sys_rt_sigpending,	"rt_sigpending"	}, /* 70 */
+	{ 4,	TS,	sys_rt_sigtimedwait,	"rt_sigtimedwait"}, /* 71 */
+	{ 3,	TS,	sys_rt_sigqueueinfo,    "rt_sigqueueinfo"}, /* 72 */
+	{ 2,	TS,	sys_rt_sigsuspend,	"rt_sigsuspend"	}, /* 73 */
+	{ 2,	0,	sys_sethostname,	"sethostname"	}, /* 74 */
+	{ 2,	0,	sys_setrlimit,		"setrlimit"	}, /* 75 */
+	{ 2,	0,	sys_getrlimit,		"old_getrlimit"	}, /* 76 */
+	{ 2,	0,	sys_getrusage,		"getrusage"	}, /* 77 */
+	{ 2,	0,	sys_gettimeofday,	"gettimeofday"	}, /* 78 */
+	{ 2,	0,	sys_settimeofday,	"settimeofday"	}, /* 79 */
+	{ 2,	0,	sys_getgroups,		"getgroups"	}, /* 80 */
+	{ 2,	0,	sys_setgroups,		"setgroups"	}, /* 81 */
+	{ 5,	TD,	sys_select,		"select"	}, /* 82 */
+	{ 2,	TF,	sys_symlink,		"symlink"	}, /* 83 */
+	{ 1,	TD,	sys_fchdir,		"fchdir"	}, /* 84 */
+	{ 3,	TF,	sys_readlink,		"readlink"	}, /* 85 */
+	{ 5,	TD,	sys_pread,		"pread"		}, /* 86 */
+	{ 5,	TD,	sys_pwrite,		"pwrite"	}, /* 87 */
+	{ 1,	TF,	sys_swapon,		"swapon"	}, /* 88 */
+	{ 3,	0,	sys_reboot,		"reboot"	}, /* 89 */
+	{ 6,	0,	sys_mmap,		"mmap"		}, /* 90 */
+	{ 2,	0,	sys_munmap,		"munmap"	}, /* 91 */
+	{ 2,	TF,	sys_truncate,		"truncate"	}, /* 92 */
+	{ 2,	TD,	sys_ftruncate,		"ftruncate"	}, /* 93 */
+	{ 2,	TD,	sys_fchmod,		"fchmod"	}, /* 94 */
+	{ 3,	TD,	sys_fchown,		"fchown"	}, /* 95 */
+	{ 2,	0,	sys_getpriority,	"getpriority"	}, /* 96 */
+	{ 3,	0,	sys_setpriority,	"setpriority"	}, /* 97 */
+	{ 4,	TP,	sys_wait4,		"wait4"		}, /* 98 */
+	{ 2,	TF,	sys_statfs,		"statfs"	}, /* 99 */
+	{ 2,	TD,	sys_fstatfs,		"fstatfs"	}, /* 100 */
+	{ 0,	0,	sys_vhangup,		"vhangup"	}, /* 101 */
+	{ 2,	TS,	sys_sigaltstack,	"sigaltstack"	}, /* 102 */
+	{ 3,	0,	sys_syslog,		"syslog"	}, /* 103 */
+	{ 3,	0,	sys_setitimer,		"setitimer"	}, /* 104 */
+	{ 2,	0,	sys_getitimer,		"getitimer"	}, /* 105 */
+	{ 1,	0,	sys_swapoff,		"swapoff"	}, /* 106 */
+	{ 1,	0,	sys_sysinfo,		"sysinfo"	}, /* 107 */
+	{ 6,	0,	sys_ipc,		"ipc"		}, /* 108 */
+	{ 4,	TD|TN,	sys_sendfile,		"sendfile"	}, /* 109 */
+	{ 2,	0,	sys_setdomainname,	"setdomainname"	}, /* 110 */
+	{ 1,	0,	sys_uname,		"uname"		}, /* 111 */
+	{ 1,	0,	sys_adjtimex,		"adjtimex"	}, /* 112 */
+	{ 3,	0,	sys_mprotect,		"mprotect"	}, /* 113 */
+	{ 0,	TP,	sys_vfork,		"vfork"		}, /* 114 */
+	{ 3,	0,	sys_init_module,	"init_module"	}, /* 115 */
+	{ 2,	0,	sys_delete_module,	"delete_module"	}, /* 116 */
+	{ 4,	0,	sys_quotactl,		"quotactl"	}, /* 117 */
+	{ 1,	0,	sys_getpgid,		"getpgid"	}, /* 118 */
+	{ 0,	0,	sys_bdflush,		"bdflush"	}, /* 119 */
+	{ 3,	0,	sys_sysfs,		"sysfs"		}, /* 120 */
+	{ 1,	0,	sys_personality,	"personality"	}, /* 121 */
+	{ 5,	0,	sys_afs_syscall,	"afs_syscall"	}, /* 122 */
+	{ 3,	TD,	sys_getdents,		"getdents"	}, /* 123 */
+	{ 2,	TD,	sys_flock,		"flock"		}, /* 124 */
+	{ 3,	0,	sys_msync,		"msync"		}, /* 125 */
+	{ 3,	TD,	sys_readv,		"readv"		}, /* 126 */
+	{ 3,	TD,	sys_writev,		"writev"	}, /* 127 */
+	{ 1,	0,	sys_getsid,		"getsid"	}, /* 128 */
+	{ 1,	TD,	sys_fdatasync,		"fdatasync"	}, /* 129 */
+	{ 1,	0,	sys_sysctl,		"_sysctl"	}, /* 130 */
+	{ 2,	0,	sys_mlock,		"mlock"		}, /* 131 */
+	{ 2,	0,	sys_munlock,		"munlock"	}, /* 132 */
+	{ 2,	0,	sys_mlockall,		"mlockall"	}, /* 133 */
+	{ 0,	0,	sys_munlockall,		"munlockall"	}, /* 134 */
+	{ 0,	0,	sys_sched_setparam,	"sched_setparam"}, /* 135 */
+	{ 2,	0,	sys_sched_getparam,	"sched_getparam"}, /* 136 */
+	{ 3,	0,	sys_sched_setscheduler,	"sched_setscheduler"}, /* 137 */
+	{ 1,	0,	sys_sched_getscheduler,	"sched_getscheduler"}, /* 138 */
+	{ 0,	0,	sys_sched_yield,	"sched_yield"}, /* 139 */
+	{ 1,	0,	sys_sched_get_priority_max,"sched_get_priority_max"}, /* 140 */
+	{ 1,	0,	sys_sched_get_priority_min,"sched_get_priority_min"}, /* 141 */
+	{ 2,	0,	sys_sched_rr_get_interval,"sched_rr_get_interval"}, /* 142 */
+	{ 2,	0,	sys_nanosleep,		"nanosleep"	}, /* 143 */
+	{ 3,	TD,	sys_poll,		"poll"		}, /* 144 */
+	{ 3,	0,	printargs,		"nfsservctl"	}, /* 145 */
+	{ 3,	0,	sys_setresgid,		"setresgid"	}, /* 146 */
+	{ 3,	0,	sys_getresgid,		"getresgid"	}, /* 147 */
+	{ 5,	0,	sys_prctl,		"prctl"		}, /* 148 */
+	{ 3,	TN,	sys_socket,		"socket"	}, /* 149 */
+	{ 3,	TN,	sys_bind,		"bind"		}, /* 150 */
+	{ 3,	TN,	sys_connect,		"connect"	}, /* 151 */
+	{ 2,	TN,	sys_listen,		"listen"	}, /* 152 */
+	{ 3,	TN,	sys_accept,		"accept"	}, /* 153 */
+	{ 3,	TN,	sys_getsockname,	"getsockname"	}, /* 154 */
+	{ 3,	TN,	sys_getpeername,	"getpeername"	}, /* 155 */
+	{ 4,	TN,	sys_socketpair,		"socketpair"	}, /* 156 */
+	{ 4,	TN,	sys_send,		"send"		}, /* 157 */
+	{ 4,	TN,	sys_recv,		"recv"		}, /* 158 */
+	{ 6,	TN,	sys_sendto,		"sendto"	}, /* 159 */
+	{ 6,	TN,	sys_recvfrom,		"recvfrom"	}, /* 160 */
+	{ 2,	TN,	sys_shutdown,		"shutdown"	}, /* 161 */
+	{ 5,	TN,	sys_setsockopt,		"setsockopt"	}, /* 162 */
+	{ 5,	TN,	sys_getsockopt,		"getsockopt"	}, /* 163 */
+	{ 5,	TN,	sys_sendmsg,		"sendmsg"	}, /* 164 */
+	{ 5,	TN,	sys_recvmsg,		"recvmsg"	}, /* 165 */
+	{ 3,	TF,	sys_truncate64,		"truncate64"	}, /* 166 */
+	{ 3,	TD,	sys_ftruncate64,	"ftruncate64"	}, /* 167 */
+	{ 2,	TF,	sys_stat64,		"stat64"	}, /* 168 */
+	{ 2,	TF,	sys_lstat64,		"lstat64"	}, /* 169 */
+	{ 2,	TD,	sys_fstat64,		"fstat64"	}, /* 170 */
+	{ 2,	TF,	sys_pivotroot,		"pivot_root"	}, /* 171 */
+	{ 3,	0,	printargs,		"mincore"	}, /* 172 */
+	{ 3,	0,	sys_madvise,		"madvise"	}, /* 173 */
+	{ 3,	TD,	sys_getdents64,		"getdents64"	}, /* 174 */
+	{ 3,	TD,	sys_fcntl,		"fcntl64"	}, /* 175 */
+	{ 0,	0,	printargs,		"gettid"	}, /* 176 */
+	{ 4,	TD,	sys_readahead,		"readahead"	}, /* 177 */
+	{ 5,	TF,	sys_setxattr,		"setxattr"	}, /* 178 */
+	{ 5,	TF,	sys_setxattr,		"lsetxattr"	}, /* 179 */
+	{ 5,	TD,	sys_fsetxattr,		"fsetxattr"	}, /* 180 */
+	{ 4,	TF,	sys_getxattr,		"getxattr"	}, /* 181 */
+	{ 4,	TF,	sys_getxattr,		"lgetxattr"	}, /* 182 */
+	{ 4,	0,	sys_fgetxattr,		"fgetxattr"	}, /* 183 */
+	{ 3,	TF,	sys_listxattr,		"listxattr"	}, /* 184 */
+	{ 3,	TF,	sys_listxattr,		"llistxattr"	}, /* 185 */
+	{ 3,	0,	sys_flistxattr,		"flistxattr"	}, /* 186 */
+	{ 2,	TF,	sys_removexattr,	"removexattr"	}, /* 187 */
+	{ 2,	TF,	sys_removexattr,	"lremovexattr"	}, /* 188 */
+	{ 2,	TD,	sys_fremovexattr,	"fremovexattr"	}, /* 189 */
+	{ 2,	0,	sys_kill,		"tkill"		}, /* 190 */
+	{ 4,	TD|TN,	sys_sendfile64,		"sendfile64"	}, /* 191 */
+	{ 6,	0,	sys_futex,		"futex"		}, /* 192 */
+	{ 3,	0,	sys_sched_setaffinity,	"sched_setaffinity" },/* 193 */
+	{ 3,	0,	sys_sched_getaffinity,	"sched_getaffinity" },/* 194 */
+	{ 2,	0,	sys_capget,		"capget"	}, /* 195 */
+	{ 2,	0,	sys_capset,		"capset"	}, /* 196 */
+	{ 2,	0,	sys_io_setup,		"io_setup"	}, /* 197 */
+	{ 1,	0,	sys_io_destroy,		"io_destroy"	}, /* 198 */
+	{ 5,	0,	sys_io_getevents,	"io_getevents"	}, /* 199 */
+	{ 3,	0,	sys_io_submit,		"io_submit"	}, /* 200 */
+	{ 3,	0,	sys_io_cancel,		"io_cancel"	}, /* 201 */
+	{ 5,	0,	sys_fadvise64,		"fadvise64"	}, /* 202 */
+	{ 1,	TP,	sys_exit,		"exit_group"	}, /* 203 */
+	{ 4,	0,	printargs,		"lookup_dcookie"}, /* 204 */
+	{ 1,	0,	sys_epoll_create,	"epoll_create"	}, /* 205 */
+	{ 4,	TD,	sys_epoll_ctl,		"epoll_ctl"	}, /* 206 */
+	{ 4,	TD,	sys_epoll_wait,		"epoll_wait"	}, /* 207 */
+	{ 5,	0,	sys_remap_file_pages,	"remap_file_pages"}, /* 208 */
+	{ 1,	0,	printargs,		"set_tid_address"}, /* 209 */
+	{ 3,	0,	sys_timer_create,	"timer_create"	}, /* 210 */
+	{ 4,	0,	sys_timer_settime,	"timer_settime"	}, /* 211 */
+	{ 2,	0,	sys_timer_gettime,	"timer_gettime"	}, /* 212 */
+	{ 1,	0,	sys_timer_getoverrun,	"timer_getoverrun"}, /* 213 */
+	{ 1,	0,	sys_timer_delete,	"timer_delete"	}, /* 214 */
+	{ 2,	0,	sys_clock_settime,	"clock_settime"	}, /* 215 */
+	{ 2,	0,	sys_clock_gettime,	"clock_gettime"	}, /* 216 */
+	{ 2,	0,	sys_clock_getres,	"clock_getres"	}, /* 217 */
+	{ 4,	0,	sys_clock_nanosleep,	"clock_nanosleep"}, /* 218 */
+	{ 3,	TF,	sys_statfs64,		"statfs64"	}, /* 219 */
+	{ 3,	TD,	sys_fstatfs64,		"fstatfs64"	}, /* 220 */
+	{ 3,	TS,	sys_tgkill,		"tgkill"	}, /* 221 */
+	{ 5,	0,	printargs,		"SYS_222"	}, /* 222 */
+	{ 2,	TF,	sys_utimes,		"utimes"	}, /* 223 */
+	{ 6,	0,	sys_fadvise64_64,	"fadvise64_64"	}, /* 224 */
+	{ 3,	0,	printargs,		"cacheflush"	}, /* 225 */
+	{ 5,	0,	printargs,		"vserver"	}, /* 226 */
+	{ 4,	0,	sys_mq_open,		"mq_open"	}, /* 227 */
+	{ 1,	0,	sys_mq_unlink,		"mq_unlink"	}, /* 228 */
+	{ 5,	0,	sys_mq_timedsend,	"mq_timedsend"	}, /* 229 */
+	{ 5,	0,	sys_mq_timedreceive,	"mq_timedreceive" }, /* 230 */
+	{ 2,	0,	sys_mq_notify,		"mq_notify"	}, /* 231 */
+	{ 3,	0,	sys_mq_getsetattr,	"mq_getsetattr" }, /* 232 */
+	{ 5,	0,	printargs,		"kexec_load"	}, /* 233 */
+	{ 5,	TP,	sys_waitid,		"waitid"	}, /* 234 */
+	{ 5,	0,	printargs,		"add_key"	}, /* 235 */
+	{ 4,	0,	printargs,		"request_key"	}, /* 236 */
+	{ 5,	0,	printargs,		"keyctl"	}, /* 237 */
+	{ 3,	0,	printargs,		"ioprio_set"	}, /* 238 */
+	{ 2,	0,	printargs,		"ioprio_get"	}, /* 239 */
+	{ 0,	0,	printargs,		"inotify_init"	}, /* 240 */
+	{ 3,	TD,	sys_inotify_add_watch,	"inotify_add_watch" }, /* 241 */
+	{ 2,	TD,	sys_inotify_rm_watch,	"inotify_rm_watch" }, /* 242 */
+	{ 4,	TD|TF,	sys_openat,		"openat"	}, /* 243 */
+	{ 3,	TD|TF,	sys_mkdirat,		"mkdirat"	}, /* 244 */
+	{ 4,	TD|TF,	sys_mknodat,		"mknodat"	}, /* 245 */
+	{ 5,	TD|TF,	sys_fchownat,		"fchownat"	}, /* 246 */
+	{ 3,	TD|TF,	sys_futimesat,		"futimesat"	}, /* 247 */
+	{ 4,	TD|TF,	printargs,		"fstatat64"	}, /* 248 */
+	{ 3,	TD|TF,	sys_unlinkat,		"unlinkat"	}, /* 249 */
+	{ 4,	TD|TF,	sys_renameat,		"renameat"	}, /* 250 */
+	{ 5,	TD|TF,	sys_linkat,		"linkat"	}, /* 251 */
+	{ 3,	TD|TF,	sys_symlinkat,		"symlinkat"	}, /* 252 */
+	{ 4,	TD|TF,	sys_readlinkat,		"readlinkat"	}, /* 253 */
+	{ 3,	TD|TF,	sys_fchmodat,		"fchmodat"	}, /* 254 */
+	{ 3,	TD|TF,	sys_faccessat,		"faccessat"	}, /* 255 */
+	{ 6,	TD,	sys_pselect6,		"pselect6"	}, /* 256 */
+	{ 5,	TD,	sys_ppoll,		"ppoll"		}, /* 257 */
+	{ 1,	TD,	sys_unshare,		"unshare"	}, /* 258 */
+	{ 2,	0,	printargs,		"set_robust_list" }, /* 259 */
+	{ 3,	0,	printargs,		"get_robust_list" }, /* 260 */
+	{ 6,	TD,	printargs,		"splice"	}, /* 261 */
+	{ 4,	TD,	printargs,		"sync_file_range" }, /* 262 */
+	{ 4,	TD,	printargs,		"tee"		}, /* 263 */
+	{ 4,	TD,	printargs,		"vmsplice"	}, /* 264 */
+	{ 5,	TD,	sys_epoll_pwait,	"epoll_pwait"   }, /* 265 */
+	{ 4,	TI,	sys_msgget,		"msgget"	}, /* 266 */
+	{ 4,	TI,	sys_msgsnd,		"msgsnd"	}, /* 267 */
+	{ 5,	TI,	sys_msgrcv,		"msgrcv"	}, /* 268 */
+	{ 3,	TI,	sys_msgctl,		"msgctl"	}, /* 269 */
+	{ 4,	TI,	sys_semget,		"semget"	}, /* 270 */
+	{ 4,	TI,	sys_semop,		"semop"		}, /* 271 */
+	{ 4,	TI,	sys_semctl,		"semctl"	}, /* 272 */
+	{ 5,	TI,	sys_semtimedop,		"semtimedop"	}, /* 273 */
+	{ 4,	TI,	sys_shmat,		"shmat"		}, /* 274 */
+	{ 4,	TI,	sys_shmget,		"shmget"	}, /* 275 */
+	{ 4,	TI,	sys_shmdt,		"shmdt"		}, /* 276 */
+	{ 4,	TI,	sys_shmctl,		"shmctl"	}, /* 277 */
+	{ 4,	TD|TF,	sys_utimensat,		"utimensat"	}, /* 278 */
+	{ 3,	TD|TS,	sys_signalfd,		"signalfd"	}, /* 279 */
+	{ 2,	TD,	sys_timerfd,		"timerfd_create" }, /* 280 */
+	{ 1,	TD,	sys_eventfd,		"eventfd"	}, /* 281 */
diff --git a/linux/s390x/syscallent.h b/linux/s390x/syscallent.h
index 23e157a..81f4c3b 100644
--- a/linux/s390x/syscallent.h
+++ b/linux/s390x/syscallent.h
@@ -167,7 +167,7 @@
 	{ 5,	0,	sys_afs_syscall,	"afs_syscall"	}, /* 137 */
 	{ -1,	0,	printargs,		"SYS_138"	}, /* 138 */
 	{ -1,	0,	printargs,		"SYS_139"	}, /* 139 */
- 	{ 5,	0,	sys_llseek,		"_llseek"	}, /* 140 */
+	{ 5,	0,	sys_llseek,		"_llseek"	}, /* 140 */
 	{ 3,	TD,	sys_getdents,		"getdents"	}, /* 141 */
 	{ 5,	TD,	sys_select,		"select"	}, /* 142 */
 	{ 2,	TD,	sys_flock,		"flock"		}, /* 143 */
@@ -219,12 +219,12 @@
 	{ 5,	0,	sys_putpmsg,		"putpmsg"	}, /* 189 */
 	{ 0,	TP,	sys_vfork,		"vfork"		}, /* 190 */
 	{ 2,	0,	sys_getrlimit,		"getrlimit"	}, /* 191 */
- 	{ -1,	0,	printargs,		"SYS_192"	}, /* 192 */
- 	{ -1,	0,	printargs,		"SYS_193"	}, /* 193 */
- 	{ -1,	0,	printargs,		"SYS_194"	}, /* 194 */
- 	{ -1,	0,	printargs,		"SYS_195"	}, /* 195 */
- 	{ -1,	0,	printargs,		"SYS_196"	}, /* 196 */
- 	{ -1,	0,	printargs,		"SYS_197"	}, /* 197 */
+	{ -1,	0,	printargs,		"SYS_192"	}, /* 192 */
+	{ -1,	0,	printargs,		"SYS_193"	}, /* 193 */
+	{ -1,	0,	printargs,		"SYS_194"	}, /* 194 */
+	{ -1,	0,	printargs,		"SYS_195"	}, /* 195 */
+	{ -1,	0,	printargs,		"SYS_196"	}, /* 196 */
+	{ -1,	0,	printargs,		"SYS_197"	}, /* 197 */
 	{ 3,	TF,	sys_chown,		"lchown"	}, /* 198 */
 	{ 0,	0,	sys_getuid,		"getuid"	}, /* 199 */
 	{ 0,	0,	sys_getgid,		"getgid"	}, /* 200 */
diff --git a/net.c b/net.c
index b5cf81c..6f38176 100644
--- a/net.c
+++ b/net.c
@@ -1270,7 +1270,7 @@
 struct tcb *tcp;
 {
 	if (entering(tcp)) {
-	  	/* not sure what this arg is */
+		/* not sure what this arg is */
 		tprintf("0x%lx", tcp->u_arg[0]);
 	}
 	return 0;
@@ -1644,7 +1644,7 @@
 			switch (tcp->u_arg[2]) {
 #ifdef SO_LINGER
 			case SO_LINGER:
-			        if (len == sizeof (struct linger)) {
+				if (len == sizeof (struct linger)) {
 					struct linger linger;
 					if (umove (tcp,
 						   tcp->u_arg[3],
diff --git a/proc.c b/proc.c
index 6916799..04ef8fb 100644
--- a/proc.c
+++ b/proc.c
@@ -242,7 +242,7 @@
 		printflags(proc_status_flags, arg, "PF_???");
 		return 1;
 	case PIOCGFL:
-	        if (syserror(tcp))
+		if (syserror(tcp))
 			tprintf(", %#x", arg);
 		else if (umove(tcp, arg, &val) < 0)
 			tprintf(", {...}");
diff --git a/process.c b/process.c
index 4cb21cd..695b9a5 100644
--- a/process.c
+++ b/process.c
@@ -537,7 +537,7 @@
 			return 0;
 		tcpchild = alloctcb(tcp->u_rval);
 		if (proc_open(tcpchild, 2) < 0)
-		  	droptcb(tcpchild);
+			droptcb(tcpchild);
 	}
 	return 0;
 }
@@ -706,11 +706,11 @@
 #elif defined(S390) || defined(S390X)
 	/* s390 linux after 2.4.7 has a hook in entry.S to allow this */
 	if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(PT_GPR2), new)<0)
-	        return -1;
+		return -1;
 	return 0;
 #elif defined(M68K)
 	if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*PT_ORIG_D0), new)<0)
-	    	return -1;
+		return -1;
 	return 0;
 #elif defined(SPARC) || defined(SPARC64)
 	struct regs regs;
@@ -718,15 +718,19 @@
 		return -1;
 	regs.r_g1=new;
 	if (ptrace(PTRACE_SETREGS, tcp->pid, (char*)&regs, 0)<0)
-	    	return -1;
+		return -1;
 	return 0;
 #elif defined(MIPS)
 	if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_V0), new)<0)
-	    	return -1;
+		return -1;
 	return 0;
 #elif defined(ALPHA)
 	if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_A3), new)<0)
-	    	return -1;
+		return -1;
+	return 0;
+#elif defined(AVR32)
+	if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_R8), new) < 0)
+		return -1;
 	return 0;
 #elif defined(BFIN)
 	if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_P0), new)<0)
@@ -752,7 +756,7 @@
 	return 0;
 #elif defined(HPPA)
 	if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(PT_GR20), new)<0)
-	    	return -1;
+		return -1;
 	return 0;
 #elif defined(SH)
 	if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*(REG_REG0+3)), new)<0)
@@ -792,7 +796,34 @@
 	struct tcb *tcp;
 	int argnum;
 {
-#if defined (IA64)
+#if defined(AVR32)
+	{
+		errno = 0;
+		if (argnum == 0)
+			ptrace(PTRACE_POKEUSER, tcp->pid,
+			       (char *)(REG_R12_ORIG),
+			       tcp->u_arg[argnum]);
+		else if (argnum < 4)
+			/* r11 .. r9 */
+			ptrace(PTRACE_POKEUSER, tcp->pid,
+			       (char *)(REG_R12 - 4 * argnum),
+			       tcp->u_arg[argnum]);
+		else if (argnum < 5)
+			/* r5 */
+			ptrace(PTRACE_POKEUSER, tcp->pid,
+			       (char *)(REG_R5),
+			       tcp->u_arg[argnum]);
+		else if (argnum < 6)
+			/* r3 */
+			ptrace(PTRACE_POKEUSER, tcp->pid,
+			       (char *)(REG_R3),
+			       tcp->u_arg[argnum]);
+		else
+			return -E2BIG;
+		if (errno)
+			return -1;
+	}
+#elif defined(IA64)
 	{
 		unsigned long *bsp, *ap;
 
@@ -940,7 +971,7 @@
 				sizeof tcpchild->inst);
 		}
 		tcpchild->parent = tcp;
- 		tcp->nchildren++;
+		tcp->nchildren++;
 		if (tcpchild->flags & TCB_SUSPENDED) {
 			/* The child was born suspended, due to our having
 			   forced CLONE_PTRACE.  */
@@ -998,7 +1029,7 @@
 			}
 		}
 #endif
- 	}
+	}
 	return 0;
 }
 #endif
@@ -1029,7 +1060,7 @@
 	if (entering(tcp)) {
 		if (setbpt(tcp) < 0)
 			return 0;
-  	}
+	}
 	else {
 		int bpt = tcp->flags & TCB_BPTSET;
 
@@ -2990,6 +3021,25 @@
 	{ uoff(regs.ARM_lr),	"lr"					},
 	{ uoff(regs.ARM_pc),	"pc"					},
 	{ uoff(regs.ARM_cpsr),	"cpsr"					},
+#   elif defined(AVR32)
+	{ uoff(regs.sr),	"sr"					},
+	{ uoff(regs.pc),	"pc"					},
+	{ uoff(regs.lr),	"lr"					},
+	{ uoff(regs.sp),	"sp"					},
+	{ uoff(regs.r12),	"r12"					},
+	{ uoff(regs.r11),	"r11"					},
+	{ uoff(regs.r10),	"r10"					},
+	{ uoff(regs.r9),	"r9"					},
+	{ uoff(regs.r8),	"r8"					},
+	{ uoff(regs.r7),	"r7"					},
+	{ uoff(regs.r6),	"r6"					},
+	{ uoff(regs.r5),	"r5"					},
+	{ uoff(regs.r4),	"r4"					},
+	{ uoff(regs.r3),	"r3"					},
+	{ uoff(regs.r2),	"r2"					},
+	{ uoff(regs.r1),	"r1"					},
+	{ uoff(regs.r0),	"r0"					},
+	{ uoff(regs.r12_orig),	"orig_r12"				},
 #   elif defined(MIPS)
 	{ 0,			"r0"					},
 	{ 1,			"r1"					},
@@ -3136,7 +3186,7 @@
 #   if !defined(SPARC) && !defined(HPPA) && !defined(POWERPC) \
 		&& !defined(ALPHA) && !defined(IA64) \
 		&& !defined(CRISV10) && !defined(CRISV32)
-#    if !defined(S390) && !defined(S390X) && !defined(MIPS) && !defined(SPARC64) && !defined(BFIN)
+#    if !defined(S390) && !defined(S390X) && !defined(MIPS) && !defined(SPARC64) && !defined(AVR32) && !defined(BFIN)
 	{ uoff(u_fpvalid),	"offsetof(struct user, u_fpvalid)"	},
 #    endif
 #    if defined(I386) || defined(X86_64)
@@ -3151,20 +3201,20 @@
 #    if !defined(SPARC64)
 	{ uoff(start_code),	"offsetof(struct user, start_code)"	},
 #    endif
-#    ifdef SH64
+#    if defined(AVR32) || defined(SH64)
 	{ uoff(start_data),	"offsetof(struct user, start_data)"	},
 #    endif
 #    if !defined(SPARC64)
 	{ uoff(start_stack),	"offsetof(struct user, start_stack)"	},
 #    endif
 	{ uoff(signal),		"offsetof(struct user, signal)"		},
-#    if !defined(S390) && !defined(S390X) && !defined(MIPS) && !defined(SH) && !defined(SH64) && !defined(SPARC64)
+#    if !defined(AVR32) && !defined(S390) && !defined(S390X) && !defined(MIPS) && !defined(SH) && !defined(SH64) && !defined(SPARC64)
 	{ uoff(reserved),	"offsetof(struct user, reserved)"	},
 #    endif
 #    if !defined(SPARC64)
 	{ uoff(u_ar0),		"offsetof(struct user, u_ar0)"		},
 #    endif
-#    if !defined(ARM) && !defined(MIPS) && !defined(S390) && !defined(S390X) && !defined(SPARC64) && !defined(BFIN)
+#    if !defined(ARM) && !defined(AVR32) && !defined(MIPS) && !defined(S390) && !defined(S390X) && !defined(SPARC64) && !defined(BFIN)
 	{ uoff(u_fpstate),	"offsetof(struct user, u_fpstate)"	},
 #    endif
 	{ uoff(magic),		"offsetof(struct user, magic)"		},
diff --git a/signal.c b/signal.c
index 242a0f3..e0c4662 100644
--- a/signal.c
+++ b/signal.c
@@ -1431,21 +1431,21 @@
 	struct ucontext uc;
 
 	if(entering(tcp)) {
-	  	tcp->u_arg[0] = 0;
+		tcp->u_arg[0] = 0;
 		if (upeek(tcp, REG_SP, &sp) < 0)
-		  	return 0;
+			return 0;
 		/* There are six words followed by a 128-byte siginfo.  */
 		sp = sp + 6 * 4 + 128;
 		if (umove(tcp, sp, &uc) < 0)
-		  	return 0;
+			return 0;
 		tcp->u_arg[0] = 1;
 		tcp->u_arg[1] = *(long *) &uc.uc_sigmask;
 	} else {
 		sigset_t sigm;
 		long_to_sigset(tcp->u_arg[1], &sigm);
-	  	tcp->u_rval = tcp->u_error = 0;
+		tcp->u_rval = tcp->u_error = 0;
 		if(tcp->u_arg[0] == 0)
-		  	return 0;
+			return 0;
 		tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
 		return RVAL_NONE | RVAL_STR;
 	}
@@ -1460,7 +1460,7 @@
 		return 0;
 	}
 	if(entering(tcp)) {
-	  	tcp->u_arg[0] = 0;
+		tcp->u_arg[0] = 0;
 		sp = regs.regs[29];
 		if (umove(tcp, sp, &si) < 0)
 		tcp->u_arg[0] = 1;
@@ -1468,7 +1468,7 @@
 	} else {
 		sigset_t sigm;
 		long_to_sigset(tcp->u_arg[1], &sigm);
-	  	tcp->u_rval = tcp->u_error = 0;
+		tcp->u_rval = tcp->u_error = 0;
 		if(tcp->u_arg[0] == 0)
 			return 0;
 		tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
diff --git a/strace.c b/strace.c
index 1acecf2..fb05613 100644
--- a/strace.c
+++ b/strace.c
@@ -1140,12 +1140,12 @@
 	/* just unset the PF_LINGER flag for the Run-on-Last-Close. */
 	if (ioctl(tcp->pfd, PIOCGFL, &arg) < 0) {
 	        perror("PIOCGFL");
-	        return -1;
+		return -1;
 	}
 	arg &= ~PF_LINGER;
 	if (ioctl(tcp->pfd, PIOCSFL, arg) < 0) {
-	        perror("PIOCSFL");
-	        return -1;
+		perror("PIOCSFL");
+		return -1;
 	}
 #endif /* FREEBSD */
 #endif /* !PIOCSET */
@@ -1464,7 +1464,7 @@
 	if (tcp->parent &&
 	    (tcp->parent->flags & TCB_SUSPENDED) &&
 	    (tcp->parent->waitpid <= 0 || tcp->parent->waitpid == tcp->pid)) {
- 		error = resume(tcp->parent);
+		error = resume(tcp->parent);
 		++resumed;
 	}
 #ifdef TCB_CLONE_THREAD
@@ -1883,10 +1883,10 @@
 	pollinfo.pid = getpid();
 	for (;;) {
 #ifndef FREEBSD
-	        if (ioctl(pfd, PIOCWSTOP, NULL) < 0)
-#else /* FREEBSD */
-	        if (ioctl(pfd, PIOCWSTOP, &pfs) < 0)
-#endif /* FREEBSD */
+		if (ioctl(pfd, PIOCWSTOP, NULL) < 0)
+#else
+		if (ioctl(pfd, PIOCWSTOP, &pfs) < 0)
+#endif
 		{
 			switch (errno) {
 			case EINTR:
@@ -2048,7 +2048,7 @@
 			if (proc_poll_pipe[0] != -1)
 				ioctl_result = IOCTL_STATUS (tcp);
 			else
-			  	ioctl_result = IOCTL_WSTOP (tcp);
+				ioctl_result = IOCTL_WSTOP (tcp);
 #endif /* FREEBSD */
 			ioctl_errno = errno;
 #ifndef HAVE_POLLABLE_PROCFS
@@ -2166,7 +2166,7 @@
 			break;
 #ifdef FREEBSD
 		case 0: /* handle case we polled for nothing */
-		  	continue;
+			continue;
 #endif
 		default:
 			fprintf(stderr, "odd stop %d\n", tcp->status.PR_WHY);
@@ -2227,7 +2227,7 @@
 		tcp->flags |= TCB_EXITING | TCB_GROUP_EXITING;
 		if (tcp->flags & TCB_ATTACHED) {
 			detach(tcp, sig);
-		  	if (leader != NULL && leader != tcp)
+			if (leader != NULL && leader != tcp)
 				leader->flags |= TCB_GROUP_EXITING;
 		} else {
 			if (ptrace_restart(PTRACE_CONT, tcp, sig) < 0) {
diff --git a/stream.c b/stream.c
index 36e8ed5..822afe8 100644
--- a/stream.c
+++ b/stream.c
@@ -468,7 +468,7 @@
 sys_poll(tcp)
 struct tcb *tcp;
 {
-    	return 0;
+	return 0;
 }
 #endif
 
diff --git a/syscall.c b/syscall.c
index 128622d..10b6627 100644
--- a/syscall.c
+++ b/syscall.c
@@ -323,12 +323,12 @@
 	int i;
 	int rc = -1;
 
-  	if (isdigit((unsigned char)*s)) {
- 		int i = atoi(s);
+	if (isdigit((unsigned char)*s)) {
+		int i = atoi(s);
 		if (i < 0 || i >= MAX_QUALS)
- 			return -1;
- 		qualify_one(i, opt, not, -1);
- 		return 0;
+			return -1;
+		qualify_one(i, opt, not, -1);
+		return 0;
 	}
 	for (i = 0; i < nsyscalls0; i++)
 		if (strcmp(s, sysent0[i].sys_name) == 0) {
@@ -364,12 +364,12 @@
 	int i;
 	char buf[32];
 
-  	if (isdigit((unsigned char)*s)) {
- 		int signo = atoi(s);
- 		if (signo < 0 || signo >= MAX_QUALS)
- 			return -1;
- 		qualify_one(signo, opt, not, -1);
- 		return 0;
+	if (isdigit((unsigned char)*s)) {
+		int signo = atoi(s);
+		if (signo < 0 || signo >= MAX_QUALS)
+			return -1;
+		qualify_one(signo, opt, not, -1);
+		return 0;
 	}
 	if (strlen(s) >= sizeof buf)
 		return -1;
@@ -753,6 +753,8 @@
 #elif defined (ALPHA)
 	static long r0;
 	static long a3;
+#elif defined(AVR32)
+	static struct pt_regs regs;
 #elif defined (SPARC) || defined (SPARC64)
 	static struct regs regs;
 	static unsigned long trap;
@@ -814,11 +816,11 @@
 
 	if (syscall_mode != -ENOSYS) {
 		/*
- 		 * Since kernel version 2.5.44 the scno gets passed in gpr2.
+		 * Since kernel version 2.5.44 the scno gets passed in gpr2.
 		 */
 		scno = syscall_mode;
 	} else {
-	       	/*
+		/*
 		 * Old style of "passing" the scno via the SVC instruction.
 		 */
 
@@ -899,6 +901,25 @@
 			return 0;
 		}
 	}
+# elif defined(AVR32)
+	/*
+	 * Read complete register set in one go.
+	 */
+	if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, &regs) < 0)
+		return -1;
+
+	/*
+	 * We only need to grab the syscall number on syscall entry.
+	 */
+	if (!(tcp->flags & TCB_INSYSCALL)) {
+		scno = regs.r8;
+
+		/* Check if we return from execve. */
+		if (tcp->flags & TCB_WAITEXECVE) {
+			tcp->flags &= ~TCB_WAITEXECVE;
+			return 0;
+		}
+	}
 # elif defined(BFIN)
 	if (upeek(tcp, PT_ORIG_P0, &scno))
 		return -1;
@@ -913,7 +934,7 @@
 		return -1;
 
 	if (!(tcp->flags & TCB_INSYSCALL)) {
-	  	static int currpers = -1;
+		static int currpers = -1;
 		long val;
 		int pid = tcp->pid;
 
@@ -1129,10 +1150,10 @@
 	}
 # elif defined (MIPS)
 	if (upeek(tcp, REG_A3, &a3) < 0)
-	  	return -1;
+		return -1;
 	if(!(tcp->flags & TCB_INSYSCALL)) {
-	  	if (upeek(tcp, REG_V0, &scno) < 0)
-		  	return -1;
+		if (upeek(tcp, REG_V0, &scno) < 0)
+			return -1;
 
 		/* Check if we return from execve. */
 		if (scno == 0 && tcp->flags & TCB_WAITEXECVE) {
@@ -1148,8 +1169,8 @@
 			}
 		}
 	} else {
-	  	if (upeek(tcp, REG_V0, &r2) < 0)
-	    		return -1;
+		if (upeek(tcp, REG_V0, &r2) < 0)
+			return -1;
 	}
 # elif defined (ALPHA)
 	if (upeek(tcp, REG_A3, &a3) < 0)
@@ -1270,7 +1291,7 @@
 		   our purposes, make strace print what it *should* have been */
 		long correct_scno = (scno & 0xff);
 		if (debug)
-	    		fprintf(stderr,
+			fprintf(stderr,
 				"Detected glibc bug: bogus system call"
 				" number = %ld, correcting to %ld\n",
 				scno,
@@ -1590,10 +1611,10 @@
 	}
 # elif defined(MIPS)
 		if (a3) {
-		  	tcp->u_rval = -1;
+			tcp->u_rval = -1;
 			u_error = r2;
 		} else {
-		  	tcp->u_rval = r2;
+			tcp->u_rval = r2;
 			u_error = 0;
 		}
 # elif defined(POWERPC)
@@ -1623,6 +1644,15 @@
 			tcp->u_rval = regs.ARM_r0;
 			u_error = 0;
 		}
+# elif defined(AVR32)
+		if (regs.r12 && (unsigned) -regs.r12 < nerrnos) {
+			tcp->u_rval = -1;
+			u_error = -regs.r12;
+		}
+		else {
+			tcp->u_rval = regs.r12;
+			u_error = 0;
+		}
 # elif defined(BFIN)
 		if (is_negated_errno(r0)) {
 			tcp->u_rval = -1;
@@ -1760,10 +1790,10 @@
 #endif /* SVR4 */
 #ifdef FREEBSD
 		if (regs.r_eflags & PSL_C) {
- 		        tcp->u_rval = -1;
+			tcp->u_rval = -1;
 		        u_error = regs.r_eax;
 		} else {
-		        tcp->u_rval = regs.r_eax;
+			tcp->u_rval = regs.r_eax;
 			tcp->u_lrval =
 			  ((unsigned long long) regs.r_edx << 32) +  regs.r_eax;
 		        u_error = 0;
@@ -1827,7 +1857,7 @@
 	/* PTRACE_POKEUSER is OK even for n32 since rval is only a long.  */
 	if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_A3), a3) < 0 ||
 	    ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_V0), r2) < 0)
-	    	return -1;
+		return -1;
 # elif defined(POWERPC)
 	if (upeek(tcp, sizeof(unsigned long)*PT_CCR, &flags) < 0)
 		return -1;
@@ -1850,6 +1880,10 @@
 	regs.ARM_r0 = error ? -error : rval;
 	if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*0), regs.ARM_r0) < 0)
 		return -1;
+# elif defined(AVR32)
+	regs.r12 = error ? -error : rval;
+	if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)REG_R12, regs.r12) < 0)
+		return -1;
 # elif defined(ALPHA)
 	if (error) {
 		a3 = -1;
@@ -1951,7 +1985,7 @@
 		if (tcp->scno >= 0 && tcp->scno < nsyscalls && sysent[tcp->scno].nargs != -1)
 			tcp->u_nargs = sysent[tcp->scno].nargs;
 		else
-     	        	tcp->u_nargs = MAX_ARGS;
+			tcp->u_nargs = MAX_ARGS;
 		for (i = 0; i < tcp->u_nargs; i++) {
 			if (upeek(tcp,i==0 ? PT_ORIGGPR2:PT_GPR2+i*sizeof(long), &tcp->u_arg[i]) < 0)
 				return -1;
@@ -1963,7 +1997,7 @@
 		if (tcp->scno >= 0 && tcp->scno < nsyscalls && sysent[tcp->scno].nargs != -1)
 			tcp->u_nargs = sysent[tcp->scno].nargs;
 		else
-     	        	tcp->u_nargs = MAX_ARGS;
+			tcp->u_nargs = MAX_ARGS;
 		for (i = 0; i < tcp->u_nargs; i++) {
 			/* WTA: if scno is out-of-bounds this will bomb. Add range-check
 			 * for scno somewhere above here!
@@ -2033,12 +2067,12 @@
 	/* N32 and N64 both use up to six registers.  */
 	{
 		unsigned long long regs[38];
-	  	int i, nargs;
+		int i, nargs;
 
 		if (tcp->scno >= 0 && tcp->scno < nsyscalls && sysent[tcp->scno].nargs != -1)
 			nargs = tcp->u_nargs = sysent[tcp->scno].nargs;
 		else
-     	        	nargs = tcp->u_nargs = MAX_ARGS;
+			nargs = tcp->u_nargs = MAX_ARGS;
 
 		if (do_ptrace(PTRACE_GETREGS, tcp, NULL, (long) &regs) < 0)
 			return -1;
@@ -2052,26 +2086,26 @@
 	}
 #elif defined (MIPS)
 	{
-	  	long sp;
-	  	int i, nargs;
+		long sp;
+		int i, nargs;
 
 		if (tcp->scno >= 0 && tcp->scno < nsyscalls && sysent[tcp->scno].nargs != -1)
 			nargs = tcp->u_nargs = sysent[tcp->scno].nargs;
 		else
-     	        	nargs = tcp->u_nargs = MAX_ARGS;
+			nargs = tcp->u_nargs = MAX_ARGS;
 		if (nargs > 4) {
-		  	if (upeek(tcp, REG_SP, &sp) < 0)
-			  	return -1;
+			if (upeek(tcp, REG_SP, &sp) < 0)
+				return -1;
 			for (i = 0; i < 4; i++) {
-			  	if (upeek(tcp, REG_A0 + i, &tcp->u_arg[i])<0)
-				  	return -1;
+				if (upeek(tcp, REG_A0 + i, &tcp->u_arg[i])<0)
+					return -1;
 			}
 			umoven(tcp, sp+16, (nargs-4) * sizeof(tcp->u_arg[0]),
 			       (char *)(tcp->u_arg + 4));
 		} else {
-		  	for (i = 0; i < nargs; i++) {
-			  	if (upeek(tcp, REG_A0 + i, &tcp->u_arg[i]) < 0)
-				  	return -1;
+			for (i = 0; i < nargs; i++) {
+				if (upeek(tcp, REG_A0 + i, &tcp->u_arg[i]) < 0)
+					return -1;
 			}
 		}
 	}
@@ -2084,7 +2118,7 @@
 		if (tcp->scno >= 0 && tcp->scno < nsyscalls && sysent[tcp->scno].nargs != -1)
 			tcp->u_nargs = sysent[tcp->scno].nargs;
 		else
-     	        	tcp->u_nargs = MAX_ARGS;
+			tcp->u_nargs = MAX_ARGS;
 		for (i = 0; i < tcp->u_nargs; i++) {
 			if (upeek(tcp, (i==0) ?
 				(sizeof(unsigned long)*PT_ORIG_R3) :
@@ -2100,7 +2134,7 @@
 		if (tcp->scno >= 0 && tcp->scno < nsyscalls && sysent[tcp->scno].nargs != -1)
 			tcp->u_nargs = sysent[tcp->scno].nargs;
 		else
-     	        	tcp->u_nargs = MAX_ARGS;
+			tcp->u_nargs = MAX_ARGS;
 		for (i = 0; i < tcp->u_nargs; i++)
 			tcp->u_arg[i] = *((&regs.r_o0) + i);
 	}
@@ -2111,7 +2145,7 @@
 		if (tcp->scno >= 0 && tcp->scno < nsyscalls && sysent[tcp->scno].nargs != -1)
 			tcp->u_nargs = sysent[tcp->scno].nargs;
 		else
-     	        	tcp->u_nargs = MAX_ARGS;
+			tcp->u_nargs = MAX_ARGS;
 		for (i = 0; i < tcp->u_nargs; i++) {
 			if (upeek(tcp, PT_GR26-4*i, &tcp->u_arg[i]) < 0)
 				return -1;
@@ -2127,7 +2161,15 @@
 			tcp->u_nargs = MAX_ARGS;
 		for (i = 0; i < tcp->u_nargs; i++)
 			tcp->u_arg[i] = regs.uregs[i];
- 	}
+	}
+#elif defined(AVR32)
+	tcp->u_nargs = sysent[tcp->scno].nargs;
+	tcp->u_arg[0] = regs.r12;
+	tcp->u_arg[1] = regs.r11;
+	tcp->u_arg[2] = regs.r10;
+	tcp->u_arg[3] = regs.r9;
+	tcp->u_arg[4] = regs.r5;
+	tcp->u_arg[5] = regs.r3;
 #elif defined(BFIN)
 	{
 		int i;
@@ -2189,7 +2231,7 @@
 		if (tcp->scno >= 0 && tcp->scno < nsyscalls && sysent[tcp->scno].nargs != -1)
 			tcp->u_nargs = sysent[tcp->scno].nargs;
 		else
-     	        	tcp->u_nargs = MAX_ARGS;
+			tcp->u_nargs = MAX_ARGS;
 		for (i = 0; i < tcp->u_nargs; i++) {
 			if (upeek(tcp, argreg[current_personality][i]*8, &tcp->u_arg[i]) < 0)
 				return -1;
@@ -2218,7 +2260,7 @@
 		if (tcp->scno >= 0 && tcp->scno < nsyscalls && sysent[tcp->scno].nargs != -1)
 			tcp->u_nargs = sysent[tcp->scno].nargs;
 		else
-     	        	tcp->u_nargs = MAX_ARGS;
+			tcp->u_nargs = MAX_ARGS;
 		for (i = 0; i < tcp->u_nargs; i++) {
 			if (upeek(tcp, i*4, &tcp->u_arg[i]) < 0)
 				return -1;
@@ -2232,7 +2274,7 @@
 		if (tcp->scno >= 0 && tcp->scno < nsyscalls && sysent[tcp->scno].nargs != -1)
 			tcp->u_nargs = sysent[tcp->scno].nargs;
 		else
-     	        	tcp->u_nargs = MAX_ARGS;
+			tcp->u_nargs = MAX_ARGS;
 		for (i = 0; i < tcp->u_nargs; i++) {
 			struct user *u;
 
@@ -2298,7 +2340,7 @@
 	    sysent[tcp->scno].nargs > tcp->status.val)
 		tcp->u_nargs = sysent[tcp->scno].nargs;
 	else
-	  	tcp->u_nargs = tcp->status.val;
+		tcp->u_nargs = tcp->status.val;
 	if (tcp->u_nargs < 0)
 		tcp->u_nargs = 0;
 	if (tcp->u_nargs > MAX_ARGS)
diff --git a/util.c b/util.c
index 6a09559..d9de354 100644
--- a/util.c
+++ b/util.c
@@ -1138,8 +1138,7 @@
 
 #if 0
 long
-getpc(tcp)
-struct tcb *tcp;
+getpc(struct tcb *tcp)
 {
 
 #ifdef LINUX
@@ -1156,6 +1155,9 @@
 # elif defined(ARM)
 	if (upeek(tcp, 4*15, &pc) < 0)
 		return -1;
+# elif defined(AVR32)
+	if (upeek(tcp, REG_PC, &pc) < 0)
+		return -1;
 # elif defined(BFIN)
 	if (upeek(tcp, REG_PC, &pc) < 0)
 		return -1;
@@ -1333,6 +1335,14 @@
 		return;
 	}
 	tprintf("[%08lx] ", pc);
+# elif defined(AVR32)
+	long pc;
+
+	if (upeek(tcp, REG_PC, &pc) < 0) {
+		tprintf("[????????] ");
+		return;
+	}
+	tprintf("[%08lx] ", pc);
 # elif defined(BFIN)
 	long pc;
 
@@ -1542,6 +1552,9 @@
 #   elif defined (ALPHA) || defined (MIPS)
 #    define arg0_offset	REG_A0
 #    define arg1_offset	(REG_A0+1)
+#   elif defined (AVR32)
+#    define arg0_offset	(REG_R12)
+#    define arg1_offset	(REG_R11)
 #   elif defined (POWERPC)
 #    define arg0_offset	(sizeof(unsigned long)*PT_R3)
 #    define arg1_offset	(sizeof(unsigned long)*PT_R4)
@@ -1675,7 +1688,7 @@
 				 & ~(tcp->u_arg[arg0_index] & CLONE_VFORK
 				     ? CLONE_VFORK | CLONE_VM : 0)) < 0
 		    || arg_finish_change (tcp, &state) < 0))
-		    return -1;
+			return -1;
 		tcp->flags |= TCB_BPTSET;
 		tcp->inst[0] = tcp->u_arg[arg0_index];
 		tcp->inst[1] = tcp->u_arg[arg1_index];
@@ -1850,7 +1863,7 @@
 		return -1;
 #     elif defined (M68K)
 	if (upeek(tcp, 4*PT_PC, &tcp->baddr) < 0)
-	  return -1;
+		return -1;
 #     elif defined (ALPHA)
 	return -1;
 #     elif defined (ARM)