This source file includes following definitions.
- start_thread
- arch_cpu_idle
- copy_thread
- release_thread
- flush_thread
- get_wchan
- dump_fpu
- do_work_pending
1
2
3
4
5
6
7
8 #include <linux/sched.h>
9 #include <linux/sched/debug.h>
10 #include <linux/sched/task.h>
11 #include <linux/sched/task_stack.h>
12 #include <linux/types.h>
13 #include <linux/module.h>
14 #include <linux/tick.h>
15 #include <linux/uaccess.h>
16 #include <linux/slab.h>
17 #include <linux/tracehook.h>
18
19
20
21
22
23
24
25
26
27
28 void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long sp)
29 {
30
31 memset(regs, 0, sizeof(*regs));
32
33 pt_set_usermode(regs);
34 pt_set_elr(regs, pc);
35 pt_set_rte_sp(regs, sp);
36 }
37
38
39
40
41
42
43 void arch_cpu_idle(void)
44 {
45 __vmwait();
46
47 local_irq_enable();
48 }
49
50
51
52
53 int copy_thread(unsigned long clone_flags, unsigned long usp,
54 unsigned long arg, struct task_struct *p)
55 {
56 struct thread_info *ti = task_thread_info(p);
57 struct hexagon_switch_stack *ss;
58 struct pt_regs *childregs;
59 asmlinkage void ret_from_fork(void);
60
61 childregs = (struct pt_regs *) (((unsigned long) ti + THREAD_SIZE) -
62 sizeof(*childregs));
63
64 ti->regs = childregs;
65
66
67
68
69
70
71
72 ss = (struct hexagon_switch_stack *) ((unsigned long) childregs -
73 sizeof(*ss));
74 ss->lr = (unsigned long)ret_from_fork;
75 p->thread.switch_sp = ss;
76 if (unlikely(p->flags & PF_KTHREAD)) {
77 memset(childregs, 0, sizeof(struct pt_regs));
78
79 ss->r24 = usp;
80 ss->r25 = arg;
81 pt_set_kmode(childregs);
82 return 0;
83 }
84 memcpy(childregs, current_pt_regs(), sizeof(*childregs));
85 ss->r2524 = 0;
86
87 if (usp)
88 pt_set_rte_sp(childregs, usp);
89
90
91 childregs->r00 = 0;
92
93
94
95
96
97
98
99
100
101
102 if (clone_flags & CLONE_SETTLS)
103 childregs->ugp = childregs->r04;
104
105
106
107
108
109
110
111 return 0;
112 }
113
114
115
116
117 void release_thread(struct task_struct *dead_task)
118 {
119 }
120
121
122
123
124 void flush_thread(void)
125 {
126 }
127
128
129
130
131
132
133 unsigned long get_wchan(struct task_struct *p)
134 {
135 unsigned long fp, pc;
136 unsigned long stack_page;
137 int count = 0;
138 if (!p || p == current || p->state == TASK_RUNNING)
139 return 0;
140
141 stack_page = (unsigned long)task_stack_page(p);
142 fp = ((struct hexagon_switch_stack *)p->thread.switch_sp)->fp;
143 do {
144 if (fp < (stack_page + sizeof(struct thread_info)) ||
145 fp >= (THREAD_SIZE - 8 + stack_page))
146 return 0;
147 pc = ((unsigned long *)fp)[1];
148 if (!in_sched_functions(pc))
149 return pc;
150 fp = *(unsigned long *) fp;
151 } while (count++ < 16);
152
153 return 0;
154 }
155
156
157
158
159 int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
160 {
161 return 0;
162 }
163
164
165
166
167
168
169
170
171
172
173 int do_work_pending(struct pt_regs *regs, u32 thread_info_flags)
174 {
175 if (!(thread_info_flags & _TIF_WORK_MASK)) {
176 return 0;
177 }
178
179 local_irq_enable();
180
181 if (thread_info_flags & _TIF_NEED_RESCHED) {
182 schedule();
183 return 1;
184 }
185
186 if (thread_info_flags & _TIF_SIGPENDING) {
187 do_signal(regs);
188 return 1;
189 }
190
191 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
192 clear_thread_flag(TIF_NOTIFY_RESUME);
193 tracehook_notify_resume(regs);
194 return 1;
195 }
196
197
198 panic("%s: bad thread_info flags 0x%08x\n", __func__,
199 thread_info_flags);
200 }