This source file includes following definitions.
- __kernel_fpu_begin
- __kernel_fpu_end
1
2
3
4
5
6
7
8 #include <linux/kernel.h>
9 #include <linux/cpu.h>
10 #include <linux/sched.h>
11 #include <asm/fpu/types.h>
12 #include <asm/fpu/api.h>
13
14 asm(".include \"asm/vx-insn.h\"\n");
15
16 void __kernel_fpu_begin(struct kernel_fpu *state, u32 flags)
17 {
18
19
20
21
22 flags &= state->mask;
23
24 if (flags & KERNEL_FPC)
25
26 asm volatile("stfpc %0" : "=Q" (state->fpc));
27
28 if (!MACHINE_HAS_VX) {
29 if (flags & KERNEL_VXR_V0V7) {
30
31 asm volatile("std 0,%0" : "=Q" (state->fprs[0]));
32 asm volatile("std 1,%0" : "=Q" (state->fprs[1]));
33 asm volatile("std 2,%0" : "=Q" (state->fprs[2]));
34 asm volatile("std 3,%0" : "=Q" (state->fprs[3]));
35 asm volatile("std 4,%0" : "=Q" (state->fprs[4]));
36 asm volatile("std 5,%0" : "=Q" (state->fprs[5]));
37 asm volatile("std 6,%0" : "=Q" (state->fprs[6]));
38 asm volatile("std 7,%0" : "=Q" (state->fprs[7]));
39 asm volatile("std 8,%0" : "=Q" (state->fprs[8]));
40 asm volatile("std 9,%0" : "=Q" (state->fprs[9]));
41 asm volatile("std 10,%0" : "=Q" (state->fprs[10]));
42 asm volatile("std 11,%0" : "=Q" (state->fprs[11]));
43 asm volatile("std 12,%0" : "=Q" (state->fprs[12]));
44 asm volatile("std 13,%0" : "=Q" (state->fprs[13]));
45 asm volatile("std 14,%0" : "=Q" (state->fprs[14]));
46 asm volatile("std 15,%0" : "=Q" (state->fprs[15]));
47 }
48 return;
49 }
50
51
52 asm volatile (
53
54
55
56
57 " la 1,%[vxrs]\n"
58 " tmll %[m],30\n"
59 " jz 7f\n"
60 " jo 5f\n"
61
62
63
64
65 " chi %[m],12\n"
66 " jne 0f\n"
67 " VSTM 8,23,128,1\n"
68 " j 7f\n"
69
70 "0: tmll %[m],6\n"
71 " jz 3f\n"
72 " jo 2f\n"
73 " brc 2,1f\n"
74 " VSTM 0,7,0,1\n"
75 " j 3f\n"
76 "1: VSTM 8,15,128,1\n"
77 " j 3f\n"
78 "2: VSTM 0,15,0,1\n"
79
80 "3: tmll %[m],24\n"
81 " jz 7f\n"
82 " jo 6f\n"
83 " brc 2,4f\n"
84 " VSTM 16,23,256,1\n"
85 " j 7f\n"
86 "4: VSTM 24,31,384,1\n"
87 " j 7f\n"
88 "5: VSTM 0,15,0,1\n"
89 "6: VSTM 16,31,256,1\n"
90 "7:"
91 : [vxrs] "=Q" (*(struct vx_array *) &state->vxrs)
92 : [m] "d" (flags)
93 : "1", "cc");
94 }
95 EXPORT_SYMBOL(__kernel_fpu_begin);
96
97 void __kernel_fpu_end(struct kernel_fpu *state, u32 flags)
98 {
99
100
101
102
103
104 flags &= state->mask;
105
106 if (flags & KERNEL_FPC)
107
108 asm volatile("lfpc %0" : : "Q" (state->fpc));
109
110 if (!MACHINE_HAS_VX) {
111 if (flags & KERNEL_VXR_V0V7) {
112
113 asm volatile("ld 0,%0" : : "Q" (state->fprs[0]));
114 asm volatile("ld 1,%0" : : "Q" (state->fprs[1]));
115 asm volatile("ld 2,%0" : : "Q" (state->fprs[2]));
116 asm volatile("ld 3,%0" : : "Q" (state->fprs[3]));
117 asm volatile("ld 4,%0" : : "Q" (state->fprs[4]));
118 asm volatile("ld 5,%0" : : "Q" (state->fprs[5]));
119 asm volatile("ld 6,%0" : : "Q" (state->fprs[6]));
120 asm volatile("ld 7,%0" : : "Q" (state->fprs[7]));
121 asm volatile("ld 8,%0" : : "Q" (state->fprs[8]));
122 asm volatile("ld 9,%0" : : "Q" (state->fprs[9]));
123 asm volatile("ld 10,%0" : : "Q" (state->fprs[10]));
124 asm volatile("ld 11,%0" : : "Q" (state->fprs[11]));
125 asm volatile("ld 12,%0" : : "Q" (state->fprs[12]));
126 asm volatile("ld 13,%0" : : "Q" (state->fprs[13]));
127 asm volatile("ld 14,%0" : : "Q" (state->fprs[14]));
128 asm volatile("ld 15,%0" : : "Q" (state->fprs[15]));
129 }
130 return;
131 }
132
133
134 asm volatile (
135
136
137
138
139 " la 1,%[vxrs]\n"
140 " tmll %[m],30\n"
141 " jz 7f\n"
142 " jo 5f\n"
143
144
145
146
147 " chi %[m],12\n"
148 " jne 0f\n"
149 " VLM 8,23,128,1\n"
150 " j 7f\n"
151
152 "0: tmll %[m],6\n"
153 " jz 3f\n"
154 " jo 2f\n"
155 " brc 2,1f\n"
156 " VLM 0,7,0,1\n"
157 " j 3f\n"
158 "1: VLM 8,15,128,1\n"
159 " j 3f\n"
160 "2: VLM 0,15,0,1\n"
161
162 "3: tmll %[m],24\n"
163 " jz 7f\n"
164 " jo 6f\n"
165 " brc 2,4f\n"
166 " VLM 16,23,256,1\n"
167 " j 7f\n"
168 "4: VLM 24,31,384,1\n"
169 " j 7f\n"
170 "5: VLM 0,15,0,1\n"
171 "6: VLM 16,31,256,1\n"
172 "7:"
173 : [vxrs] "=Q" (*(struct vx_array *) &state->vxrs)
174 : [m] "d" (flags)
175 : "1", "cc");
176 }
177 EXPORT_SYMBOL(__kernel_fpu_end);