source: mainline/kernel/arch/mips64/include/context_offset.h@ 2429e4a

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 2429e4a was 2429e4a, checked in by Martin Decky <martin@…>, 14 years ago

add initial support for mips64
(it does not do anything useful so far and there are probably severe bugs and ABI violations, but it compiles)

  • Property mode set to 100644
File size: 4.2 KB
Line 
1/*
2 * Copyright (c) 2005 Martin Decky
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#ifndef KERN_mips64_CONTEXT_OFFSET_H_
30#define KERN_mips64_CONTEXT_OFFSET_H_
31
32#define OFFSET_SP 0x00
33#define OFFSET_PC 0x08
34#define OFFSET_S0 0x10
35#define OFFSET_S1 0x18
36#define OFFSET_S2 0x20
37#define OFFSET_S3 0x28
38#define OFFSET_S4 0x30
39#define OFFSET_S5 0x38
40#define OFFSET_S6 0x40
41#define OFFSET_S7 0x48
42#define OFFSET_S8 0x50
43#define OFFSET_GP 0x58
44
45#ifdef KERNEL
46 #define OFFSET_IPL 0x60
47#else
48 #define OFFSET_TLS 0x60
49
50 #define OFFSET_F20 0x68
51 #define OFFSET_F21 0x70
52 #define OFFSET_F22 0x78
53 #define OFFSET_F23 0x80
54 #define OFFSET_F24 0x88
55 #define OFFSET_F25 0x90
56 #define OFFSET_F26 0x98
57 #define OFFSET_F27 0xa0
58 #define OFFSET_F28 0xa8
59 #define OFFSET_F29 0xb0
60 #define OFFSET_F30 0xb8
61#endif /* KERNEL */
62
63#ifdef __ASM__
64
65#include <arch/asm/regname.h>
66
67# ctx: address of the structure with saved context
68.macro CONTEXT_SAVE_ARCH_CORE ctx:req
69 sd $s0, OFFSET_S0(\ctx)
70 sd $s1, OFFSET_S1(\ctx)
71 sd $s2, OFFSET_S2(\ctx)
72 sd $s3, OFFSET_S3(\ctx)
73 sd $s4, OFFSET_S4(\ctx)
74 sd $s5, OFFSET_S5(\ctx)
75 sd $s6, OFFSET_S6(\ctx)
76 sd $s7, OFFSET_S7(\ctx)
77 sd $s8, OFFSET_S8(\ctx)
78 sd $gp, OFFSET_GP(\ctx)
79
80#ifndef KERNEL
81 sd $k1, OFFSET_TLS(\ctx)
82
83#ifdef CONFIG_FPU
84 dmfc1 $t0, $20
85 sd $t0, OFFSET_F20(\ctx)
86
87 dmfc1 $t0,$21
88 sd $t0, OFFSET_F21(\ctx)
89
90 dmfc1 $t0,$22
91 sd $t0, OFFSET_F22(\ctx)
92
93 dmfc1 $t0,$23
94 sd $t0, OFFSET_F23(\ctx)
95
96 dmfc1 $t0,$24
97 sd $t0, OFFSET_F24(\ctx)
98
99 dmfc1 $t0,$25
100 sd $t0, OFFSET_F25(\ctx)
101
102 dmfc1 $t0,$26
103 sd $t0, OFFSET_F26(\ctx)
104
105 dmfc1 $t0,$27
106 sd $t0, OFFSET_F27(\ctx)
107
108 dmfc1 $t0,$28
109 sd $t0, OFFSET_F28(\ctx)
110
111 dmfc1 $t0,$29
112 sd $t0, OFFSET_F29(\ctx)
113
114 dmfc1 $t0,$30
115 sd $t0, OFFSET_F30(\ctx)
116#endif /* CONFIG_FPU */
117#endif /* KERNEL */
118
119 sd $ra, OFFSET_PC(\ctx)
120 sd $sp, OFFSET_SP(\ctx)
121.endm
122
123# ctx: address of the structure with saved context
124.macro CONTEXT_RESTORE_ARCH_CORE ctx:req
125 ld $s0, OFFSET_S0(\ctx)
126 ld $s1, OFFSET_S1(\ctx)
127 ld $s2, OFFSET_S2(\ctx)
128 ld $s3, OFFSET_S3(\ctx)
129 ld $s4, OFFSET_S4(\ctx)
130 ld $s5, OFFSET_S5(\ctx)
131 ld $s6, OFFSET_S6(\ctx)
132 ld $s7, OFFSET_S7(\ctx)
133 ld $s8, OFFSET_S8(\ctx)
134 ld $gp, OFFSET_GP(\ctx)
135
136#ifndef KERNEL
137 ld $k1, OFFSET_TLS(\ctx)
138
139#ifdef CONFIG_FPU
140 ld $t0, OFFSET_F20(\ctx)
141 dmtc1 $t0,$20
142
143 ld $t0, OFFSET_F21(\ctx)
144 dmtc1 $t0,$21
145
146 ld $t0, OFFSET_F22(\ctx)
147 dmtc1 $t0,$22
148
149 ld $t0, OFFSET_F23(\ctx)
150 dmtc1 $t0,$23
151
152 ld $t0, OFFSET_F24(\ctx)
153 dmtc1 $t0,$24
154
155 ld $t0, OFFSET_F25(\ctx)
156 dmtc1 $t0,$25
157
158 ld $t0, OFFSET_F26(\ctx)
159 dmtc1 $t0,$26
160
161 ld $t0, OFFSET_F27(\ctx)
162 dmtc1 $t0,$27
163
164 ld $t0, OFFSET_F28(\ctx)
165 dmtc1 $t0,$28
166
167 ld $t0, OFFSET_F29(\ctx)
168 dmtc1 $t0,$29
169
170 ld $t0, OFFSET_F30(\ctx)
171 dmtc1 $t0,$30
172#endif /* CONFIG_FPU */
173#endif /* KERNEL */
174
175 ld $ra, OFFSET_PC(\ctx)
176 ld $sp, OFFSET_SP(\ctx)
177.endm
178
179#endif /* __ASM__ */
180
181#endif
Note: See TracBrowser for help on using the repository browser.