Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / arch / c6x / kernel / switch_to.S
1 /*
2  *  Copyright (C) 2011 Texas Instruments Incorporated
3  *  Author: Mark Salter (msalter@redhat.com)
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License version 2 as
7  *  published by the Free Software Foundation.
8  */
9
10 #include <linux/linkage.h>
11 #include <asm/asm-offsets.h>
12
13 #define SP      B15
14
15         /*
16          * void __switch_to(struct thread_info *prev,
17          *                  struct thread_info *next,
18          *                  struct task_struct *tsk) ;
19          */
20 ENTRY(__switch_to)
21         LDDW    .D2T2   *+B4(THREAD_B15_14),B7:B6
22  ||     MV      .L2X    A4,B5   ; prev
23  ||     MV      .L1X    B4,A5   ; next
24  ||     MVC     .S2     RILC,B1
25
26         STW     .D2T2   B3,*+B5(THREAD_PC)
27  ||     STDW    .D1T1   A13:A12,*+A4(THREAD_A13_12)
28  ||     MVC     .S2     ILC,B0
29
30         LDW     .D2T2   *+B4(THREAD_PC),B3
31  ||     LDDW    .D1T1   *+A5(THREAD_A13_12),A13:A12
32
33         STDW    .D1T1   A11:A10,*+A4(THREAD_A11_10)
34  ||     STDW    .D2T2   B1:B0,*+B5(THREAD_RICL_ICL)
35 #ifndef __DSBT__
36  ||     MVKL    .S2     current_ksp,B1
37 #endif
38
39         STDW    .D2T2   B15:B14,*+B5(THREAD_B15_14)
40  ||     STDW    .D1T1   A15:A14,*+A4(THREAD_A15_14)
41 #ifndef __DSBT__
42  ||     MVKH    .S2     current_ksp,B1
43 #endif
44
45         ;; Switch to next SP
46         MV      .S2     B7,SP
47 #ifdef __DSBT__
48  ||     STW     .D2T2   B7,*+B14(current_ksp)
49 #else
50  ||     STW     .D2T2   B7,*B1
51  ||     MV      .L2     B6,B14
52 #endif
53  ||     LDDW    .D1T1   *+A5(THREAD_RICL_ICL),A1:A0
54
55         STDW    .D2T2   B11:B10,*+B5(THREAD_B11_10)
56  ||     LDDW    .D1T1   *+A5(THREAD_A15_14),A15:A14
57
58         STDW    .D2T2   B13:B12,*+B5(THREAD_B13_12)
59  ||     LDDW    .D1T1   *+A5(THREAD_A11_10),A11:A10
60
61         B       .S2     B3              ; return in next E1
62  ||     LDDW    .D2T2   *+B4(THREAD_B13_12),B13:B12
63
64         LDDW    .D2T2   *+B4(THREAD_B11_10),B11:B10
65         NOP
66
67         MV      .L2X    A0,B0
68  ||     MV      .S1     A6,A4
69
70         MVC     .S2     B0,ILC
71  ||     MV      .L2X    A1,B1
72
73         MVC     .S2     B1,RILC
74 ENDPROC(__switch_to)