aboutsummaryrefslogtreecommitdiff
path: root/meta-linaro-integration/recipes-overlayed/linux-libc-headers/linux-libc-headers/0016-ARM64-ILP32-Support-core-dump-for-ILP32.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-linaro-integration/recipes-overlayed/linux-libc-headers/linux-libc-headers/0016-ARM64-ILP32-Support-core-dump-for-ILP32.patch')
-rw-r--r--meta-linaro-integration/recipes-overlayed/linux-libc-headers/linux-libc-headers/0016-ARM64-ILP32-Support-core-dump-for-ILP32.patch110
1 files changed, 110 insertions, 0 deletions
diff --git a/meta-linaro-integration/recipes-overlayed/linux-libc-headers/linux-libc-headers/0016-ARM64-ILP32-Support-core-dump-for-ILP32.patch b/meta-linaro-integration/recipes-overlayed/linux-libc-headers/linux-libc-headers/0016-ARM64-ILP32-Support-core-dump-for-ILP32.patch
new file mode 100644
index 00000000..83b8129e
--- /dev/null
+++ b/meta-linaro-integration/recipes-overlayed/linux-libc-headers/linux-libc-headers/0016-ARM64-ILP32-Support-core-dump-for-ILP32.patch
@@ -0,0 +1,110 @@
+From 4aaf156c46c2a751aeeff02b2387a12cc5d34d97 Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Wed, 3 Sep 2014 14:19:10 -0700
+Subject: [PATCH 16/25] ARM64:ILP32: Support core dump for ILP32
+
+This patch supports core dumping on ILP32.
+We need a few extra macros (COMPAT_PR_REG_SIZE and COMPAT_PRSTATUS_SIZE) due
+to size differences of the register sets.
+
+Signed-off-by: Andrew Pinski <apinski@cavium.com>
+---
+ arch/arm64/include/asm/elf.h | 23 +++++++++++++++++++++--
+ arch/arm64/kernel/ptrace.c | 12 ++++++------
+ 2 files changed, 27 insertions(+), 8 deletions(-)
+
+diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h
+index 69291a0..fdd3fdb 100644
+--- a/arch/arm64/include/asm/elf.h
++++ b/arch/arm64/include/asm/elf.h
+@@ -179,8 +179,8 @@ extern unsigned long arch_randomize_brk(struct mm_struct *mm);
+
+ /* AArch32 registers. */
+ #define COMPAT_A32_ELF_NGREG 18
+-typedef unsigned int compat_elf_greg_t;
+-typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_A32_ELF_NGREG];
++typedef unsigned int compat_a32_elf_greg_t;
++typedef compat_a32_elf_greg_t compat_a32_elf_gregset_t[COMPAT_A32_ELF_NGREG];
+
+ /* AArch32 EABI. */
+ #define EF_ARM_EABI_MASK 0xff000000
+@@ -209,6 +209,25 @@ typedef elf_gregset_t compat_elf_gregset_t;
+
+ #endif
+
++/*
++ * If ILP32 is turned on, we want to define the compat_elf_greg_t to the non compat
++ * one and define PR_REG_SIZE/PRSTATUS_SIZE/SET_PR_FPVALID so we pick up the correct
++ * ones for AARCH32.
++ */
++#ifdef CONFIG_ARM64_ILP32
++typedef elf_greg_t compat_elf_greg_t;
++typedef elf_gregset_t compat_elf_gregset_t;
++#define COMPAT_PR_REG_SIZE(S) (is_a32_compat_task() ? 72 : 272)
++#define COMPAT_PRSTATUS_SIZE(S) (is_a32_compat_task() ? 124 : 352)
++#define COMPAT_SET_PR_FPVALID(S, V) \
++do { \
++ *(int *) (((void *) &((S)->pr_reg)) + PR_REG_SIZE((S)->pr_reg)) = (V); \
++} while (0)
++#else
++typedef compat_a32_elf_greg_t compat_elf_greg_t;
++typedef compat_a32_elf_gregset_t compat_elf_gregset_t;
++#endif
++
+ #define compat_elf_check_arch(x) compat_a32_elf_check_arch(x)
+
+ #endif /* CONFIG_COMPAT */
+diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
+index 6d6f62d..6a9d395 100644
+--- a/arch/arm64/kernel/ptrace.c
++++ b/arch/arm64/kernel/ptrace.c
+@@ -796,8 +796,8 @@ static const struct user_regset aarch32_regsets[] = {
+ [REGSET_COMPAT_GPR] = {
+ .core_note_type = NT_PRSTATUS,
+ .n = COMPAT_A32_ELF_NGREG,
+- .size = sizeof(compat_elf_greg_t),
+- .align = sizeof(compat_elf_greg_t),
++ .size = sizeof(compat_a32_elf_greg_t),
++ .align = sizeof(compat_a32_elf_greg_t),
+ .get = compat_gpr_get,
+ .set = compat_gpr_set
+ },
+@@ -830,7 +830,7 @@ static int compat_ptrace_read_user(struct task_struct *tsk, compat_ulong_t off,
+ tmp = tsk->mm->start_data;
+ else if (off == COMPAT_PT_TEXT_END_ADDR)
+ tmp = tsk->mm->end_code;
+- else if (off < sizeof(compat_elf_gregset_t))
++ else if (off < sizeof(compat_a32_elf_gregset_t))
+ return copy_regset_to_user(tsk, &user_aarch32_view,
+ REGSET_COMPAT_GPR, off,
+ sizeof(compat_ulong_t), ret);
+@@ -851,7 +851,7 @@ static int compat_ptrace_write_user(struct task_struct *tsk, compat_ulong_t off,
+ if (off & 3 || off >= COMPAT_USER_SZ)
+ return -EIO;
+
+- if (off >= sizeof(compat_elf_gregset_t))
++ if (off >= sizeof(compat_a32_elf_gregset_t))
+ return 0;
+
+ set_fs(KERNEL_DS);
+@@ -1014,7 +1014,7 @@ long compat_a32_arch_ptrace(struct task_struct *child, compat_long_t request,
+ ret = copy_regset_to_user(child,
+ &user_aarch32_view,
+ REGSET_COMPAT_GPR,
+- 0, sizeof(compat_elf_gregset_t),
++ 0, sizeof(compat_a32_elf_gregset_t),
+ datap);
+ break;
+
+@@ -1022,7 +1022,7 @@ long compat_a32_arch_ptrace(struct task_struct *child, compat_long_t request,
+ ret = copy_regset_from_user(child,
+ &user_aarch32_view,
+ REGSET_COMPAT_GPR,
+- 0, sizeof(compat_elf_gregset_t),
++ 0, sizeof(compat_a32_elf_gregset_t),
+ datap);
+ break;
+
+--
+1.9.3
+