process.c (34069d12e239ae8f36dd96c378e4622fb1c42a76) | process.c (bd3c5798484aa9a08302a844d7a75a2ee3b53d05) |
---|---|
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) --- 24 unchanged lines hidden (view full) --- 33#include <linux/prctl.h> 34#include <linux/nmi.h> 35 36#include <asm/asm.h> 37#include <asm/bootinfo.h> 38#include <asm/cpu.h> 39#include <asm/elf.h> 40#include <asm/fpu.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) --- 24 unchanged lines hidden (view full) --- 33#include <linux/prctl.h> 34#include <linux/nmi.h> 35 36#include <asm/asm.h> 37#include <asm/bootinfo.h> 38#include <asm/cpu.h> 39#include <asm/elf.h> 40#include <asm/fpu.h> |
41#include <asm/lbt.h> |
|
41#include <asm/io.h> 42#include <asm/irq.h> 43#include <asm/irq_regs.h> 44#include <asm/loongarch.h> 45#include <asm/pgtable.h> 46#include <asm/processor.h> 47#include <asm/reg.h> 48#include <asm/unwind.h> --- 28 unchanged lines hidden (view full) --- 77 78 prmd = regs->csr_prmd & ~(PLV_MASK); 79 prmd |= PLV_USER; 80 regs->csr_prmd = prmd; 81 82 euen = regs->csr_euen & ~(CSR_EUEN_FPEN); 83 regs->csr_euen = euen; 84 lose_fpu(0); | 42#include <asm/io.h> 43#include <asm/irq.h> 44#include <asm/irq_regs.h> 45#include <asm/loongarch.h> 46#include <asm/pgtable.h> 47#include <asm/processor.h> 48#include <asm/reg.h> 49#include <asm/unwind.h> --- 28 unchanged lines hidden (view full) --- 78 79 prmd = regs->csr_prmd & ~(PLV_MASK); 80 prmd |= PLV_USER; 81 regs->csr_prmd = prmd; 82 83 euen = regs->csr_euen & ~(CSR_EUEN_FPEN); 84 regs->csr_euen = euen; 85 lose_fpu(0); |
86 lose_lbt(0); |
|
85 86 clear_thread_flag(TIF_LSX_CTX_LIVE); 87 clear_thread_flag(TIF_LASX_CTX_LIVE); | 87 88 clear_thread_flag(TIF_LSX_CTX_LIVE); 89 clear_thread_flag(TIF_LASX_CTX_LIVE); |
90 clear_thread_flag(TIF_LBT_CTX_LIVE); |
|
88 clear_used_math(); 89 regs->csr_era = pc; 90 regs->regs[3] = sp; 91} 92 93void flush_thread(void) 94{ 95 flush_ptrace_hw_breakpoint(current); --- 20 unchanged lines hidden (view full) --- 116 else if (is_lsx_enabled()) 117 save_lsx(current); 118 else 119 save_fp(current); 120 } 121 122 preempt_enable(); 123 | 91 clear_used_math(); 92 regs->csr_era = pc; 93 regs->regs[3] = sp; 94} 95 96void flush_thread(void) 97{ 98 flush_ptrace_hw_breakpoint(current); --- 20 unchanged lines hidden (view full) --- 119 else if (is_lsx_enabled()) 120 save_lsx(current); 121 else 122 save_fp(current); 123 } 124 125 preempt_enable(); 126 |
124 if (used_math()) 125 memcpy(dst, src, sizeof(struct task_struct)); 126 else | 127 if (!used_math()) |
127 memcpy(dst, src, offsetof(struct task_struct, thread.fpu.fpr)); | 128 memcpy(dst, src, offsetof(struct task_struct, thread.fpu.fpr)); |
129 else 130 memcpy(dst, src, offsetof(struct task_struct, thread.lbt.scr0)); |
|
128 | 131 |
132#ifdef CONFIG_CPU_HAS_LBT 133 memcpy(&dst->thread.lbt, &src->thread.lbt, sizeof(struct loongarch_lbt)); 134#endif 135 |
|
129 return 0; 130} 131 132/* 133 * Copy architecture-specific thread state 134 */ 135int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) 136{ --- 47 unchanged lines hidden (view full) --- 184 185 if (clone_flags & CLONE_SETTLS) 186 childregs->regs[2] = tls; 187 188out: 189 ptrace_hw_copy_thread(p); 190 clear_tsk_thread_flag(p, TIF_USEDFPU); 191 clear_tsk_thread_flag(p, TIF_USEDSIMD); | 136 return 0; 137} 138 139/* 140 * Copy architecture-specific thread state 141 */ 142int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) 143{ --- 47 unchanged lines hidden (view full) --- 191 192 if (clone_flags & CLONE_SETTLS) 193 childregs->regs[2] = tls; 194 195out: 196 ptrace_hw_copy_thread(p); 197 clear_tsk_thread_flag(p, TIF_USEDFPU); 198 clear_tsk_thread_flag(p, TIF_USEDSIMD); |
199 clear_tsk_thread_flag(p, TIF_USEDLBT); |
|
192 clear_tsk_thread_flag(p, TIF_LSX_CTX_LIVE); 193 clear_tsk_thread_flag(p, TIF_LASX_CTX_LIVE); | 200 clear_tsk_thread_flag(p, TIF_LSX_CTX_LIVE); 201 clear_tsk_thread_flag(p, TIF_LASX_CTX_LIVE); |
202 clear_tsk_thread_flag(p, TIF_LBT_CTX_LIVE); |
|
194 195 return 0; 196} 197 198unsigned long __get_wchan(struct task_struct *task) 199{ 200 unsigned long pc = 0; 201 struct unwind_state state; --- 163 unchanged lines hidden --- | 203 204 return 0; 205} 206 207unsigned long __get_wchan(struct task_struct *task) 208{ 209 unsigned long pc = 0; 210 struct unwind_state state; --- 163 unchanged lines hidden --- |