diff options
author | Vineet Gupta <vgupta@synopsys.com> | 2014-04-18 02:49:59 -0400 |
---|---|---|
committer | Vineet Gupta <vgupta@synopsys.com> | 2014-05-05 04:52:12 -0400 |
commit | 2ab402dfd65d15a4b25a8756272ababe3ef76884 (patch) | |
tree | 7b8535d6b2998744c5a4136c29e3c73048d3f2e0 /arch/arc | |
parent | d75386363ee60eb51c933c7b5e536f3a502ad7d7 (diff) |
ARC: make start_thread() out-of-line
Helps move out ISA specific bits from a arch exported header
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch/arc')
-rw-r--r-- | arch/arc/include/asm/processor.h | 29 | ||||
-rw-r--r-- | arch/arc/kernel/process.c | 23 |
2 files changed, 27 insertions, 25 deletions
diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h index 15334ab66b56..d99f9b37cd15 100644 --- a/arch/arc/include/asm/processor.h +++ b/arch/arc/include/asm/processor.h | |||
@@ -18,7 +18,6 @@ | |||
18 | 18 | ||
19 | #ifndef __ASSEMBLY__ | 19 | #ifndef __ASSEMBLY__ |
20 | 20 | ||
21 | #include <asm/arcregs.h> /* for STATUS_E1_MASK et all */ | ||
22 | #include <asm/ptrace.h> | 21 | #include <asm/ptrace.h> |
23 | 22 | ||
24 | /* Arch specific stuff which needs to be saved per task. | 23 | /* Arch specific stuff which needs to be saved per task. |
@@ -41,15 +40,13 @@ struct thread_struct { | |||
41 | /* Forward declaration, a strange C thing */ | 40 | /* Forward declaration, a strange C thing */ |
42 | struct task_struct; | 41 | struct task_struct; |
43 | 42 | ||
44 | /* | 43 | /* Return saved PC of a blocked thread */ |
45 | * Return saved PC of a blocked thread. | ||
46 | */ | ||
47 | unsigned long thread_saved_pc(struct task_struct *t); | 44 | unsigned long thread_saved_pc(struct task_struct *t); |
48 | 45 | ||
49 | #define task_pt_regs(p) \ | 46 | #define task_pt_regs(p) \ |
50 | ((struct pt_regs *)(THREAD_SIZE + (void *)task_stack_page(p)) - 1) | 47 | ((struct pt_regs *)(THREAD_SIZE + (void *)task_stack_page(p)) - 1) |
51 | 48 | ||
52 | /* Free all resources held by a thread. */ | 49 | /* Free all resources held by a thread */ |
53 | #define release_thread(thread) do { } while (0) | 50 | #define release_thread(thread) do { } while (0) |
54 | 51 | ||
55 | /* Prepare to copy thread state - unlazy all lazy status */ | 52 | /* Prepare to copy thread state - unlazy all lazy status */ |
@@ -82,26 +79,8 @@ unsigned long thread_saved_pc(struct task_struct *t); | |||
82 | #define KSTK_BLINK(tsk) KSTK_REG(tsk, 4) | 79 | #define KSTK_BLINK(tsk) KSTK_REG(tsk, 4) |
83 | #define KSTK_FP(tsk) KSTK_REG(tsk, 0) | 80 | #define KSTK_FP(tsk) KSTK_REG(tsk, 0) |
84 | 81 | ||
85 | /* | 82 | extern void start_thread(struct pt_regs * regs, unsigned long pc, |
86 | * Do necessary setup to start up a newly executed thread. | 83 | unsigned long usp); |
87 | * | ||
88 | * E1,E2 so that Interrupts are enabled in user mode | ||
89 | * L set, so Loop inhibited to begin with | ||
90 | * lp_start and lp_end seeded with bogus non-zero values so to easily catch | ||
91 | * the ARC700 sr to lp_start hardware bug | ||
92 | */ | ||
93 | #define start_thread(_regs, _pc, _usp) \ | ||
94 | do { \ | ||
95 | set_fs(USER_DS); /* reads from user space */ \ | ||
96 | (_regs)->ret = (_pc); \ | ||
97 | /* Interrupts enabled in User Mode */ \ | ||
98 | (_regs)->status32 = STATUS_U_MASK | STATUS_L_MASK \ | ||
99 | | STATUS_E1_MASK | STATUS_E2_MASK; \ | ||
100 | (_regs)->sp = (_usp); \ | ||
101 | /* bogus seed values for debugging */ \ | ||
102 | (_regs)->lp_start = 0x10; \ | ||
103 | (_regs)->lp_end = 0x80; \ | ||
104 | } while (0) | ||
105 | 84 | ||
106 | extern unsigned int get_wchan(struct task_struct *p); | 85 | extern unsigned int get_wchan(struct task_struct *p); |
107 | 86 | ||
diff --git a/arch/arc/kernel/process.c b/arch/arc/kernel/process.c index 07a3a968fe49..fdd89715d2d3 100644 --- a/arch/arc/kernel/process.c +++ b/arch/arc/kernel/process.c | |||
@@ -151,6 +151,29 @@ int copy_thread(unsigned long clone_flags, | |||
151 | } | 151 | } |
152 | 152 | ||
153 | /* | 153 | /* |
154 | * Do necessary setup to start up a new user task | ||
155 | */ | ||
156 | void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long usp) | ||
157 | { | ||
158 | set_fs(USER_DS); /* user space */ | ||
159 | |||
160 | regs->sp = usp; | ||
161 | regs->ret = pc; | ||
162 | |||
163 | /* | ||
164 | * [U]ser Mode bit set | ||
165 | * [L] ZOL loop inhibited to begin with - cleared by a LP insn | ||
166 | * Interrupts enabled | ||
167 | */ | ||
168 | regs->status32 = STATUS_U_MASK | STATUS_L_MASK | | ||
169 | STATUS_E1_MASK | STATUS_E2_MASK; | ||
170 | |||
171 | /* bogus seed values for debugging */ | ||
172 | regs->lp_start = 0x10; | ||
173 | regs->lp_end = 0x80; | ||
174 | } | ||
175 | |||
176 | /* | ||
154 | * Some archs flush debug and FPU info here | 177 | * Some archs flush debug and FPU info here |
155 | */ | 178 | */ |
156 | void flush_thread(void) | 179 | void flush_thread(void) |