2008-01-25  Bruna Moreira <bruna.moreira@indt.org>

	* defs.h [ARM]: Define SUPPORTED_PERSONALITIES to 2.
	* syscall.c (get_scno) [ARM]: Add support for architecture specific
	syscalls.
	* linux/arm/syscallent.h: Update network syscalls list.
	* linux/arm/syscallent1.h: New file. Add new architecture specific
	syscalls.
	* linux/arm/errnoent1.h: New file.
	* linux/arm/ioctlent1.h: New file.
	* linux/arm/signalent1.h: New file.
	Fixes Debian#441000.
diff --git a/defs.h b/defs.h
index e819174..0ac733f 100644
--- a/defs.h
+++ b/defs.h
@@ -228,6 +228,13 @@
 #define PERSONALITY1_WORDSIZE 4
 #endif
 
+#ifdef ARM
+#undef SUPPORTED_PERSONALITIES
+#define SUPPORTED_PERSONALITIES 2
+#define PERSONALITY0_WORDSIZE 4
+#define PERSONALITY1_WORDSIZE 4
+#endif
+
 #ifdef SVR4
 #ifdef HAVE_MP_PROCFS
 extern int mp_ioctl (int f, int c, void *a, int s);
diff --git a/linux/arm/errnoent1.h b/linux/arm/errnoent1.h
new file mode 100644
index 0000000..a894827
--- /dev/null
+++ b/linux/arm/errnoent1.h
@@ -0,0 +1,2 @@
+/* Our second set comes from the i386 files.  */
+#include "../errnoent.h"
diff --git a/linux/arm/ioctlent1.h b/linux/arm/ioctlent1.h
new file mode 100644
index 0000000..a44b0ae
--- /dev/null
+++ b/linux/arm/ioctlent1.h
@@ -0,0 +1,2 @@
+/* Our second set comes from the i386 files.  */
+#include "../ioctlent.h"
diff --git a/linux/arm/signalent1.h b/linux/arm/signalent1.h
new file mode 100644
index 0000000..5c18d98
--- /dev/null
+++ b/linux/arm/signalent1.h
@@ -0,0 +1,2 @@
+/* Our second set comes from the i386 files.  */
+#include "../signalent.h"
diff --git a/linux/arm/syscallent.h b/linux/arm/syscallent.h
index 8718cf7..b70dac1 100644
--- a/linux/arm/syscallent.h
+++ b/linux/arm/syscallent.h
@@ -311,23 +311,23 @@
 	{ 2,	0,	sys_mq_notify,		"mq_notify"	}, /* 278 */
 	{ 3,	0,	sys_mq_getsetattr,	"mq_getsetattr"	}, /* 279 */
 	{ 5,	TP,	sys_waitid,		"waitid"	}, /* 280 */
-	{ 5,	0,	printargs,		"SYS_281"	}, /* 281 */
-	{ 5,	0,	printargs,		"SYS_282"	}, /* 282 */
-	{ 5,	0,	printargs,		"SYS_283"	}, /* 283 */
-	{ 5,	0,	printargs,		"SYS_284"	}, /* 284 */
-	{ 5,	0,	printargs,		"SYS_285"	}, /* 285 */
-	{ 5,	0,	printargs,		"SYS_286"	}, /* 286 */
-	{ 5,	0,	printargs,		"SYS_287"	}, /* 287 */
-	{ 5,	0,	printargs,		"SYS_288"	}, /* 288 */
-	{ 5,	0,	printargs,		"SYS_289"	}, /* 289 */
-	{ 5,	0,	printargs,		"SYS_290"	}, /* 290 */
-	{ 5,	0,	printargs,		"SYS_291"	}, /* 291 */
-	{ 5,	0,	printargs,		"SYS_292"	}, /* 292 */
-	{ 5,	0,	printargs,		"SYS_293"	}, /* 293 */
-	{ 5,	0,	printargs,		"SYS_294"	}, /* 294 */
-	{ 5,	0,	printargs,		"SYS_295"	}, /* 295 */
-	{ 5,	0,	printargs,		"SYS_296"	}, /* 296 */
-	{ 5,	0,	printargs,		"SYS_297"	}, /* 297 */
+	{ 3,	TN,	sys_socket,		"socket"	}, /* 281 */
+	{ 3,	TN,	sys_bind,		"bind"		}, /* 282 */
+	{ 3,	TN,	sys_connect,		"connect"	}, /* 283 */
+	{ 2,	TN,	sys_listen,		"listen"	}, /* 284 */
+	{ 3,	TN,	sys_accept,		"accept"	}, /* 285 */
+	{ 3,	TN,	sys_getsockname,	"getsockname"	}, /* 286 */
+	{ 3,	TN,	sys_getpeername,	"getpeername"	}, /* 287 */
+	{ 4,	TN,	sys_socketpair,		"socketpair"	}, /* 288 */
+	{ 4,	TN,	sys_send,		"send"		}, /* 289 */
+	{ 6,	TN,	sys_sendto,		"sendto"	}, /* 290 */
+	{ 4,	TN,	sys_recv,		"recv"		}, /* 291 */
+	{ 6,	TN,	sys_recvfrom,		"recvfrom"	}, /* 292 */
+	{ 2,	TN,	sys_shutdown,		"shutdown"	}, /* 293 */
+	{ 5,	TN,	sys_setsockopt,		"setsockopt"	}, /* 294 */
+	{ 5,	TN,	sys_getsockopt,		"getsockopt"	}, /* 295 */
+	{ 3,	TN,	sys_sendmsg,		"sendmsg"	}, /* 296 */
+	{ 3,	TN,	sys_recvmsg,		"recvmsg"	}, /* 297 */
 	{ 5,	0,	printargs,		"SYS_298"	}, /* 298 */
 	{ 5,	0,	printargs,		"SYS_299"	}, /* 299 */
 	{ 5,	0,	printargs,		"SYS_300"	}, /* 300 */
diff --git a/linux/arm/syscallent1.h b/linux/arm/syscallent1.h
new file mode 100644
index 0000000..0978e9f
--- /dev/null
+++ b/linux/arm/syscallent1.h
@@ -0,0 +1,7 @@
+/* ARM specific syscalls */
+	{ 5,	0,	printargs,		"SYS_0"			}, /* 0 */
+	{ 5,	0,	printargs,		"breakpoint"		}, /* 1 */
+	{ 5,	0,	printargs,		"cacheflush"		}, /* 2 */
+	{ 5,	0,	printargs,		"usr26"			}, /* 3 */
+	{ 5,	0,	printargs,		"usr32"			}, /* 4 */
+	{ 5,	0,	printargs,		"set_tls"		}, /* 5 */
diff --git a/syscall.c b/syscall.c
index e699c61..a2d26d3 100644
--- a/syscall.c
+++ b/syscall.c
@@ -1055,6 +1055,14 @@
 				scno &= 0x000fffff;
 			}
 		}
+		if (scno & 0x0f0000) {
+			/*
+			 * Handle ARM specific syscall
+			 */
+			set_personality(1);
+			scno &= 0x0000ffff;
+		} else
+			set_personality(0);
 
 		if (tcp->flags & TCB_INSYSCALL) {
 			fprintf(stderr, "pid %d stray syscall entry\n", tcp->pid);