Commit f4431396 authored by Max Filippov's avatar Max Filippov

xtensa: consolidate kernel stack size related definitions

Define kernel stack size in kmem_layout and use it in
current_thread_info, GET_THREAD_INFO, THREAD_SIZE and THERAD_SIZE_ORDER
definitions.
Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
parent 5cf97ebd
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#ifndef _XTENSA_CURRENT_H #ifndef _XTENSA_CURRENT_H
#define _XTENSA_CURRENT_H #define _XTENSA_CURRENT_H
#include <asm/thread_info.h>
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <linux/thread_info.h> #include <linux/thread_info.h>
...@@ -26,8 +28,6 @@ static inline struct task_struct *get_current(void) ...@@ -26,8 +28,6 @@ static inline struct task_struct *get_current(void)
#else #else
#define CURRENT_SHIFT 13
#define GET_CURRENT(reg,sp) \ #define GET_CURRENT(reg,sp) \
GET_THREAD_INFO(reg,sp); \ GET_THREAD_INFO(reg,sp); \
l32i reg, reg, TI_TASK \ l32i reg, reg, TI_TASK \
......
...@@ -71,4 +71,7 @@ ...@@ -71,4 +71,7 @@
#endif #endif
#define KERNEL_STACK_SHIFT 13
#define KERNEL_STACK_SIZE (1 << KERNEL_STACK_SHIFT)
#endif #endif
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#ifndef _XTENSA_PTRACE_H #ifndef _XTENSA_PTRACE_H
#define _XTENSA_PTRACE_H #define _XTENSA_PTRACE_H
#include <asm/kmem_layout.h>
#include <uapi/asm/ptrace.h> #include <uapi/asm/ptrace.h>
/* /*
...@@ -38,8 +39,6 @@ ...@@ -38,8 +39,6 @@
* +-----------------------+ -------- * +-----------------------+ --------
*/ */
#define KERNEL_STACK_SIZE (2 * PAGE_SIZE)
/* Offsets for exception_handlers[] (3 x 64-entries x 4-byte tables). */ /* Offsets for exception_handlers[] (3 x 64-entries x 4-byte tables). */
#define EXC_TABLE_KSTK 0x004 /* Kernel Stack */ #define EXC_TABLE_KSTK 0x004 /* Kernel Stack */
......
...@@ -11,7 +11,9 @@ ...@@ -11,7 +11,9 @@
#ifndef _XTENSA_THREAD_INFO_H #ifndef _XTENSA_THREAD_INFO_H
#define _XTENSA_THREAD_INFO_H #define _XTENSA_THREAD_INFO_H
#ifdef __KERNEL__ #include <asm/kmem_layout.h>
#define CURRENT_SHIFT KERNEL_STACK_SHIFT
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
# include <asm/processor.h> # include <asm/processor.h>
...@@ -84,7 +86,7 @@ struct thread_info { ...@@ -84,7 +86,7 @@ struct thread_info {
static inline struct thread_info *current_thread_info(void) static inline struct thread_info *current_thread_info(void)
{ {
struct thread_info *ti; struct thread_info *ti;
__asm__("extui %0,a1,0,13\n\t" __asm__("extui %0, a1, 0, "__stringify(CURRENT_SHIFT)"\n\t"
"xor %0, a1, %0" : "=&r" (ti) : ); "xor %0, a1, %0" : "=&r" (ti) : );
return ti; return ti;
} }
...@@ -93,7 +95,7 @@ static inline struct thread_info *current_thread_info(void) ...@@ -93,7 +95,7 @@ static inline struct thread_info *current_thread_info(void)
/* how to get the thread information struct from ASM */ /* how to get the thread information struct from ASM */
#define GET_THREAD_INFO(reg,sp) \ #define GET_THREAD_INFO(reg,sp) \
extui reg, sp, 0, 13; \ extui reg, sp, 0, CURRENT_SHIFT; \
xor reg, sp, reg xor reg, sp, reg
#endif #endif
...@@ -130,8 +132,7 @@ static inline struct thread_info *current_thread_info(void) ...@@ -130,8 +132,7 @@ static inline struct thread_info *current_thread_info(void)
*/ */
#define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */ #define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */
#define THREAD_SIZE 8192 //(2*PAGE_SIZE) #define THREAD_SIZE KERNEL_STACK_SIZE
#define THREAD_SIZE_ORDER 1 #define THREAD_SIZE_ORDER (KERNEL_STACK_SHIFT - PAGE_SHIFT)
#endif /* __KERNEL__ */
#endif /* _XTENSA_THREAD_INFO */ #endif /* _XTENSA_THREAD_INFO */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment