aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mn10300/kernel/fpu-low.S
blob: 96cfd47e68d50354a4d279845b4f7f7cea40703a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
/* MN10300 Low level FPU management operations
 *
 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
 * Written by David Howells (dhowells@redhat.com)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public Licence
 * as published by the Free Software Foundation; either version
 * 2 of the Licence, or (at your option) any later version.
 */
#include <asm/cpu-regs.h>

###############################################################################
#
# void fpu_init_state(void)
# - initialise the FPU
#
###############################################################################
	.globl	fpu_init_state
	.type	fpu_init_state,@function
fpu_init_state:
	mov	epsw,d0
	or	EPSW_FE,epsw

#ifdef CONFIG_MN10300_PROC_MN103E010
	nop
	nop
	nop
#endif
	fmov	0,fs0
	fmov	fs0,fs1
	fmov	fs0,fs2
	fmov	fs0,fs3
	fmov	fs0,fs4
	fmov	fs0,fs5
	fmov	fs0,fs6
	fmov	fs0,fs7
	fmov	fs0,fs8
	fmov	fs0,fs9
	fmov	fs0,fs10
	fmov	fs0,fs11
	fmov	fs0,fs12
	fmov	fs0,fs13
	fmov	fs0,fs14
	fmov	fs0,fs15
	fmov	fs0,fs16
	fmov	fs0,fs17
	fmov	fs0,fs18
	fmov	fs0,fs19
	fmov	fs0,fs20
	fmov	fs0,fs21
	fmov	fs0,fs22
	fmov	fs0,fs23
	fmov	fs0,fs24
	fmov	fs0,fs25
	fmov	fs0,fs26
	fmov	fs0,fs27
	fmov	fs0,fs28
	fmov	fs0,fs29
	fmov	fs0,fs30
	fmov	fs0,fs31
	fmov	FPCR_INIT,fpcr

#ifdef CONFIG_MN10300_PROC_MN103E010
	nop
	nop
	nop
#endif
	mov	d0,epsw
	ret	[],0

	.size	fpu_init_state,.-fpu_init_state

###############################################################################
#
# void fpu_save(struct fpu_state_struct *)
# - save the fpu state
# - note that an FPU Operational exception might occur during this process
#
###############################################################################
	.globl	fpu_save
	.type	fpu_save,@function
fpu_save:
	mov	epsw,d1
	or	EPSW_FE,epsw		/* enable the FPU so we can access it */

#ifdef CONFIG_MN10300_PROC_MN103E010
	nop
	nop
#endif
	mov	d0,a0
	fmov	fs0,(a0+)
	fmov	fs1,(a0+)
	fmov	fs2,(a0+)
	fmov	fs3,(a0+)
	fmov	fs4,(a0+)
	fmov	fs5,(a0+)
	fmov	fs6,(a0+)
	fmov	fs7,(a0+)
	fmov	fs8,(a0+)
	fmov	fs9,(a0+)
	fmov	fs10,(a0+)
	fmov	fs11,(a0+)
	fmov	fs12,(a0+)
	fmov	fs13,(a0+)
	fmov	fs14,(a0+)
	fmov	fs15,(a0+)
	fmov	fs16,(a0+)
	fmov	fs17,(a0+)
	fmov	fs18,(a0+)
	fmov	fs19,(a0+)
	fmov	fs20,(a0+)
	fmov	fs21,(a0+)
	fmov	fs22,(a0+)
	fmov	fs23,(a0+)
	fmov	fs24,(a0+)
	fmov	fs25,(a0+)
	fmov	fs26,(a0+)
	fmov	fs27,(a0+)
	fmov	fs28,(a0+)
	fmov	fs29,(a0+)
	fmov	fs30,(a0+)
	fmov	fs31,(a0+)
	fmov	fpcr,d0
	mov	d0,(a0)
#ifdef CONFIG_MN10300_PROC_MN103E010
	nop
	nop
#endif

	mov	d1,epsw
	ret	[],0

	.size	fpu_save,.-fpu_save

###############################################################################
#
# void fpu_restore(struct fpu_state_struct *)
# - restore the fpu state
# - note that an FPU Operational exception might occur during this process
#
###############################################################################
	.globl	fpu_restore
	.type	fpu_restore,@function
fpu_restore:
	mov	epsw,d1
	or	EPSW_FE,epsw		/* enable the FPU so we can access it */

#ifdef CONFIG_MN10300_PROC_MN103E010
	nop
	nop
#endif
	mov	d0,a0
	fmov	(a0+),fs0
	fmov	(a0+),fs1
	fmov	(a0+),fs2
	fmov	(a0+),fs3
	fmov	(a0+),fs4
	fmov	(a0+),fs5
	fmov	(a0+),fs6
	fmov	(a0+),fs7
	fmov	(a0+),fs8
	fmov	(a0+),fs9
	fmov	(a0+),fs10
	fmov	(a0+),fs11
	fmov	(a0+),fs12
	fmov	(a0+),fs13
	fmov	(a0+),fs14
	fmov	(a0+),fs15
	fmov	(a0+),fs16
	fmov	(a0+),fs17
	fmov	(a0+),fs18
	fmov	(a0+),fs19
	fmov	(a0+),fs20
	fmov	(a0+),fs21
	fmov	(a0+),fs22
	fmov	(a0+),fs23
	fmov	(a0+),fs24
	fmov	(a0+),fs25
	fmov	(a0+),fs26
	fmov	(a0+),fs27
	fmov	(a0+),fs28
	fmov	(a0+),fs29
	fmov	(a0+),fs30
	fmov	(a0+),fs31
	mov	(a0),d0
	fmov	d0,fpcr
#ifdef CONFIG_MN10300_PROC_MN103E010
	nop
	nop
	nop
#endif

	mov	d1,epsw
	ret	[],0

	.size	fpu_restore,.-fpu_restore