Module Name:    src
Committed By:   rjs
Date:           Thu Apr  3 16:22:20 UTC 2014

Modified Files:
        src/sys/arch/arm/arm: linux_syscall.c

Log Message:
Add support for EABI syscalls.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/arm/linux_syscall.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/arm/linux_syscall.c
diff -u src/sys/arch/arm/arm/linux_syscall.c:1.25 src/sys/arch/arm/arm/linux_syscall.c:1.26
--- src/sys/arch/arm/arm/linux_syscall.c:1.25	Sun Aug 18 07:01:45 2013
+++ src/sys/arch/arm/arm/linux_syscall.c	Thu Apr  3 16:22:20 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_syscall.c,v 1.25 2013/08/18 07:01:45 matt Exp $	*/
+/*	$NetBSD: linux_syscall.c,v 1.26 2014/04/03 16:22:20 rjs Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2003 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.25 2013/08/18 07:01:45 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.26 2014/04/03 16:22:20 rjs Exp $");
 
 #include <sys/device.h>
 #include <sys/errno.h>
@@ -90,6 +90,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_syscal
 
 /* ARMLinux has some system calls of its very own. */
 #define LINUX_ARM_NR_BASE	0x9f0000
+#define LINUX_EARM_NR_BASE	0x0f0000
 #define LINUX_SYS_ARMBASE	0x000180 /* Must agree with syscalls.master */
 
 void linux_syscall_intern(struct proc *);
@@ -115,9 +116,15 @@ linux_syscall_plain(trapframe_t *frame, 
 	register_t *args, rval[2];
 
 	code = insn & 0x00ffffff;
-	/* Remap ARM-specific syscalls onto the end of the standard range. */
-	if (code > LINUX_ARM_NR_BASE)
-		code = code - LINUX_ARM_NR_BASE + LINUX_SYS_ARMBASE;
+	if (code == 0) {	/* EABI */
+		code = frame->tf_r7;
+		if (code > LINUX_EARM_NR_BASE)
+			code = code - LINUX_EARM_NR_BASE + LINUX_SYS_ARMBASE;
+	} else {
+		/* Remap ARM-specific syscalls onto the end of the standard range. */
+		if (code > LINUX_ARM_NR_BASE)
+			code = code - LINUX_ARM_NR_BASE + LINUX_SYS_ARMBASE;
+	}
 	code &= LINUX_SYS_NSYSENT - 1;
 
 	/* Linux passes all arguments in order in registers, which is nice. */
@@ -160,9 +167,15 @@ linux_syscall_fancy(trapframe_t *frame, 
 	register_t *args, rval[2];
 
 	code = insn & 0x00ffffff;
-	/* Remap ARM-specific syscalls onto the end of the standard range. */
-	if (code > LINUX_ARM_NR_BASE)
-		code = code - LINUX_ARM_NR_BASE + LINUX_SYS_ARMBASE;
+	if (code == 0) {	/* EABI */
+		code = frame->tf_r7;
+		if (code > LINUX_EARM_NR_BASE)
+			code = code - LINUX_EARM_NR_BASE + LINUX_SYS_ARMBASE;
+	} else {
+		/* Remap ARM-specific syscalls onto the end of the standard range. */
+		if (code > LINUX_ARM_NR_BASE)
+			code = code - LINUX_ARM_NR_BASE + LINUX_SYS_ARMBASE;
+	}
 	code &= LINUX_SYS_NSYSENT - 1;
 
 	/* Linux passes all arguments in order in registers, which is nice. */

Reply via email to