From f299fff26684125956d1dfc5a198677758e1f64f Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Wed, 30 Jan 2019 13:37:03 +0900 Subject: [PATCH] stack: add hwcap auxval Fix the AUXV_LEN to account for hwcap and remove the ifdefs Change-Id: I303fc2c5fa4c8cea7ec9823f8580b8a66de2f58f Fujitsu: POSTK_DEBUG_ARCH_DEP_65 --- arch/arm64/kernel/cpu.c | 2 -- arch/arm64/kernel/cpufeature.c | 4 ---- arch/arm64/kernel/include/hwcap.h | 2 -- arch/x86_64/kernel/include/hwcap.h | 2 -- kernel/include/process.h | 2 +- kernel/process.c | 10 ++++------ 6 files changed, 5 insertions(+), 17 deletions(-) diff --git a/arch/arm64/kernel/cpu.c b/arch/arm64/kernel/cpu.c index 55b2ca96..47984099 100644 --- a/arch/arm64/kernel/cpu.c +++ b/arch/arm64/kernel/cpu.c @@ -31,9 +31,7 @@ #include #include #include -#ifdef POSTK_DEBUG_ARCH_DEP_65 #include -#endif /* POSTK_DEBUG_ARCH_DEP_65 */ //#define DEBUG_PRINT_CPU diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index af25ad76..3c32d7e9 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -10,9 +10,7 @@ #include #include -#ifdef POSTK_DEBUG_ARCH_DEP_65 unsigned long elf_hwcap; -#endif /* POSTK_DEBUG_ARCH_DEP_65 */ /* @ref.impl arch/arm64/kernel/cpufeature.c */ #define __ARM64_FTR_BITS(SIGNED, VISIBLE, STRICT, TYPE, SHIFT, WIDTH, SAFE_VAL) \ @@ -997,9 +995,7 @@ void setup_cpu_features(void) setup_elf_hwcaps(arm64_elf_hwcaps); } -#ifdef POSTK_DEBUG_ARCH_DEP_65 unsigned long arch_get_hwcap(void) { return elf_hwcap; } -#endif /* POSTK_DEBUG_ARCH_DEP_65 */ diff --git a/arch/arm64/kernel/include/hwcap.h b/arch/arm64/kernel/include/hwcap.h index a8562a0f..848a2937 100644 --- a/arch/arm64/kernel/include/hwcap.h +++ b/arch/arm64/kernel/include/hwcap.h @@ -1,5 +1,4 @@ /* hwcap.h COPYRIGHT FUJITSU LIMITED 2017 */ -#ifdef POSTK_DEBUG_ARCH_DEP_65 #ifndef _UAPI__ASM_HWCAP_H #define _UAPI__ASM_HWCAP_H @@ -25,4 +24,3 @@ unsigned long arch_get_hwcap(void); extern unsigned long elf_hwcap; #endif /* _UAPI__ASM_HWCAP_H */ -#endif /* POSTK_DEBUG_ARCH_DEP_65 */ diff --git a/arch/x86_64/kernel/include/hwcap.h b/arch/x86_64/kernel/include/hwcap.h index fc2b38f7..30a0d4f7 100644 --- a/arch/x86_64/kernel/include/hwcap.h +++ b/arch/x86_64/kernel/include/hwcap.h @@ -1,5 +1,4 @@ /* hwcap.h COPYRIGHT FUJITSU LIMITED 2017 */ -#ifdef POSTK_DEBUG_ARCH_DEP_65 #ifndef _UAPI__ASM_HWCAP_H #define _UAPI__ASM_HWCAP_H @@ -9,4 +8,3 @@ static unsigned long arch_get_hwcap(void) } #endif /* _UAPI__ASM_HWCAP_H */ -#endif /* POSTK_DEBUG_ARCH_DEP_65 */ diff --git a/kernel/include/process.h b/kernel/include/process.h index bece5737..a0d2178a 100644 --- a/kernel/include/process.h +++ b/kernel/include/process.h @@ -381,7 +381,7 @@ struct user unsigned long int u_debugreg [8]; }; -#define AUXV_LEN 18 +#define AUXV_LEN 20 struct vm_range { struct rb_node vm_rb_node; diff --git a/kernel/process.c b/kernel/process.c index bb2392e7..77d519a5 100644 --- a/kernel/process.c +++ b/kernel/process.c @@ -30,9 +30,7 @@ #include #include #include -#ifdef POSTK_DEBUG_ARCH_DEP_65 #include -#endif /* POSTK_DEBUG_ARCH_DEP_65 */ #include #include #include @@ -2231,6 +2229,7 @@ int init_process_stack(struct thread *thread, struct program_load_desc *pn, unsigned long at_rand; struct process *proc = thread->proc; unsigned long ap_flag; + unsigned long ap_hwcap; struct vm_range *range; int stack_populated_size = 0; int stack_align_padding = 0; @@ -2332,10 +2331,9 @@ int init_process_stack(struct thread *thread, struct program_load_desc *pn, AUXV_LEN in include/process.h. */ p[s_ind--] = 0; /* AT_NULL */ p[s_ind--] = 0; -#ifdef POSTK_DEBUG_ARCH_DEP_65 - p[s_ind--] = arch_get_hwcap(); /* AT_HWCAP */ - p[s_ind--] = AT_HWCAP; -#endif /* POSTK_DEBUG_ARCH_DEP_65 */ + ap_hwcap = arch_get_hwcap(); + p[s_ind--] = ap_hwcap; /* AT_HWCAP */ + p[s_ind--] = ap_hwcap ? AT_HWCAP : AT_IGNORE; p[s_ind--] = pn->at_entry; /* AT_ENTRY */ p[s_ind--] = AT_ENTRY; p[s_ind--] = pn->at_phnum; /* AT_PHNUM */