From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 21/31] arm64: 32-bit (compat) applications support
Date: Thu, 13 Sep 2012 10:07:32 +0100 [thread overview]
Message-ID: <20120913090732.GA25131@arm.com> (raw)
In-Reply-To: <201209071947.45313.arnd@arndb.de>
On Fri, Sep 07, 2012 at 08:47:45PM +0100, Arnd Bergmann wrote:
> On Friday 07 September 2012, Catalin Marinas wrote:
> >
> > From: Will Deacon <will.deacon@arm.com>
> >
> > This patch adds support for 32-bit applications. The vectors page is a
> > binary blob mapped into the application user space at 0xffff0000 (the
> > AArch64 toolchain does not support compilation of AArch32 code). Full
> > compatibility with ARMv7 user space is supported. The use of deprecated
> > ARMv7 functionality (SWP, CP15 barriers) has been disabled by default on
> > AArch64 kernels and unaligned LDM/STM is not supported.
> >
> > Please note that only the ARM 32-bit EABI is supported, so no OABI
> > compatibility.
> >
> > Signed-off-by: Will Deacon <will.deacon@arm.com>
> > Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> > Acked-by: Tony Lindgren <tony@atomide.com>
>
> I guess you haven't had time to turn any of these into architecture
> independent functions as discussed last time?
Here they are. For converting the other architectures, I'll post
separate patches as I don't want to add an extra dependency to the
arm64 series.
>From 87fb5301a44ac05b4e6d7245db02acc2dedde831 Mon Sep 17 00:00:00 2001
From: Catalin Marinas <catalin.marinas@arm.com>
Date: Thu, 13 Sep 2012 09:51:10 +0100
Subject: [PATCH 1/3] Add generic compat_sys_sendfile and
compat_sys_sendfile64
These functions are used by other architectures requiring compat
support, so just make them generic.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Arnd Bergmann <arnd@arndb.de>
---
include/linux/compat.h | 5 +++++
kernel/compat.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat.h b/include/linux/compat.h
index c4be3f5..e2f5e9a 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -594,6 +594,11 @@ asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
unsigned long liovcnt, const struct compat_iovec __user *rvec,
unsigned long riovcnt, unsigned long flags);
+asmlinkage int compat_sys_sendfile(int out_fd, int in_fd,
+ compat_off_t __user *offset, s32 count);
+asmlinkage int compat_sys_sendfile64(int out_fd, int in_fd,
+ compat_loff_t __user *offset, s32 count);
+
#else
#define is_compat_task() (0)
diff --git a/kernel/compat.c b/kernel/compat.c
index c28a306..5f07388 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -1215,6 +1215,50 @@ compat_sys_sysinfo(struct compat_sysinfo __user *info)
return 0;
}
+#ifdef __ARCH_WANT_COMPAT_SYS_SENDFILE
+asmlinkage int compat_sys_sendfile(int out_fd, int in_fd,
+ compat_off_t __user *offset, s32 count)
+{
+ mm_segment_t old_fs = get_fs();
+ int ret;
+ off_t of;
+
+ if (offset && get_user(of, offset))
+ return -EFAULT;
+
+ set_fs(KERNEL_DS);
+ ret = sys_sendfile(out_fd, in_fd,
+ offset ? (off_t __user *)&of : NULL, count);
+ set_fs(old_fs);
+
+ if (offset && put_user(of, offset))
+ return -EFAULT;
+ return ret;
+}
+#endif /* __ARCH_WANT_COMPAT_SYS_SENDFILE */
+
+#ifdef __ARCH_WANT_COMPAT_SYS_SENDFILE64
+asmlinkage int compat_sys_sendfile64(int out_fd, int in_fd,
+ compat_loff_t __user *offset, s32 count)
+{
+ mm_segment_t old_fs = get_fs();
+ int ret;
+ loff_t of;
+
+ if (offset && get_user(of, offset))
+ return -EFAULT;
+
+ set_fs(KERNEL_DS);
+ ret = sys_sendfile(out_fd, in_fd,
+ offset ? (loff_t __user *)&of : NULL, count);
+ set_fs(old_fs);
+
+ if (offset && put_user(of, offset))
+ return -EFAULT;
+ return ret;
+}
+#endif /* __ARCH_WANT_COMPAT_SYS_SENDFILE64 */
+
/*
* Allocate user-space memory for the duration of a single system call,
* in order to marshall parameters inside a compat thunk.
>From fa734f9523e35d7a6e9ab5e252ab344133111c1f Mon Sep 17 00:00:00 2001
From: Catalin Marinas <catalin.marinas@arm.com>
Date: Thu, 13 Sep 2012 09:55:17 +0100
Subject: [PATCH 2/3] Add generic compat_sys_sched_rr_get_interval
implementation
This patch adds a generic implementation for
compat_sys_sched_rr_get_interval as it is used by other architectures.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Arnd Bergmann <arnd@arndb.de>
---
include/linux/compat.h | 3 +++
kernel/compat.c | 17 +++++++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat.h b/include/linux/compat.h
index e2f5e9a..bbe89b8 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -599,6 +599,9 @@ asmlinkage int compat_sys_sendfile(int out_fd, int in_fd,
asmlinkage int compat_sys_sendfile64(int out_fd, int in_fd,
compat_loff_t __user *offset, s32 count);
+asmlinkage int compat_sys_sched_rr_get_interval(compat_pid_t pid,
+ struct compat_timespec __user *interval);
+
#else
#define is_compat_task() (0)
diff --git a/kernel/compat.c b/kernel/compat.c
index 5f07388..3961f67 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -1259,6 +1259,23 @@ asmlinkage int compat_sys_sendfile64(int out_fd, int in_fd,
}
#endif /* __ARCH_WANT_COMPAT_SYS_SENDFILE64 */
+#ifdef __ARCH_WANT_COMPAT_SYS_SCHED_RR_GET_INTERVAL
+asmlinkage int compat_sys_sched_rr_get_interval(compat_pid_t pid,
+ struct compat_timespec __user *interval)
+{
+ struct timespec t;
+ int ret;
+ mm_segment_t old_fs = get_fs();
+
+ set_fs(KERNEL_DS);
+ ret = sys_sched_rr_get_interval(pid, (struct timespec __user *)&t);
+ set_fs(old_fs);
+ if (put_compat_timespec(&t, interval))
+ return -EFAULT;
+ return ret;
+}
+#endif /* __ARCH_WANT_COMPAT_SYS_SCHED_RR_GET_INTERVAL */
+
/*
* Allocate user-space memory for the duration of a single system call,
* in order to marshall parameters inside a compat thunk.
>From 79ed6c77bdd4480b81defe1cd81198235e9d4d03 Mon Sep 17 00:00:00 2001
From: Catalin Marinas <catalin.marinas@arm.com>
Date: Thu, 13 Sep 2012 10:02:26 +0100
Subject: [PATCH 3/3] arm64: Use generic compat_sys_sendfile and
compat_sys_sched_rr_get_interval
This patch switches the arm64 port to use the generic implementation of
the above functions.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---
arch/arm64/include/asm/unistd32.h | 2 ++
arch/arm64/kernel/sys_compat.c | 35 -----------------------------------
2 files changed, 2 insertions(+), 35 deletions(-)
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
index a50405f..4161b4c 100644
--- a/arch/arm64/include/asm/unistd32.h
+++ b/arch/arm64/include/asm/unistd32.h
@@ -754,5 +754,7 @@ __SYSCALL(__NR_syncfs, sys_syncfs)
#define __ARCH_WANT_SYS_SIGPENDING
#define __ARCH_WANT_SYS_SIGPROCMASK
#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
+#define __ARCH_WANT_COMPAT_SYS_SENDFILE
+#define __ARCH_WANT_COMPAT_SYS_SCHED_RR_GET_INTERVAL
#endif /* __ASM_UNISTD32_H */
diff --git a/arch/arm64/kernel/sys_compat.c b/arch/arm64/kernel/sys_compat.c
index d77ba8e..740485d 100644
--- a/arch/arm64/kernel/sys_compat.c
+++ b/arch/arm64/kernel/sys_compat.c
@@ -51,41 +51,6 @@ asmlinkage int compat_sys_vfork(struct pt_regs *regs)
regs, 0, NULL, NULL);
}
-asmlinkage int compat_sys_sched_rr_get_interval(compat_pid_t pid,
- struct compat_timespec __user *interval)
-{
- struct timespec t;
- int ret;
- mm_segment_t old_fs = get_fs();
-
- set_fs(KERNEL_DS);
- ret = sys_sched_rr_get_interval(pid, (struct timespec __user *)&t);
- set_fs(old_fs);
- if (put_compat_timespec(&t, interval))
- return -EFAULT;
- return ret;
-}
-
-asmlinkage int compat_sys_sendfile(int out_fd, int in_fd,
- compat_off_t __user *offset, s32 count)
-{
- mm_segment_t old_fs = get_fs();
- int ret;
- off_t of;
-
- if (offset && get_user(of, offset))
- return -EFAULT;
-
- set_fs(KERNEL_DS);
- ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *)&of : NULL,
- count);
- set_fs(old_fs);
-
- if (offset && put_user(of, offset))
- return -EFAULT;
- return ret;
-}
-
static inline void
do_compat_cache_op(unsigned long start, unsigned long end, int flags)
{
--
Catalin
next prev parent reply other threads:[~2012-09-13 9:07 UTC|newest]
Thread overview: 115+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-07 16:26 [PATCH v3 00/31] AArch64 Linux kernel port Catalin Marinas
2012-09-07 16:26 ` [PATCH v3 01/31] arm64: Assembly macros and definitions Catalin Marinas
2012-09-07 16:26 ` [PATCH v3 02/31] arm64: Kernel booting and initialisation Catalin Marinas
2012-09-07 19:07 ` Arnd Bergmann
2012-09-09 17:20 ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-09 23:29 ` Nicolas Pitre
2012-09-10 5:53 ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-10 12:51 ` Catalin Marinas
2012-09-10 13:53 ` Arnd Bergmann
2012-09-10 14:12 ` Nicolas Pitre
2012-09-10 14:48 ` Arnd Bergmann
2012-09-10 14:53 ` Catalin Marinas
2012-09-10 15:00 ` Nicolas Pitre
2012-09-10 15:21 ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-10 16:08 ` Catalin Marinas
2012-09-10 16:29 ` Nicolas Pitre
2012-09-10 20:28 ` Jon Masters
2012-09-10 16:11 ` Catalin Marinas
2012-09-12 12:08 ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-12 13:49 ` Catalin Marinas
2012-09-13 15:56 ` Christopher Covington
2012-09-13 17:11 ` Catalin Marinas
2012-09-07 16:26 ` [PATCH v3 03/31] arm64: Exception handling Catalin Marinas
2012-09-07 19:09 ` Arnd Bergmann
2012-09-07 16:26 ` [PATCH v3 04/31] arm64: MMU definitions Catalin Marinas
2012-09-07 19:10 ` Arnd Bergmann
2012-09-07 16:26 ` [PATCH v3 05/31] arm64: MMU initialisation Catalin Marinas
2012-09-07 19:10 ` Arnd Bergmann
2012-09-07 16:26 ` [PATCH v3 06/31] arm64: MMU fault handling and page table management Catalin Marinas
2012-09-07 19:11 ` Arnd Bergmann
2012-09-07 16:26 ` [PATCH v3 07/31] arm64: Process management Catalin Marinas
2012-09-07 19:20 ` Arnd Bergmann
2012-09-07 16:26 ` [PATCH v3 08/31] arm64: CPU support Catalin Marinas
2012-09-07 19:24 ` Arnd Bergmann
2012-09-10 16:43 ` Catalin Marinas
2012-09-07 16:26 ` [PATCH v3 09/31] arm64: Cache maintenance routines Catalin Marinas
2012-09-07 19:28 ` Arnd Bergmann
2012-09-10 16:48 ` Catalin Marinas
2012-09-10 17:29 ` Nicolas Pitre
2012-09-14 16:53 ` Catalin Marinas
2012-09-07 19:35 ` Simon Baatz
2012-09-12 9:29 ` Catalin Marinas
2012-09-12 21:55 ` Simon Baatz
2012-09-13 12:38 ` Catalin Marinas
2012-09-13 20:14 ` Simon Baatz
2012-09-07 16:26 ` [PATCH v3 10/31] arm64: TLB maintenance functionality Catalin Marinas
2012-09-07 19:28 ` Arnd Bergmann
2012-09-07 16:26 ` [PATCH v3 11/31] arm64: IRQ handling Catalin Marinas
2012-09-07 19:37 ` Arnd Bergmann
2012-09-12 10:24 ` Catalin Marinas
2012-09-07 16:26 ` [PATCH v3 12/31] arm64: Atomic operations Catalin Marinas
2012-09-07 19:37 ` Arnd Bergmann
2012-09-07 16:26 ` [PATCH v3 13/31] arm64: Device specific operations Catalin Marinas
2012-09-07 16:26 ` [PATCH v3 14/31] arm64: DMA mapping API Catalin Marinas
2012-09-07 19:38 ` Arnd Bergmann
2012-09-07 16:26 ` [PATCH v3 15/31] arm64: SMP support Catalin Marinas
2012-09-07 19:39 ` Arnd Bergmann
2015-08-06 0:46 ` Timur Tabi
2015-08-06 9:56 ` Catalin Marinas
2015-08-10 11:00 ` Hanjun Guo
2015-08-10 17:05 ` Timur Tabi
2015-08-21 16:45 ` Timur Tabi
2015-08-24 12:14 ` Hanjun Guo
2015-08-27 22:15 ` Timur Tabi
2012-09-07 16:26 ` [PATCH v3 16/31] arm64: ELF definitions Catalin Marinas
2012-09-07 19:40 ` Arnd Bergmann
2012-09-07 16:26 ` [PATCH v3 17/31] arm64: System calls handling Catalin Marinas
2012-09-07 19:43 ` Arnd Bergmann
2012-09-07 19:54 ` Al Viro
2012-09-10 9:56 ` Catalin Marinas
2012-09-10 13:51 ` Arnd Bergmann
2012-09-10 14:01 ` Catalin Marinas
2012-09-10 14:24 ` Arnd Bergmann
2012-09-10 15:50 ` Catalin Marinas
2012-09-07 16:26 ` [PATCH v3 18/31] arm64: VDSO support Catalin Marinas
2012-09-07 19:44 ` Arnd Bergmann
2012-09-07 16:26 ` [PATCH v3 19/31] arm64: Signal handling support Catalin Marinas
2012-09-07 16:26 ` [PATCH v3 20/31] arm64: User access library functions Catalin Marinas
2012-09-07 19:46 ` Arnd Bergmann
2012-09-07 16:26 ` [PATCH v3 21/31] arm64: 32-bit (compat) applications support Catalin Marinas
2012-09-07 19:47 ` Arnd Bergmann
2012-09-13 9:07 ` Catalin Marinas [this message]
2012-09-13 11:03 ` Arnd Bergmann
2012-09-13 15:50 ` Catalin Marinas
2012-09-07 16:26 ` [PATCH v3 22/31] arm64: Floating point and SIMD Catalin Marinas
2012-09-07 16:26 ` [PATCH v3 23/31] arm64: Debugging support Catalin Marinas
2012-09-07 19:49 ` Arnd Bergmann
2012-09-07 16:26 ` [PATCH v3 24/31] arm64: Add support for /proc/sys/debug/exception-trace Catalin Marinas
2012-09-07 16:27 ` [PATCH v3 25/31] arm64: Performance counters support Catalin Marinas
2012-09-07 16:27 ` [PATCH v3 26/31] arm64: Miscellaneous library functions Catalin Marinas
2012-09-07 19:52 ` Arnd Bergmann
2012-09-12 21:12 ` Catalin Marinas
2012-09-13 10:48 ` Arnd Bergmann
2012-09-07 16:27 ` [PATCH v3 27/31] arm64: Loadable modules Catalin Marinas
2012-09-07 19:52 ` Arnd Bergmann
2012-09-07 16:27 ` [PATCH v3 28/31] arm64: Generic timers support Catalin Marinas
2012-09-07 19:53 ` Arnd Bergmann
2012-09-08 8:28 ` Shilimkar, Santosh
2012-09-07 16:27 ` [PATCH v3 29/31] arm64: Miscellaneous header files Catalin Marinas
2012-09-07 19:54 ` Arnd Bergmann
2012-09-07 16:27 ` [PATCH v3 30/31] arm64: Build infrastructure Catalin Marinas
2012-09-07 19:55 ` Arnd Bergmann
2012-09-07 16:27 ` [PATCH v3 31/31] arm64: MAINTAINERS update Catalin Marinas
2012-09-09 16:31 ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-10 17:57 ` Nicolas Pitre
2012-09-10 21:17 ` Russell King - ARM Linux
2012-09-10 23:31 ` Nicolas Pitre
2012-09-07 23:25 ` [PATCH v3 00/31] AArch64 Linux kernel port Olof Johansson
2012-09-12 14:54 ` Catalin Marinas
2012-09-08 9:18 ` Santosh Shilimkar
2012-09-08 13:59 ` Nicolas Pitre
2012-09-08 14:42 ` Shilimkar, Santosh
2012-09-10 17:53 ` Nicolas Pitre
2012-09-10 20:22 ` Jon Masters
2012-09-12 11:54 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120913090732.GA25131@arm.com \
--to=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).