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

TOMOYO Linux Cross Reference
Linux/arch/hexagon/kernel/vm_switch.S

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ 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.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  * Context switch support for Hexagon
  4  *
  5  * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
  6  */
  7 
  8 #include <asm/asm-offsets.h>
  9 
 10 .text
 11 
 12 /*
 13  * The register used as a fast-path thread information pointer
 14  * is determined as a kernel configuration option.  If it happens
 15  * to be a callee-save register, we're going to be saving and
 16  * restoring it twice here.
 17  *
 18  * This code anticipates a revised ABI where R20-23 are added
 19  * to the set of callee-save registers, but this should be
 20  * backward compatible to legacy tools.
 21  */
 22 
 23 
 24 /*
 25  *      void switch_to(struct task_struct *prev,
 26  *              struct task_struct *next, struct task_struct *last);
 27  */
 28         .p2align 2
 29         .globl __switch_to
 30         .type   __switch_to, @function
 31 
 32 /*
 33  * When we exit the wormhole, we need to store the previous task
 34  * in the new R0's pointer.  Technically it should be R2, but they should
 35  * be the same; seems like a legacy thing.  In short, don't butcher
 36  * R0, let it go back out unmolested.
 37  */
 38 
 39 __switch_to:
 40         /*
 41          * Push callee-saves onto "prev" stack.
 42          * Here, we're sneaky because the LR and FP
 43          * storage of the thread_stack structure
 44          * is automagically allocated by allocframe,
 45          * so we pass struct size less 8.
 46          */
 47         allocframe(#(_SWITCH_STACK_SIZE - 8));
 48         memd(R29+#(_SWITCH_R2726))=R27:26;
 49         memd(R29+#(_SWITCH_R2524))=R25:24;
 50         memd(R29+#(_SWITCH_R2322))=R23:22;
 51         memd(R29+#(_SWITCH_R2120))=R21:20;
 52         memd(R29+#(_SWITCH_R1918))=R19:18;
 53         memd(R29+#(_SWITCH_R1716))=R17:16;
 54         /* Stash thread_info pointer in task_struct */
 55         memw(R0+#_TASK_THREAD_INFO) = THREADINFO_REG;
 56         memw(R0 +#(_TASK_STRUCT_THREAD + _THREAD_STRUCT_SWITCH_SP)) = R29;
 57         /* Switch to "next" stack and restore callee saves from there */
 58         R29 = memw(R1 + #(_TASK_STRUCT_THREAD + _THREAD_STRUCT_SWITCH_SP));
 59         {
 60             R27:26 = memd(R29+#(_SWITCH_R2726));
 61             R25:24 = memd(R29+#(_SWITCH_R2524));
 62         }
 63         {
 64             R23:22 = memd(R29+#(_SWITCH_R2322));
 65             R21:20 = memd(R29+#(_SWITCH_R2120));
 66         }
 67         {
 68             R19:18 = memd(R29+#(_SWITCH_R1918));
 69             R17:16 = memd(R29+#(_SWITCH_R1716));
 70         }
 71         {
 72             /* THREADINFO_REG is currently one of the callee-saved regs
 73              * above, and so be sure to re-load it last.
 74              */
 75             THREADINFO_REG = memw(R1 + #_TASK_THREAD_INFO);
 76             R31:30 = memd(R29+#_SWITCH_FP);
 77         }
 78         {
 79             R29 = add(R29,#_SWITCH_STACK_SIZE);
 80             jumpr R31;
 81         }
 82         .size   __switch_to, .-__switch_to

~ [ 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