From: matthew.leach@arm.com (Matthew Leach)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 07/14] arm64: compat: correct register concatenation for syscall wrappers
Date: Fri, 11 Oct 2013 14:52:13 +0100 [thread overview]
Message-ID: <1381499540-28794-8-git-send-email-matthew.leach@arm.com> (raw)
In-Reply-To: <1381499540-28794-1-git-send-email-matthew.leach@arm.com>
The arm64 port contains wrappers for arm32 syscalls that pass 64-bit
values. These wrappers concatenate the two registers to hold a 64-bit
value in a single X register. On BE, however, the lower and higher
words are swapped.
Create a new assembler macro, regs_to_64, that when on BE systems
swaps the registers in the orr instruction.
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Matthew Leach <matthew.leach@arm.com>
---
arch/arm64/include/asm/assembler.h | 12 ++++++++++++
arch/arm64/kernel/sys32.S | 22 +++++++++++-----------
2 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h
index 5aceb83..381b935 100644
--- a/arch/arm64/include/asm/assembler.h
+++ b/arch/arm64/include/asm/assembler.h
@@ -115,3 +115,15 @@ lr .req x30 // link register
.align 7
b \label
.endm
+/*
+ * Define a macro that constructs a 64-bit value by concatenating two
+ * 32-bit registers. Note that on big endian systems the order of the
+ * registers is swapped.
+ */
+#ifndef CONFIG_CPU_BIG_ENDIAN
+ .macro regs_to_64, rd, lbits, hbits
+#else
+ .macro regs_to_64, rd, hbits, lbits
+#endif
+ orr \rd, \lbits, \hbits, lsl #32
+ .endm
diff --git a/arch/arm64/kernel/sys32.S b/arch/arm64/kernel/sys32.S
index a1b19ed..423a5b3 100644
--- a/arch/arm64/kernel/sys32.S
+++ b/arch/arm64/kernel/sys32.S
@@ -59,48 +59,48 @@ ENDPROC(compat_sys_fstatfs64_wrapper)
* extension.
*/
compat_sys_pread64_wrapper:
- orr x3, x4, x5, lsl #32
+ regs_to_64 x3, x4, x5
b sys_pread64
ENDPROC(compat_sys_pread64_wrapper)
compat_sys_pwrite64_wrapper:
- orr x3, x4, x5, lsl #32
+ regs_to_64 x3, x4, x5
b sys_pwrite64
ENDPROC(compat_sys_pwrite64_wrapper)
compat_sys_truncate64_wrapper:
- orr x1, x2, x3, lsl #32
+ regs_to_64 x1, x2, x3
b sys_truncate
ENDPROC(compat_sys_truncate64_wrapper)
compat_sys_ftruncate64_wrapper:
- orr x1, x2, x3, lsl #32
+ regs_to_64 x1, x2, x3
b sys_ftruncate
ENDPROC(compat_sys_ftruncate64_wrapper)
compat_sys_readahead_wrapper:
- orr x1, x2, x3, lsl #32
+ regs_to_64 x1, x2, x3
mov w2, w4
b sys_readahead
ENDPROC(compat_sys_readahead_wrapper)
compat_sys_fadvise64_64_wrapper:
mov w6, w1
- orr x1, x2, x3, lsl #32
- orr x2, x4, x5, lsl #32
+ regs_to_64 x1, x2, x3
+ regs_to_64 x2, x4, x5
mov w3, w6
b sys_fadvise64_64
ENDPROC(compat_sys_fadvise64_64_wrapper)
compat_sys_sync_file_range2_wrapper:
- orr x2, x2, x3, lsl #32
- orr x3, x4, x5, lsl #32
+ regs_to_64 x2, x2, x3
+ regs_to_64 x3, x4, x5
b sys_sync_file_range2
ENDPROC(compat_sys_sync_file_range2_wrapper)
compat_sys_fallocate_wrapper:
- orr x2, x2, x3, lsl #32
- orr x3, x4, x5, lsl #32
+ regs_to_64 x2, x2, x3
+ regs_to_64 x3, x4, x5
b sys_fallocate
ENDPROC(compat_sys_fallocate_wrapper)
--
1.7.9.5
next prev parent reply other threads:[~2013-10-11 13:52 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-11 13:52 [PATCH 00/14] AArch64 BE Support Matthew Leach
2013-10-11 13:52 ` [PATCH 01/14] Docs: arm64: booting: clarify boot requirements Matthew Leach
2013-10-11 13:52 ` [PATCH 02/14] arm64: big-endian: add big-endian support to top-level arch Makefile Matthew Leach
2013-10-11 13:52 ` [PATCH 03/14] arm64: big-endian: fix byteorder include Matthew Leach
2013-10-11 13:52 ` [PATCH 04/14] arm64: ELF: add support for big-endian executables Matthew Leach
2013-10-11 13:52 ` [PATCH 05/14] arm64: setup: report ELF_PLATFORM as the machine for utsname Matthew Leach
2013-10-11 13:52 ` [PATCH 06/14] arm64: compat: add support for big-endian (BE8) AArch32 binaries Matthew Leach
2013-10-11 14:36 ` Mark Rutland
2013-10-11 13:52 ` Matthew Leach [this message]
2013-10-11 13:52 ` [PATCH 08/14] arm64: big-endian: don't treat code as data when copying sigret code Matthew Leach
2013-10-11 13:52 ` [PATCH 09/14] arm64: asm: add CPU_LE & CPU_BE assembler helpers Matthew Leach
2013-10-11 13:52 ` [PATCH 10/14] arm64: head: create a new function for setting the boot_cpu_mode flag Matthew Leach
2013-10-11 13:52 ` [PATCH 11/14] arm64: big-endian: set correct endianess on kernel entry Matthew Leach
2013-10-15 18:46 ` Christopher Covington
2013-10-24 15:46 ` Catalin Marinas
2013-10-11 13:52 ` [PATCH 12/14] arm64: big-endian: write CPU holding pen address as LE Matthew Leach
2013-10-11 13:52 ` [PATCH 13/14] arm64: kconfig: allow CPU_BIG_ENDIAN to be selected Matthew Leach
2013-10-11 13:52 ` [PATCH 14/14] net: smc91x: dont't use SMC_outw for fixing up halfword-aligned data Matthew Leach
2013-10-11 20:41 ` Nicolas Pitre
2013-10-11 21:56 ` David Miller
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=1381499540-28794-8-git-send-email-matthew.leach@arm.com \
--to=matthew.leach@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).