aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Ryabinin <a.ryabinin@samsung.com>2014-06-18 11:12:40 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-07-01 10:05:47 -0400
commit9a2b51b6ca93fc42e5676aa444c956f7506185db (patch)
tree0014878f0c4844f467e25de7b45cbed1a73889a7
parentc79bf928d99a3b8cf1e8df75726f78e197b17eb6 (diff)
ARM: 8078/1: get rid of hardcoded assumptions about kernel stack size
Changing kernel stack size on arm is not as simple as it should be: 1) THREAD_SIZE macro doesn't respect PAGE_SIZE and THREAD_SIZE_ORDER 2) stack size is hardcoded in get_thread_info macro This patch fixes it by calculating THREAD_SIZE and thread_info address taking into account PAGE_SIZE and THREAD_SIZE_ORDER. Now changing stack size becomes simply changing THREAD_SIZE_ORDER. Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com> Acked-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/include/asm/assembler.h8
-rw-r--r--arch/arm/include/asm/thread_info.h3
2 files changed, 7 insertions, 4 deletions
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index 57f0584e8d97..906703a5b564 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -24,6 +24,8 @@
24#include <asm/domain.h> 24#include <asm/domain.h>
25#include <asm/opcodes-virt.h> 25#include <asm/opcodes-virt.h>
26#include <asm/asm-offsets.h> 26#include <asm/asm-offsets.h>
27#include <asm/page.h>
28#include <asm/thread_info.h>
27 29
28#define IOMEM(x) (x) 30#define IOMEM(x) (x)
29 31
@@ -179,10 +181,10 @@
179 * Get current thread_info. 181 * Get current thread_info.
180 */ 182 */
181 .macro get_thread_info, rd 183 .macro get_thread_info, rd
182 ARM( mov \rd, sp, lsr #13 ) 184 ARM( mov \rd, sp, lsr #THREAD_SIZE_ORDER + PAGE_SHIFT )
183 THUMB( mov \rd, sp ) 185 THUMB( mov \rd, sp )
184 THUMB( lsr \rd, \rd, #13 ) 186 THUMB( lsr \rd, \rd, #THREAD_SIZE_ORDER + PAGE_SHIFT )
185 mov \rd, \rd, lsl #13 187 mov \rd, \rd, lsl #THREAD_SIZE_ORDER + PAGE_SHIFT
186 .endm 188 .endm
187 189
188/* 190/*
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
index e4e4208a9130..fc44d3761f9e 100644
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -14,9 +14,10 @@
14 14
15#include <linux/compiler.h> 15#include <linux/compiler.h>
16#include <asm/fpstate.h> 16#include <asm/fpstate.h>
17#include <asm/page.h>
17 18
18#define THREAD_SIZE_ORDER 1 19#define THREAD_SIZE_ORDER 1
19#define THREAD_SIZE 8192 20#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
20#define THREAD_START_SP (THREAD_SIZE - 8) 21#define THREAD_START_SP (THREAD_SIZE - 8)
21 22
22#ifndef __ASSEMBLY__ 23#ifndef __ASSEMBLY__