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>
This commit is contained in:
		
					parent
					
						
							
								c79bf928d9
							
						
					
				
			
			
				commit
				
					
						9a2b51b6ca
					
				
			
		
					 2 changed files with 7 additions and 4 deletions
				
			
		| 
						 | 
					@ -24,6 +24,8 @@
 | 
				
			||||||
#include <asm/domain.h>
 | 
					#include <asm/domain.h>
 | 
				
			||||||
#include <asm/opcodes-virt.h>
 | 
					#include <asm/opcodes-virt.h>
 | 
				
			||||||
#include <asm/asm-offsets.h>
 | 
					#include <asm/asm-offsets.h>
 | 
				
			||||||
 | 
					#include <asm/page.h>
 | 
				
			||||||
 | 
					#include <asm/thread_info.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define IOMEM(x)	(x)
 | 
					#define IOMEM(x)	(x)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -179,10 +181,10 @@
 | 
				
			||||||
 * Get current thread_info.
 | 
					 * Get current thread_info.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
	.macro	get_thread_info, rd
 | 
						.macro	get_thread_info, rd
 | 
				
			||||||
 ARM(	mov	\rd, sp, lsr #13	)
 | 
					 ARM(	mov	\rd, sp, lsr #THREAD_SIZE_ORDER + PAGE_SHIFT	)
 | 
				
			||||||
 THUMB(	mov	\rd, sp			)
 | 
					 THUMB(	mov	\rd, sp			)
 | 
				
			||||||
 THUMB(	lsr	\rd, \rd, #13		)
 | 
					 THUMB(	lsr	\rd, \rd, #THREAD_SIZE_ORDER + PAGE_SHIFT	)
 | 
				
			||||||
	mov	\rd, \rd, lsl #13
 | 
						mov	\rd, \rd, lsl #THREAD_SIZE_ORDER + PAGE_SHIFT
 | 
				
			||||||
	.endm
 | 
						.endm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,9 +14,10 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <linux/compiler.h>
 | 
					#include <linux/compiler.h>
 | 
				
			||||||
#include <asm/fpstate.h>
 | 
					#include <asm/fpstate.h>
 | 
				
			||||||
 | 
					#include <asm/page.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define THREAD_SIZE_ORDER	1
 | 
					#define THREAD_SIZE_ORDER	1
 | 
				
			||||||
#define THREAD_SIZE		8192
 | 
					#define THREAD_SIZE		(PAGE_SIZE << THREAD_SIZE_ORDER)
 | 
				
			||||||
#define THREAD_START_SP		(THREAD_SIZE - 8)
 | 
					#define THREAD_START_SP		(THREAD_SIZE - 8)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef __ASSEMBLY__
 | 
					#ifndef __ASSEMBLY__
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue