blob: 24933fdb580c7005e2c92c178c294004bb42698b [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001/*
2 * Copyright (c) 2015 Travis Geiselbrecht
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files
6 * (the "Software"), to deal in the Software without restriction,
7 * including without limitation the rights to use, copy, modify, merge,
8 * publish, distribute, sublicense, and/or sell copies of the Software,
9 * and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23#include <asm.h>
24
25/* void microblaze_context_switch(
26 struct microblaze_context_switch_frame *oldcs,
27 struct microblaze_context_switch_frame *newcs); */
28FUNCTION(microblaze_context_switch)
29 # r5 = oldcs
30 # r6 = newcs
31 swi r1, r5, 0x0
32 swi r2, r5, 0x4
33 swi r13, r5, 0x8
34 swi r14, r5, 0xc
35 swi r15, r5, 0x10
36 swi r16, r5, 0x14
37 swi r17, r5, 0x18
38 swi r18, r5, 0x1c
39 swi r19, r5, 0x20
40 swi r20, r5, 0x24
41 swi r21, r5, 0x28
42 swi r22, r5, 0x2c
43 swi r23, r5, 0x30
44 swi r24, r5, 0x34
45 swi r25, r5, 0x38
46 swi r26, r5, 0x3c
47 swi r27, r5, 0x40
48 swi r28, r5, 0x44
49 swi r29, r5, 0x48
50 swi r30, r5, 0x4c
51 swi r31, r5, 0x50
52
53 # restore the new context
54 lwi r31, r6, 0x50
55 lwi r30, r6, 0x4c
56 lwi r29, r6, 0x48
57 lwi r28, r6, 0x44
58 lwi r27, r6, 0x40
59 lwi r26, r6, 0x3c
60 lwi r25, r6, 0x38
61 lwi r24, r6, 0x34
62 lwi r23, r6, 0x30
63 lwi r22, r6, 0x2c
64 lwi r21, r6, 0x28
65 lwi r20, r6, 0x24
66 lwi r19, r6, 0x20
67 lwi r18, r6, 0x1c
68 lwi r17, r6, 0x18
69 lwi r16, r6, 0x14
70 lwi r15, r6, 0x10
71 lwi r14, r6, 0xc
72 lwi r13, r6, 0x8
73 lwi r2, r6, 0x4
74 lwi r1, r6, 0x0
75
76 rtsd r15, 8
77 nop
78