Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Will Deacon and committed by
Catalin Marinas
a795a38e 94ed1f2c

+25
+14
arch/arm64/include/asm/compat.h
··· 26 26 #include <linux/ptrace.h> 27 27 28 28 #define COMPAT_USER_HZ 100 29 + #ifdef __AARCH64EB__ 30 + #define COMPAT_UTS_MACHINE "armv8b\0\0" 31 + #else 29 32 #define COMPAT_UTS_MACHINE "armv8l\0\0" 33 + #endif 30 34 31 35 typedef u32 compat_size_t; 32 36 typedef s32 compat_ssize_t; ··· 77 73 }; 78 74 79 75 struct compat_stat { 76 + #ifdef __AARCH64EB__ 77 + short st_dev; 78 + short __pad1; 79 + #else 80 80 compat_dev_t st_dev; 81 + #endif 81 82 compat_ino_t st_ino; 82 83 compat_mode_t st_mode; 83 84 compat_ushort_t st_nlink; 84 85 __compat_uid16_t st_uid; 85 86 __compat_gid16_t st_gid; 87 + #ifdef __AARCH64EB__ 88 + short st_rdev; 89 + short __pad2; 90 + #else 86 91 compat_dev_t st_rdev; 92 + #endif 87 93 compat_off_t st_size; 88 94 compat_off_t st_blksize; 89 95 compat_off_t st_blocks;
+5
arch/arm64/include/asm/elf.h
··· 162 162 #define arch_randomize_brk arch_randomize_brk 163 163 164 164 #ifdef CONFIG_COMPAT 165 + 166 + #ifdef __AARCH64EB__ 167 + #define COMPAT_ELF_PLATFORM ("v8b") 168 + #else 165 169 #define COMPAT_ELF_PLATFORM ("v8l") 170 + #endif 166 171 167 172 #define COMPAT_ELF_ET_DYN_BASE (randomize_et_dyn(2 * TASK_SIZE_32 / 3)) 168 173
+5
arch/arm64/include/asm/processor.h
··· 107 107 regs->pstate = COMPAT_PSR_MODE_USR; 108 108 if (pc & 1) 109 109 regs->pstate |= COMPAT_PSR_T_BIT; 110 + 111 + #ifdef __AARCH64EB__ 112 + regs->pstate |= COMPAT_PSR_E_BIT; 113 + #endif 114 + 110 115 regs->compat_sp = sp; 111 116 } 112 117 #endif
+1
arch/arm64/include/asm/ptrace.h
··· 42 42 #define COMPAT_PSR_MODE_UND 0x0000001b 43 43 #define COMPAT_PSR_MODE_SYS 0x0000001f 44 44 #define COMPAT_PSR_T_BIT 0x00000020 45 + #define COMPAT_PSR_E_BIT 0x00000200 45 46 #define COMPAT_PSR_F_BIT 0x00000040 46 47 #define COMPAT_PSR_I_BIT 0x00000080 47 48 #define COMPAT_PSR_A_BIT 0x00000100