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
|
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/kernel/softpatch_p8.S $
#
# OpenPOWER HostBoot Project
#
# COPYRIGHT International Business Machines Corp. 2011,2014
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
.include "kernel/ppcconsts.S"
/** @fn p8_softpatch_denorm_assist
* @brief Performs denormalization assistance for floating point operations.
*
* Called by the softpatch exception when a denormalization assistance is
* detected. The procedure is to run a denormalization instruction through
* the VSX unit on each floating point register so that the floating point
* instruction which took the exception may execute correctly.
*
* @param[in] r3 - Pointer to task's context_fp_t structure.
*
* Destroys the data in r4/r5. This is safe by the ABI since these are
* parameter registers which are otherwise unused by this function.
*/
.global p8_softpatch_denorm_assist
p8_softpatch_denorm_assist:
mfmsr r4 # Load the MSR
oris r5,r4,0x2080 # Turn on FP,VSX available
mtmsrd r5 # Set the MSR
# Load the FPRs from task context.
lfd f0, TASK_FPR_0(r3)
lfd f1, TASK_FPR_1(r3)
lfd f2, TASK_FPR_2(r3)
lfd f3, TASK_FPR_3(r3)
lfd f4, TASK_FPR_4(r3)
lfd f5, TASK_FPR_5(r3)
lfd f6, TASK_FPR_6(r3)
lfd f7, TASK_FPR_7(r3)
lfd f8, TASK_FPR_8(r3)
lfd f9, TASK_FPR_9(r3)
lfd f10, TASK_FPR_10(r3)
lfd f11, TASK_FPR_11(r3)
lfd f12, TASK_FPR_12(r3)
lfd f13, TASK_FPR_13(r3)
lfd f14, TASK_FPR_14(r3)
lfd f15, TASK_FPR_15(r3)
lfd f16, TASK_FPR_16(r3)
lfd f17, TASK_FPR_17(r3)
lfd f18, TASK_FPR_18(r3)
lfd f19, TASK_FPR_19(r3)
lfd f20, TASK_FPR_20(r3)
lfd f21, TASK_FPR_21(r3)
lfd f22, TASK_FPR_22(r3)
lfd f23, TASK_FPR_23(r3)
lfd f24, TASK_FPR_24(r3)
lfd f25, TASK_FPR_25(r3)
lfd f26, TASK_FPR_26(r3)
lfd f27, TASK_FPR_27(r3)
lfd f28, TASK_FPR_28(r3)
lfd f29, TASK_FPR_29(r3)
lfd f30, TASK_FPR_30(r3)
lfd f31, TASK_FPR_31(r3)
xvcpsgndp f0,f0,f0 # Normalize all of the FPR contents
xvcpsgndp f1,f1,f1
xvcpsgndp f2,f2,f2
xvcpsgndp f3,f3,f3
xvcpsgndp f4,f4,f4
xvcpsgndp f5,f5,f5
xvcpsgndp f6,f6,f6
xvcpsgndp f7,f7,f7
xvcpsgndp f8,f8,f8
xvcpsgndp f9,f9,f9
xvcpsgndp f10,f10,f10
xvcpsgndp f11,f11,f11
xvcpsgndp f12,f12,f12
xvcpsgndp f13,f13,f13
xvcpsgndp f14,f14,f14
xvcpsgndp f15,f15,f15
xvcpsgndp f16,f16,f16
xvcpsgndp f17,f17,f17
xvcpsgndp f18,f18,f18
xvcpsgndp f19,f19,f19
xvcpsgndp f20,f20,f20
xvcpsgndp f21,f21,f21
xvcpsgndp f22,f22,f22
xvcpsgndp f23,f23,f23
xvcpsgndp f24,f24,f24
xvcpsgndp f25,f25,f25
xvcpsgndp f26,f26,f26
xvcpsgndp f27,f27,f27
xvcpsgndp f28,f28,f28
xvcpsgndp f29,f29,f29
xvcpsgndp f30,f30,f30
xvcpsgndp f31,f31,f31
# Save the FPRs to task context.
stfd f0, TASK_FPR_0(r3)
stfd f1, TASK_FPR_1(r3)
stfd f2, TASK_FPR_2(r3)
stfd f3, TASK_FPR_3(r3)
stfd f4, TASK_FPR_4(r3)
stfd f5, TASK_FPR_5(r3)
stfd f6, TASK_FPR_6(r3)
stfd f7, TASK_FPR_7(r3)
stfd f8, TASK_FPR_8(r3)
stfd f9, TASK_FPR_9(r3)
stfd f10, TASK_FPR_10(r3)
stfd f11, TASK_FPR_11(r3)
stfd f12, TASK_FPR_12(r3)
stfd f13, TASK_FPR_13(r3)
stfd f14, TASK_FPR_14(r3)
stfd f15, TASK_FPR_15(r3)
stfd f16, TASK_FPR_16(r3)
stfd f17, TASK_FPR_17(r3)
stfd f18, TASK_FPR_18(r3)
stfd f19, TASK_FPR_19(r3)
stfd f20, TASK_FPR_20(r3)
stfd f21, TASK_FPR_21(r3)
stfd f22, TASK_FPR_22(r3)
stfd f23, TASK_FPR_23(r3)
stfd f24, TASK_FPR_24(r3)
stfd f25, TASK_FPR_25(r3)
stfd f26, TASK_FPR_26(r3)
stfd f27, TASK_FPR_27(r3)
stfd f28, TASK_FPR_28(r3)
stfd f29, TASK_FPR_29(r3)
stfd f30, TASK_FPR_30(r3)
stfd f31, TASK_FPR_31(r3)
mtmsrd r5; # Reset the MSR
blr
|