diff options
author | Will Deacon <will.deacon@arm.com> | 2013-10-11 09:52:12 -0400 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2013-10-25 10:59:35 -0400 |
commit | a795a38eb91cf72c4a05e72a9c84e317ee179a48 (patch) | |
tree | a4755e42d95378d52035c7184cc8ba0c57a106e8 | |
parent | 94ed1f2cb5d46533f10262b1b760db7dbec9cf10 (diff) |
arm64: compat: add support for big-endian (BE8) AArch32 binaries
This patch adds support for BE8 AArch32 tasks to the compat layer.
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r-- | arch/arm64/include/asm/compat.h | 14 | ||||
-rw-r--r-- | arch/arm64/include/asm/elf.h | 5 | ||||
-rw-r--r-- | arch/arm64/include/asm/processor.h | 5 | ||||
-rw-r--r-- | arch/arm64/include/asm/ptrace.h | 1 |
4 files changed, 25 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h index 899af807ef0f..fda2704b3f9f 100644 --- a/arch/arm64/include/asm/compat.h +++ b/arch/arm64/include/asm/compat.h | |||
@@ -26,7 +26,11 @@ | |||
26 | #include <linux/ptrace.h> | 26 | #include <linux/ptrace.h> |
27 | 27 | ||
28 | #define COMPAT_USER_HZ 100 | 28 | #define COMPAT_USER_HZ 100 |
29 | #ifdef __AARCH64EB__ | ||
30 | #define COMPAT_UTS_MACHINE "armv8b\0\0" | ||
31 | #else | ||
29 | #define COMPAT_UTS_MACHINE "armv8l\0\0" | 32 | #define COMPAT_UTS_MACHINE "armv8l\0\0" |
33 | #endif | ||
30 | 34 | ||
31 | typedef u32 compat_size_t; | 35 | typedef u32 compat_size_t; |
32 | typedef s32 compat_ssize_t; | 36 | typedef s32 compat_ssize_t; |
@@ -73,13 +77,23 @@ struct compat_timeval { | |||
73 | }; | 77 | }; |
74 | 78 | ||
75 | struct compat_stat { | 79 | struct compat_stat { |
80 | #ifdef __AARCH64EB__ | ||
81 | short st_dev; | ||
82 | short __pad1; | ||
83 | #else | ||
76 | compat_dev_t st_dev; | 84 | compat_dev_t st_dev; |
85 | #endif | ||
77 | compat_ino_t st_ino; | 86 | compat_ino_t st_ino; |
78 | compat_mode_t st_mode; | 87 | compat_mode_t st_mode; |
79 | compat_ushort_t st_nlink; | 88 | compat_ushort_t st_nlink; |
80 | __compat_uid16_t st_uid; | 89 | __compat_uid16_t st_uid; |
81 | __compat_gid16_t st_gid; | 90 | __compat_gid16_t st_gid; |
91 | #ifdef __AARCH64EB__ | ||
92 | short st_rdev; | ||
93 | short __pad2; | ||
94 | #else | ||
82 | compat_dev_t st_rdev; | 95 | compat_dev_t st_rdev; |
96 | #endif | ||
83 | compat_off_t st_size; | 97 | compat_off_t st_size; |
84 | compat_off_t st_blksize; | 98 | compat_off_t st_blksize; |
85 | compat_off_t st_blocks; | 99 | compat_off_t st_blocks; |
diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index a3e4a5564ea3..01d3aab64b79 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h | |||
@@ -162,7 +162,12 @@ extern unsigned long arch_randomize_brk(struct mm_struct *mm); | |||
162 | #define arch_randomize_brk arch_randomize_brk | 162 | #define arch_randomize_brk arch_randomize_brk |
163 | 163 | ||
164 | #ifdef CONFIG_COMPAT | 164 | #ifdef CONFIG_COMPAT |
165 | |||
166 | #ifdef __AARCH64EB__ | ||
167 | #define COMPAT_ELF_PLATFORM ("v8b") | ||
168 | #else | ||
165 | #define COMPAT_ELF_PLATFORM ("v8l") | 169 | #define COMPAT_ELF_PLATFORM ("v8l") |
170 | #endif | ||
166 | 171 | ||
167 | #define COMPAT_ELF_ET_DYN_BASE (randomize_et_dyn(2 * TASK_SIZE_32 / 3)) | 172 | #define COMPAT_ELF_ET_DYN_BASE (randomize_et_dyn(2 * TASK_SIZE_32 / 3)) |
168 | 173 | ||
diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index ab239b2c456f..45b20cd6cbca 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h | |||
@@ -107,6 +107,11 @@ static inline void compat_start_thread(struct pt_regs *regs, unsigned long pc, | |||
107 | regs->pstate = COMPAT_PSR_MODE_USR; | 107 | regs->pstate = COMPAT_PSR_MODE_USR; |
108 | if (pc & 1) | 108 | if (pc & 1) |
109 | regs->pstate |= COMPAT_PSR_T_BIT; | 109 | regs->pstate |= COMPAT_PSR_T_BIT; |
110 | |||
111 | #ifdef __AARCH64EB__ | ||
112 | regs->pstate |= COMPAT_PSR_E_BIT; | ||
113 | #endif | ||
114 | |||
110 | regs->compat_sp = sp; | 115 | regs->compat_sp = sp; |
111 | } | 116 | } |
112 | #endif | 117 | #endif |
diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h index 0dacbbf9458b..0e7fa4963735 100644 --- a/arch/arm64/include/asm/ptrace.h +++ b/arch/arm64/include/asm/ptrace.h | |||
@@ -42,6 +42,7 @@ | |||
42 | #define COMPAT_PSR_MODE_UND 0x0000001b | 42 | #define COMPAT_PSR_MODE_UND 0x0000001b |
43 | #define COMPAT_PSR_MODE_SYS 0x0000001f | 43 | #define COMPAT_PSR_MODE_SYS 0x0000001f |
44 | #define COMPAT_PSR_T_BIT 0x00000020 | 44 | #define COMPAT_PSR_T_BIT 0x00000020 |
45 | #define COMPAT_PSR_E_BIT 0x00000200 | ||
45 | #define COMPAT_PSR_F_BIT 0x00000040 | 46 | #define COMPAT_PSR_F_BIT 0x00000040 |
46 | #define COMPAT_PSR_I_BIT 0x00000080 | 47 | #define COMPAT_PSR_I_BIT 0x00000080 |
47 | #define COMPAT_PSR_A_BIT 0x00000100 | 48 | #define COMPAT_PSR_A_BIT 0x00000100 |