process.c (446279168e030fd0ed68e2bba336bef8bb3da352) process.c (49232773d8233ed70c4998851bc84e465fc1c788)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Author: Huacai Chen <chenhuacai@loongson.cn>
4 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
5 *
6 * Derived from MIPS:
7 * Copyright (C) 1994 - 1999, 2000 by Ralf Baechle and others.
8 * Copyright (C) 2005, 2006 by Ralf Baechle (ralf@linux-mips.org)

--- 30 unchanged lines hidden (view full) ---

39#include <asm/fpu.h>
40#include <asm/io.h>
41#include <asm/irq.h>
42#include <asm/irq_regs.h>
43#include <asm/loongarch.h>
44#include <asm/pgtable.h>
45#include <asm/processor.h>
46#include <asm/reg.h>
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Author: Huacai Chen <chenhuacai@loongson.cn>
4 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
5 *
6 * Derived from MIPS:
7 * Copyright (C) 1994 - 1999, 2000 by Ralf Baechle and others.
8 * Copyright (C) 2005, 2006 by Ralf Baechle (ralf@linux-mips.org)

--- 30 unchanged lines hidden (view full) ---

39#include <asm/fpu.h>
40#include <asm/io.h>
41#include <asm/irq.h>
42#include <asm/irq_regs.h>
43#include <asm/loongarch.h>
44#include <asm/pgtable.h>
45#include <asm/processor.h>
46#include <asm/reg.h>
47#include <asm/unwind.h>
47#include <asm/vdso.h>
48
49/*
50 * Idle related variables and functions
51 */
52
53unsigned long boot_option_idle_override = IDLE_NO_OVERRIDE;
54EXPORT_SYMBOL(boot_option_idle_override);

--- 123 unchanged lines hidden (view full) ---

178 return 0;
179}
180
181unsigned long __get_wchan(struct task_struct *task)
182{
183 return 0;
184}
185
48#include <asm/vdso.h>
49
50/*
51 * Idle related variables and functions
52 */
53
54unsigned long boot_option_idle_override = IDLE_NO_OVERRIDE;
55EXPORT_SYMBOL(boot_option_idle_override);

--- 123 unchanged lines hidden (view full) ---

179 return 0;
180}
181
182unsigned long __get_wchan(struct task_struct *task)
183{
184 return 0;
185}
186
187bool in_irq_stack(unsigned long stack, struct stack_info *info)
188{
189 unsigned long nextsp;
190 unsigned long begin = (unsigned long)this_cpu_read(irq_stack);
191 unsigned long end = begin + IRQ_STACK_START;
192
193 if (stack < begin || stack >= end)
194 return false;
195
196 nextsp = *(unsigned long *)end;
197 if (nextsp & (SZREG - 1))
198 return false;
199
200 info->begin = begin;
201 info->end = end;
202 info->next_sp = nextsp;
203 info->type = STACK_TYPE_IRQ;
204
205 return true;
206}
207
208bool in_task_stack(unsigned long stack, struct task_struct *task,
209 struct stack_info *info)
210{
211 unsigned long begin = (unsigned long)task_stack_page(task);
212 unsigned long end = begin + THREAD_SIZE - 32;
213
214 if (stack < begin || stack >= end)
215 return false;
216
217 info->begin = begin;
218 info->end = end;
219 info->next_sp = 0;
220 info->type = STACK_TYPE_TASK;
221
222 return true;
223}
224
225int get_stack_info(unsigned long stack, struct task_struct *task,
226 struct stack_info *info)
227{
228 task = task ? : current;
229
230 if (!stack || stack & (SZREG - 1))
231 goto unknown;
232
233 if (in_task_stack(stack, task, info))
234 return 0;
235
236 if (task != current)
237 goto unknown;
238
239 if (in_irq_stack(stack, info))
240 return 0;
241
242unknown:
243 info->type = STACK_TYPE_UNKNOWN;
244 return -EINVAL;
245}
246
186unsigned long stack_top(void)
187{
188 unsigned long top = TASK_SIZE & PAGE_MASK;
189
190 /* Space for the VDSO & data page */
191 top -= PAGE_ALIGN(current->thread.vdso->size);
192 top -= PAGE_SIZE;
193

--- 76 unchanged lines hidden ---
247unsigned long stack_top(void)
248{
249 unsigned long top = TASK_SIZE & PAGE_MASK;
250
251 /* Space for the VDSO & data page */
252 top -= PAGE_ALIGN(current->thread.vdso->size);
253 top -= PAGE_SIZE;
254

--- 76 unchanged lines hidden ---