~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/csky/kernel/process.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
  3 
  4 #include <linux/module.h>
  5 #include <linux/sched.h>
  6 #include <linux/sched/task_stack.h>
  7 #include <linux/sched/debug.h>
  8 #include <linux/delay.h>
  9 #include <linux/kallsyms.h>
 10 #include <linux/uaccess.h>
 11 #include <linux/ptrace.h>
 12 #include <linux/elfcore.h>
 13 
 14 #include <asm/elf.h>
 15 #include <abi/reg_ops.h>
 16 
 17 struct cpuinfo_csky cpu_data[NR_CPUS];
 18 
 19 #ifdef CONFIG_STACKPROTECTOR
 20 #include <linux/stackprotector.h>
 21 unsigned long __stack_chk_guard __read_mostly;
 22 EXPORT_SYMBOL(__stack_chk_guard);
 23 #endif
 24 
 25 asmlinkage void ret_from_fork(void);
 26 asmlinkage void ret_from_kernel_thread(void);
 27 
 28 /*
 29  * Some archs flush debug and FPU info here
 30  */
 31 void flush_thread(void){}
 32 
 33 int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 34 {
 35         unsigned long clone_flags = args->flags;
 36         unsigned long usp = args->stack;
 37         unsigned long tls = args->tls;
 38         struct switch_stack *childstack;
 39         struct pt_regs *childregs = task_pt_regs(p);
 40 
 41 #ifdef CONFIG_CPU_HAS_FPU
 42         save_to_user_fp(&p->thread.user_fp);
 43 #endif
 44 
 45         childstack = ((struct switch_stack *) childregs) - 1;
 46         memset(childstack, 0, sizeof(struct switch_stack));
 47 
 48         /* setup thread.sp for switch_to !!! */
 49         p->thread.sp = (unsigned long)childstack;
 50 
 51         if (unlikely(args->fn)) {
 52                 memset(childregs, 0, sizeof(struct pt_regs));
 53                 childstack->r15 = (unsigned long) ret_from_kernel_thread;
 54                 childstack->r10 = (unsigned long) args->fn_arg;
 55                 childstack->r9 = (unsigned long) args->fn;
 56                 childregs->sr = mfcr("psr");
 57         } else {
 58                 *childregs = *(current_pt_regs());
 59                 if (usp)
 60                         childregs->usp = usp;
 61                 if (clone_flags & CLONE_SETTLS)
 62                         task_thread_info(p)->tp_value = childregs->tls
 63                                                       = tls;
 64 
 65                 childregs->a0 = 0;
 66                 childstack->r15 = (unsigned long) ret_from_fork;
 67         }
 68 
 69         return 0;
 70 }
 71 
 72 /* Fill in the fpu structure for a core dump.  */
 73 int elf_core_copy_task_fpregs(struct task_struct *t, elf_fpregset_t *fpu)
 74 {
 75         memcpy(fpu, &current->thread.user_fp, sizeof(*fpu));
 76         return 1;
 77 }
 78 
 79 int dump_task_regs(struct task_struct *tsk, elf_gregset_t *pr_regs)
 80 {
 81         struct pt_regs *regs = task_pt_regs(tsk);
 82 
 83         /* NOTE: usp is error value. */
 84         ELF_CORE_COPY_REGS((*pr_regs), regs)
 85 
 86         return 1;
 87 }
 88 
 89 #ifndef CONFIG_CPU_PM_NONE
 90 void arch_cpu_idle(void)
 91 {
 92 #ifdef CONFIG_CPU_PM_WAIT
 93         asm volatile("wait\n");
 94 #endif
 95 
 96 #ifdef CONFIG_CPU_PM_DOZE
 97         asm volatile("doze\n");
 98 #endif
 99 
100 #ifdef CONFIG_CPU_PM_STOP
101         asm volatile("stop\n");
102 #endif
103 }
104 #endif
105 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php