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

TOMOYO Linux Cross Reference
Linux/arch/ia64/include/asm/switch_to.h

Version: ~ [ linux-6.3-rc3 ] ~ [ linux-6.2.7 ] ~ [ linux-6.1.20 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.103 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.175 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.237 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.278 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.310 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ 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 /*
  3  * Low-level task switching. This is based on information published in
  4  * the Processor Abstraction Layer and the System Abstraction Layer
  5  * manual.
  6  *
  7  * Copyright (C) 1998-2003 Hewlett-Packard Co
  8  *      David Mosberger-Tang <davidm@hpl.hp.com>
  9  * Copyright (C) 1999 Asit Mallick <asit.k.mallick@intel.com>
 10  * Copyright (C) 1999 Don Dugger <don.dugger@intel.com>
 11  */
 12 #ifndef _ASM_IA64_SWITCH_TO_H
 13 #define _ASM_IA64_SWITCH_TO_H
 14 
 15 #include <linux/percpu.h>
 16 
 17 struct task_struct;
 18 
 19 /*
 20  * Context switch from one thread to another.  If the two threads have
 21  * different address spaces, schedule() has already taken care of
 22  * switching to the new address space by calling switch_mm().
 23  *
 24  * Disabling access to the fph partition and the debug-register
 25  * context switch MUST be done before calling ia64_switch_to() since a
 26  * newly created thread returns directly to
 27  * ia64_ret_from_syscall_clear_r8.
 28  */
 29 extern struct task_struct *ia64_switch_to (void *next_task);
 30 
 31 extern void ia64_save_extra (struct task_struct *task);
 32 extern void ia64_load_extra (struct task_struct *task);
 33 
 34 #ifdef CONFIG_PERFMON
 35   DECLARE_PER_CPU(unsigned long, pfm_syst_info);
 36 # define PERFMON_IS_SYSWIDE() (__this_cpu_read(pfm_syst_info) & 0x1)
 37 #else
 38 # define PERFMON_IS_SYSWIDE() (0)
 39 #endif
 40 
 41 #define IA64_HAS_EXTRA_STATE(t)                                                 \
 42         ((t)->thread.flags & (IA64_THREAD_DBG_VALID|IA64_THREAD_PM_VALID)       \
 43          || PERFMON_IS_SYSWIDE())
 44 
 45 #define __switch_to(prev,next,last) do {                                                         \
 46         if (IA64_HAS_EXTRA_STATE(prev))                                                          \
 47                 ia64_save_extra(prev);                                                           \
 48         if (IA64_HAS_EXTRA_STATE(next))                                                          \
 49                 ia64_load_extra(next);                                                           \
 50         ia64_psr(task_pt_regs(next))->dfh = !ia64_is_local_fpu_owner(next);                      \
 51         (last) = ia64_switch_to((next));                                                         \
 52 } while (0)
 53 
 54 #ifdef CONFIG_SMP
 55 /*
 56  * In the SMP case, we save the fph state when context-switching away from a thread that
 57  * modified fph.  This way, when the thread gets scheduled on another CPU, the CPU can
 58  * pick up the state from task->thread.fph, avoiding the complication of having to fetch
 59  * the latest fph state from another CPU.  In other words: eager save, lazy restore.
 60  */
 61 # define switch_to(prev,next,last) do {                                         \
 62         if (ia64_psr(task_pt_regs(prev))->mfh && ia64_is_local_fpu_owner(prev)) {                               \
 63                 ia64_psr(task_pt_regs(prev))->mfh = 0;                  \
 64                 (prev)->thread.flags |= IA64_THREAD_FPH_VALID;                  \
 65                 __ia64_save_fpu((prev)->thread.fph);                            \
 66         }                                                                       \
 67         __switch_to(prev, next, last);                                          \
 68         /* "next" in old context is "current" in new context */                 \
 69         if (unlikely((current->thread.flags & IA64_THREAD_MIGRATION) &&        \
 70                      (task_cpu(current) !=                                     \
 71                                       task_thread_info(current)->last_cpu))) { \
 72                 task_thread_info(current)->last_cpu = task_cpu(current);       \
 73         }                                                                      \
 74 } while (0)
 75 #else
 76 # define switch_to(prev,next,last)      __switch_to(prev, next, last)
 77 #endif
 78 
 79 #endif /* _ASM_IA64_SWITCH_TO_H */
 80 

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp