Skip to content

Commit 2ab402d

Browse files
committed
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>
1 parent d753863 commit 2ab402d

2 files changed

Lines changed: 27 additions & 25 deletions

File tree

‎arch/arc/include/asm/processor.h‎

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
#ifndef __ASSEMBLY__
2020

21-
#include <asm/arcregs.h> /* for STATUS_E1_MASK et all */
2221
#include <asm/ptrace.h>
2322

2423
/* Arch specific stuff which needs to be saved per task.
@@ -41,15 +40,13 @@ struct thread_struct {
4140
/* Forward declaration, a strange C thing */
4241
struct task_struct;
4342

44-
/*
45-
* Return saved PC of a blocked thread.
46-
*/
43+
/* Return saved PC of a blocked thread */
4744
unsigned long thread_saved_pc(struct task_struct *t);
4845

4946
#define task_pt_regs(p) \
5047
((struct pt_regs *)(THREAD_SIZE + (void *)task_stack_page(p)) - 1)
5148

52-
/* Free all resources held by a thread. */
49+
/* Free all resources held by a thread */
5350
#define release_thread(thread) do { } while (0)
5451

5552
/* Prepare to copy thread state - unlazy all lazy status */
@@ -82,26 +79,8 @@ unsigned long thread_saved_pc(struct task_struct *t);
8279
#define KSTK_BLINK(tsk) KSTK_REG(tsk, 4)
8380
#define KSTK_FP(tsk) KSTK_REG(tsk, 0)
8481

85-
/*
86-
* Do necessary setup to start up a newly executed thread.
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)
82+
extern void start_thread(struct pt_regs * regs, unsigned long pc,
83+
unsigned long usp);
10584

10685
extern unsigned int get_wchan(struct task_struct *p);
10786

‎arch/arc/kernel/process.c‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,29 @@ int copy_thread(unsigned long clone_flags,
150150
return 0;
151151
}
152152

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+
153176
/*
154177
* Some archs flush debug and FPU info here
155178
*/

0 commit comments

Comments
 (0)