Linux 5.7.6
[linux/fpc-iii.git] / arch / c6x / kernel / switch_to.S
blobb7f9f607042e68a5c6ffeec1168e666aa5bac00e
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  *  Copyright (C) 2011 Texas Instruments Incorporated
4  *  Author: Mark Salter (msalter@redhat.com)
5  */
7 #include <linux/linkage.h>
8 #include <asm/asm-offsets.h>
10 #define SP      B15
12         /*
13          * void __switch_to(struct thread_info *prev,
14          *                  struct thread_info *next,
15          *                  struct task_struct *tsk) ;
16          */
17 ENTRY(__switch_to)
18         LDDW    .D2T2   *+B4(THREAD_B15_14),B7:B6
19  ||     MV      .L2X    A4,B5   ; prev
20  ||     MV      .L1X    B4,A5   ; next
21  ||     MVC     .S2     RILC,B1
23         STW     .D2T2   B3,*+B5(THREAD_PC)
24  ||     STDW    .D1T1   A13:A12,*+A4(THREAD_A13_12)
25  ||     MVC     .S2     ILC,B0
27         LDW     .D2T2   *+B4(THREAD_PC),B3
28  ||     LDDW    .D1T1   *+A5(THREAD_A13_12),A13:A12
30         STDW    .D1T1   A11:A10,*+A4(THREAD_A11_10)
31  ||     STDW    .D2T2   B1:B0,*+B5(THREAD_RICL_ICL)
32 #ifndef __DSBT__
33  ||     MVKL    .S2     current_ksp,B1
34 #endif
36         STDW    .D2T2   B15:B14,*+B5(THREAD_B15_14)
37  ||     STDW    .D1T1   A15:A14,*+A4(THREAD_A15_14)
38 #ifndef __DSBT__
39  ||     MVKH    .S2     current_ksp,B1
40 #endif
42         ;; Switch to next SP
43         MV      .S2     B7,SP
44 #ifdef __DSBT__
45  ||     STW     .D2T2   B7,*+B14(current_ksp)
46 #else
47  ||     STW     .D2T2   B7,*B1
48  ||     MV      .L2     B6,B14
49 #endif
50  ||     LDDW    .D1T1   *+A5(THREAD_RICL_ICL),A1:A0
52         STDW    .D2T2   B11:B10,*+B5(THREAD_B11_10)
53  ||     LDDW    .D1T1   *+A5(THREAD_A15_14),A15:A14
55         STDW    .D2T2   B13:B12,*+B5(THREAD_B13_12)
56  ||     LDDW    .D1T1   *+A5(THREAD_A11_10),A11:A10
58         B       .S2     B3              ; return in next E1
59  ||     LDDW    .D2T2   *+B4(THREAD_B13_12),B13:B12
61         LDDW    .D2T2   *+B4(THREAD_B11_10),B11:B10
62         NOP
64         MV      .L2X    A0,B0
65  ||     MV      .S1     A6,A4
67         MVC     .S2     B0,ILC
68  ||     MV      .L2X    A1,B1
70         MVC     .S2     B1,RILC
71 ENDPROC(__switch_to)