hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/arch/openrisc/kernel/process.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * OpenRISC process.c
34 *
....@@ -8,11 +9,6 @@
89 * Modifications for the OpenRISC architecture:
910 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
1011 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
11
- *
12
- * This program is free software; you can redistribute it and/or
13
- * modify it under the terms of the GNU General Public License
14
- * as published by the Free Software Foundation; either version
15
- * 2 of the License, or (at your option) any later version.
1612 *
1713 * This file handles the architecture-dependent parts of process handling...
1814 */
....@@ -40,7 +36,6 @@
4036 #include <linux/fs.h>
4137
4238 #include <linux/uaccess.h>
43
-#include <asm/pgtable.h>
4439 #include <asm/io.h>
4540 #include <asm/processor.h>
4641 #include <asm/spr_defs.h>
....@@ -84,7 +79,7 @@
8479 */
8580 void arch_cpu_idle(void)
8681 {
87
- local_irq_enable();
82
+ raw_local_irq_enable();
8883 if (mfspr(SPR_UPR) & SPR_UPR_PMP)
8984 mtspr(SPR_PMR, mfspr(SPR_PMR) | SPR_PMR_DME);
9085 }
....@@ -126,7 +121,7 @@
126121 * @usp: user stack pointer or fn for kernel thread
127122 * @arg: arg to fn for kernel thread; always NULL for userspace thread
128123 * @p: the newly created task
129
- * @regs: CPU context to copy for userspace thread; always NULL for kthread
124
+ * @tls: the Thread Local Storage pointer for the new process
130125 *
131126 * At the top of a newly initialized kernel stack are two stacked pt_reg
132127 * structures. The first (topmost) is the userspace context of the thread.
....@@ -152,8 +147,8 @@
152147 */
153148
154149 int
155
-copy_thread(unsigned long clone_flags, unsigned long usp,
156
- unsigned long arg, struct task_struct *p)
150
+copy_thread(unsigned long clone_flags, unsigned long usp, unsigned long arg,
151
+ struct task_struct *p, unsigned long tls)
157152 {
158153 struct pt_regs *userregs;
159154 struct pt_regs *kregs;
....@@ -172,7 +167,7 @@
172167 sp -= sizeof(struct pt_regs);
173168 kregs = (struct pt_regs *)sp;
174169
175
- if (unlikely(p->flags & PF_KTHREAD)) {
170
+ if (unlikely(p->flags & (PF_KTHREAD | PF_IO_WORKER))) {
176171 memset(kregs, 0, sizeof(struct pt_regs));
177172 kregs->gpr[20] = usp; /* fn, kernel thread */
178173 kregs->gpr[22] = arg;
....@@ -183,16 +178,10 @@
183178 userregs->sp = usp;
184179
185180 /*
186
- * For CLONE_SETTLS set "tp" (r10) to the TLS pointer passed to sys_clone.
187
- *
188
- * The kernel entry is:
189
- * int clone (long flags, void *child_stack, int *parent_tid,
190
- * int *child_tid, struct void *tls)
191
- *
192
- * This makes the source r7 in the kernel registers.
181
+ * For CLONE_SETTLS set "tp" (r10) to the TLS pointer.
193182 */
194183 if (clone_flags & CLONE_SETTLS)
195
- userregs->gpr[10] = userregs->gpr[7];
184
+ userregs->gpr[10] = tls;
196185
197186 userregs->gpr[11] = 0; /* Result from fork() */
198187
....@@ -223,13 +212,6 @@
223212 regs->pc = pc;
224213 regs->sr = sr;
225214 regs->sp = sp;
226
-}
227
-
228
-/* Fill in the fpu structure for a core dump. */
229
-int dump_fpu(struct pt_regs *regs, elf_fpregset_t * fpu)
230
-{
231
- /* TODO */
232
- return 0;
233215 }
234216
235217 extern struct thread_info *_switch(struct thread_info *old_ti,