aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2018-01-02 10:12:01 -0500
committerDavid Howells <dhowells@redhat.com>2018-01-09 18:21:02 -0500
commit0500871f21b237b2bea2d9db405eadf78e5aab05 (patch)
tree6004424368ea44f74d9d9d66fb565a59d3dba970 /arch/um
parent138101932054268a235c6ac7cf474f6a88fcd885 (diff)
Construct init thread stack in the linker script rather than by union
Construct the init thread stack in the linker script rather than doing it by means of a union so that ia64's init_task.c can be got rid of. The following symbols are then made available from INIT_TASK_DATA() linker script macro: init_thread_union init_stack INIT_TASK_DATA() also expands the region to THREAD_SIZE to accommodate the size of the init stack. init_thread_union is given its own section so that it can be placed into the stack space in the right order. I'm assuming that the ia64 ordering is correct and that the task_struct is first and the thread_info second. Signed-off-by: David Howells <dhowells@redhat.com> Tested-by: Tony Luck <tony.luck@intel.com> Tested-by: Will Deacon <will.deacon@arm.com> (arm64) Tested-by: Palmer Dabbelt <palmer@sifive.com> Acked-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/include/asm/processor-generic.h5
-rw-r--r--arch/um/include/asm/thread_info.h9
-rw-r--r--arch/um/include/asm/vmlinux.lds.h2
-rw-r--r--arch/um/kernel/dyn.lds.S3
-rw-r--r--arch/um/kernel/um_arch.c2
-rw-r--r--arch/um/kernel/uml.lds.S2
6 files changed, 12 insertions, 11 deletions
diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h
index 86942a492454..b58b746d3f2c 100644
--- a/arch/um/include/asm/processor-generic.h
+++ b/arch/um/include/asm/processor-generic.h
@@ -58,7 +58,10 @@ static inline void release_thread(struct task_struct *task)
58{ 58{
59} 59}
60 60
61#define init_stack (init_thread_union.stack) 61static inline void mm_copy_segments(struct mm_struct *from_mm,
62 struct mm_struct *new_mm)
63{
64}
62 65
63/* 66/*
64 * User space process size: 3GB (default). 67 * User space process size: 3GB (default).
diff --git a/arch/um/include/asm/thread_info.h b/arch/um/include/asm/thread_info.h
index 9300f7630d2a..4eecd960ee8c 100644
--- a/arch/um/include/asm/thread_info.h
+++ b/arch/um/include/asm/thread_info.h
@@ -6,6 +6,9 @@
6#ifndef __UM_THREAD_INFO_H 6#ifndef __UM_THREAD_INFO_H
7#define __UM_THREAD_INFO_H 7#define __UM_THREAD_INFO_H
8 8
9#define THREAD_SIZE_ORDER CONFIG_KERNEL_STACK_ORDER
10#define THREAD_SIZE ((1 << CONFIG_KERNEL_STACK_ORDER) * PAGE_SIZE)
11
9#ifndef __ASSEMBLY__ 12#ifndef __ASSEMBLY__
10 13
11#include <asm/types.h> 14#include <asm/types.h>
@@ -37,10 +40,6 @@ struct thread_info {
37 .real_thread = NULL, \ 40 .real_thread = NULL, \
38} 41}
39 42
40#define init_thread_info (init_thread_union.thread_info)
41#define init_stack (init_thread_union.stack)
42
43#define THREAD_SIZE ((1 << CONFIG_KERNEL_STACK_ORDER) * PAGE_SIZE)
44/* how to get the thread information struct from C */ 43/* how to get the thread information struct from C */
45static inline struct thread_info *current_thread_info(void) 44static inline struct thread_info *current_thread_info(void)
46{ 45{
@@ -53,8 +52,6 @@ static inline struct thread_info *current_thread_info(void)
53 return ti; 52 return ti;
54} 53}
55 54
56#define THREAD_SIZE_ORDER CONFIG_KERNEL_STACK_ORDER
57
58#endif 55#endif
59 56
60#define TIF_SYSCALL_TRACE 0 /* syscall trace active */ 57#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
diff --git a/arch/um/include/asm/vmlinux.lds.h b/arch/um/include/asm/vmlinux.lds.h
new file mode 100644
index 000000000000..149494ae78ea
--- /dev/null
+++ b/arch/um/include/asm/vmlinux.lds.h
@@ -0,0 +1,2 @@
1#include <asm/thread_info.h>
2#include <asm-generic/vmlinux.lds.h>
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
index d417e3899700..5568cf882371 100644
--- a/arch/um/kernel/dyn.lds.S
+++ b/arch/um/kernel/dyn.lds.S
@@ -1,5 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1#include <asm/vmlinux.lds.h>
2#include <asm-generic/vmlinux.lds.h>
3#include <asm/page.h> 2#include <asm/page.h>
4 3
5OUTPUT_FORMAT(ELF_FORMAT) 4OUTPUT_FORMAT(ELF_FORMAT)
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index f433690b9b37..a818ccef30ca 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -54,7 +54,7 @@ struct cpuinfo_um boot_cpu_data = {
54 54
55union thread_union cpu0_irqstack 55union thread_union cpu0_irqstack
56 __attribute__((__section__(".data..init_irqstack"))) = 56 __attribute__((__section__(".data..init_irqstack"))) =
57 { INIT_THREAD_INFO(init_task) }; 57 { .thread_info = INIT_THREAD_INFO(init_task) };
58 58
59/* Changed in setup_arch, which is called in early boot */ 59/* Changed in setup_arch, which is called in early boot */
60static char host_info[(__NEW_UTS_LEN + 1) * 5]; 60static char host_info[(__NEW_UTS_LEN + 1) * 5];
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S
index 3d6ed6ba5b78..36b07ec09742 100644
--- a/arch/um/kernel/uml.lds.S
+++ b/arch/um/kernel/uml.lds.S
@@ -1,5 +1,5 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 */
2#include <asm-generic/vmlinux.lds.h> 2#include <asm/vmlinux.lds.h>
3#include <asm/page.h> 3#include <asm/page.h>
4 4
5OUTPUT_FORMAT(ELF_FORMAT) 5OUTPUT_FORMAT(ELF_FORMAT)