1 | Jérôme had the idea checking if MSR bit is active before using
|
---|
2 | msr_read/msr_write in generic_x86.cpp
|
---|
3 |
|
---|
4 | if (get_current_cpuid(&cpuInfo, 1) != B_OK
|
---|
5 | || (cpuInfo.eax_1.features & IA32_FEATURE_MSR) == 0)
|
---|
6 | return;
|
---|
7 |
|
---|
8 | #define IA32_FEATURE_MSR (1UL << 5) was added to
|
---|
9 | haiku/trunk/headers/private/kernel/arch/x86/arch_cpu.h
|
---|
10 |
|
---|
11 | First i separated completely, intel from
|
---|
12 | others, i did the following:
|
---|
13 | Index: generic_x86.cpp
|
---|
14 | ===================================================================
|
---|
15 | --- generic_x86.cpp (revision 19851)
|
---|
16 | +++ generic_x86.cpp (working copy)
|
---|
17 | @@ -181,7 +181,7 @@
|
---|
18 |
|
---|
19 | module_info *modules[] = {
|
---|
20 | (module_info *)&gIntelModule,
|
---|
21 | - (module_info *)&gAMDModule,
|
---|
22 | - (module_info *)&gVIAModule,
|
---|
23 | +// (module_info *)&gAMDModule,
|
---|
24 | +// (module_info *)&gVIAModule,
|
---|
25 | NULL
|
---|
26 | };
|
---|
27 |
|
---|
28 |
|
---|
29 | Index: Jamfile
|
---|
30 | ===================================================================
|
---|
31 | --- Jamfile (revision 19851)
|
---|
32 | +++ Jamfile (working copy)
|
---|
33 | @@ -4,7 +4,7 @@
|
---|
34 |
|
---|
35 | KernelAddon generic_x86 :
|
---|
36 | generic_x86.cpp
|
---|
37 | - amd.cpp
|
---|
38 | +# amd.cpp
|
---|
39 | intel.cpp
|
---|
40 | - via.cpp
|
---|
41 | +# via.cpp
|
---|
42 | ;
|
---|
43 |
|
---|
44 | RESULT:
|
---|
45 | the same stacktrace as previous.
|
---|
46 |
|
---|
47 | After some testings i find that function
|
---|
48 | generic_mtrr_compute_physical_mask() in intel.cpp is
|
---|
49 | executing successfully.
|
---|
50 | So, next i try to be sure that generic_dump_mtrrs
|
---|
51 | is executing successfully in intel.cpp:
|
---|
52 | [...]
|
---|
53 | - generic_dump_mtrrs(generic_count_mtrrs());
|
---|
54 | + generic_dump_mtrrs(0);
|
---|
55 | [...]
|
---|
56 | If i understood correctly we want
|
---|
57 | generic_count_mtrrs() returns 0 in the case
|
---|
58 | of a pentium mmx without mttrs.
|
---|
59 | Surprise!! even with generic_dump_mtrrs(0);
|
---|
60 | a got the same stacktrace.
|
---|
61 | So i focused in generic_dump_mtrrs (in generic_x86.cpp)
|
---|
62 | and did the following: (svn diff generic_x86.cpp > generic_x86.diff)
|
---|
63 |
|
---|
64 | Index: generic_x86.cpp
|
---|
65 | ===================================================================
|
---|
66 | --- generic_x86.cpp (revision 19851)
|
---|
67 | +++ generic_x86.cpp (working copy)
|
---|
68 | @@ -28,6 +28,7 @@
|
---|
69 | #define IA32_MTRR_ENABLE_FIXED (1UL << 10)
|
---|
70 | #define IA32_MTRR_VALID_RANGE (1UL << 11)
|
---|
71 |
|
---|
72 | +#define IA32_FEATURE_MSR (1UL << 5)
|
---|
73 |
|
---|
74 | struct mtrr_capabilities {
|
---|
75 | mtrr_capabilities(uint64 value) { *(uint64 *)this = value; }
|
---|
76 | @@ -48,7 +49,8 @@
|
---|
77 | {
|
---|
78 | cpuid_info cpuInfo;
|
---|
79 | if (get_current_cpuid(&cpuInfo, 1) != B_OK
|
---|
80 | - || (cpuInfo.eax_1.features & IA32_FEATURE_MTRR) == 0)
|
---|
81 | + || (cpuInfo.eax_1.features & IA32_FEATURE_MTRR) == 0
|
---|
82 | + || (cpuInfo.eax_1.features & IA32_FEATURE_MSR) == 0)
|
---|
83 | return 0;
|
---|
84 |
|
---|
85 | mtrr_capabilities
|
---|
86 | capabilities(x86_read_msr(IA32_MSR_MTRR_CAPABILITIES));
|
---|
87 | @@ -160,6 +162,13 @@
|
---|
88 | void
|
---|
89 | generic_dump_mtrrs(uint32 count)
|
---|
90 | {
|
---|
91 | +
|
---|
92 | + cpuid_info cpuInfo;
|
---|
93 | + if (get_current_cpuid(&cpuInfo, 1) != B_OK
|
---|
94 | + || (cpuInfo.eax_1.features & IA32_FEATURE_MTRR) == 0
|
---|
95 | + || (cpuInfo.eax_1.features & IA32_FEATURE_MSR) == 0)
|
---|
96 | + return;
|
---|
97 | +
|
---|
98 | if (x86_read_msr(IA32_MSR_MTRR_DEFAULT_TYPE) & IA32_MTRR_ENABLE) {
|
---|
99 | TRACE(("MTRR enabled\n"));
|
---|
100 | } else {
|
---|
101 | @@ -181,7 +190,7 @@
|
---|
102 |
|
---|
103 | module_info *modules[] = {
|
---|
104 | (module_info *)&gIntelModule,
|
---|
105 | - (module_info *)&gAMDModule,
|
---|
106 | - (module_info *)&gVIAModule,
|
---|
107 | +// (module_info *)&gAMDModule,
|
---|
108 | +// (module_info *)&gVIAModule,
|
---|
109 | NULL
|
---|
110 | };
|
---|
111 |
|
---|
112 | RESULT: the module is loaded successfully.
|
---|
113 | I think indeed generic_count_mtrrs() returns 0
|
---|
114 | and generic_dump_mtrrs returns immediately after the if
|
---|
115 | statement. The problem was indeed the execution of
|
---|
116 | x86_read_msr in generic_dump_mtrrs.Jérôme had the idea checking if MSR bit is active before using
|
---|
117 | msr_read/msr_write in generic_x86.cpp
|
---|
118 |
|
---|
119 | if (get_current_cpuid(&cpuInfo, 1) != B_OK
|
---|
120 | || (cpuInfo.eax_1.features & IA32_FEATURE_MSR) == 0)
|
---|
121 | return;
|
---|
122 |
|
---|
123 | #define IA32_FEATURE_MSR (1UL << 5) was added to
|
---|
124 | haiku/trunk/headers/private/kernel/arch/x86/arch_cpu.h
|
---|
125 |
|
---|
126 | First i separated completely, intel from
|
---|
127 | others, i did the following:
|
---|
128 | Index: generic_x86.cpp
|
---|
129 | ===================================================================
|
---|
130 | --- generic_x86.cpp (revision 19851)
|
---|
131 | +++ generic_x86.cpp (working copy)
|
---|
132 | @@ -181,7 +181,7 @@
|
---|
133 |
|
---|
134 | module_info *modules[] = {
|
---|
135 | (module_info *)&gIntelModule,
|
---|
136 | - (module_info *)&gAMDModule,
|
---|
137 | - (module_info *)&gVIAModule,
|
---|
138 | +// (module_info *)&gAMDModule,
|
---|
139 | +// (module_info *)&gVIAModule,
|
---|
140 | NULL
|
---|
141 | };
|
---|
142 |
|
---|
143 |
|
---|
144 | Index: Jamfile
|
---|
145 | ===================================================================
|
---|
146 | --- Jamfile (revision 19851)
|
---|
147 | +++ Jamfile (working copy)
|
---|
148 | @@ -4,7 +4,7 @@
|
---|
149 |
|
---|
150 | KernelAddon generic_x86 :
|
---|
151 | generic_x86.cpp
|
---|
152 | - amd.cpp
|
---|
153 | +# amd.cpp
|
---|
154 | intel.cpp
|
---|
155 | - via.cpp
|
---|
156 | +# via.cpp
|
---|
157 | ;
|
---|
158 |
|
---|
159 | RESULT:
|
---|
160 | the same stacktrace as previous.
|
---|
161 |
|
---|
162 | After some testings i find that function
|
---|
163 | generic_mtrr_compute_physical_mask() in intel.cpp is
|
---|
164 | executing successfully.
|
---|
165 | So, next i try to be sure that generic_dump_mtrrs
|
---|
166 | is executing successfully in intel.cpp:
|
---|
167 | [...]
|
---|
168 | - generic_dump_mtrrs(generic_count_mtrrs());
|
---|
169 | + generic_dump_mtrrs(0);
|
---|
170 | [...]
|
---|
171 | If i understood correctly we want
|
---|
172 | generic_count_mtrrs() returns 0 in the case
|
---|
173 | of a pentium mmx without mttrs.
|
---|
174 | Surprise!! even with generic_dump_mtrrs(0);
|
---|
175 | a got the same stacktrace.
|
---|
176 | So i focused in generic_dump_mtrrs (in generic_x86.cpp)
|
---|
177 | and did the following: (svn diff generic_x86.cpp > generic_x86.diff)
|
---|
178 |
|
---|
179 | Index: generic_x86.cpp
|
---|
180 | ===================================================================
|
---|
181 | --- generic_x86.cpp (revision 19851)
|
---|
182 | +++ generic_x86.cpp (working copy)
|
---|
183 | @@ -28,6 +28,7 @@
|
---|
184 | #define IA32_MTRR_ENABLE_FIXED (1UL << 10)
|
---|
185 | #define IA32_MTRR_VALID_RANGE (1UL << 11)
|
---|
186 |
|
---|
187 | +#define IA32_FEATURE_MSR (1UL << 5)
|
---|
188 |
|
---|
189 | struct mtrr_capabilities {
|
---|
190 | mtrr_capabilities(uint64 value) { *(uint64 *)this = value; }
|
---|
191 | @@ -48,7 +49,8 @@
|
---|
192 | {
|
---|
193 | cpuid_info cpuInfo;
|
---|
194 | if (get_current_cpuid(&cpuInfo, 1) != B_OK
|
---|
195 | - || (cpuInfo.eax_1.features & IA32_FEATURE_MTRR) == 0)
|
---|
196 | + || (cpuInfo.eax_1.features & IA32_FEATURE_MTRR) == 0
|
---|
197 | + || (cpuInfo.eax_1.features & IA32_FEATURE_MSR) == 0)
|
---|
198 | return 0;
|
---|
199 |
|
---|
200 | mtrr_capabilities
|
---|
201 | capabilities(x86_read_msr(IA32_MSR_MTRR_CAPABILITIES));
|
---|
202 | @@ -160,6 +162,13 @@
|
---|
203 | void
|
---|
204 | generic_dump_mtrrs(uint32 count)
|
---|
205 | {
|
---|
206 | +
|
---|
207 | + cpuid_info cpuInfo;
|
---|
208 | + if (get_current_cpuid(&cpuInfo, 1) != B_OK
|
---|
209 | + || (cpuInfo.eax_1.features & IA32_FEATURE_MTRR) == 0
|
---|
210 | + || (cpuInfo.eax_1.features & IA32_FEATURE_MSR) == 0)
|
---|
211 | + return;
|
---|
212 | +
|
---|
213 | if (x86_read_msr(IA32_MSR_MTRR_DEFAULT_TYPE) & IA32_MTRR_ENABLE) {
|
---|
214 | TRACE(("MTRR enabled\n"));
|
---|
215 | } else {
|
---|
216 | @@ -181,7 +190,7 @@
|
---|
217 |
|
---|
218 | module_info *modules[] = {
|
---|
219 | (module_info *)&gIntelModule,
|
---|
220 | - (module_info *)&gAMDModule,
|
---|
221 | - (module_info *)&gVIAModule,
|
---|
222 | +// (module_info *)&gAMDModule,
|
---|
223 | +// (module_info *)&gVIAModule,
|
---|
224 | NULL
|
---|
225 | };
|
---|
226 |
|
---|
227 | RESULT: the module is loaded successfully.
|
---|
228 | I think indeed generic_count_mtrrs() returns 0
|
---|
229 | and generic_dump_mtrrs returns immediately after the if
|
---|
230 | statement. The problem was indeed the execution of
|
---|
231 | x86_read_msr in generic_dump_mtrrs.
|
---|