Ticket #553: shortInfo.txt

File shortInfo.txt, 6.3 KB (added by kaoutsis, 17 years ago)

Added a short info regarding the possible fix

Line 
1Jérôme had the idea checking if MSR bit is active before using
2msr_read/msr_write in generic_x86.cpp
3
4if (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
9haiku/trunk/headers/private/kernel/arch/x86/arch_cpu.h
10
11First i separated completely, intel from
12others, i did the following:
13Index: 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
29Index: 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
44RESULT:
45the same stacktrace as previous.
46
47After some testings i find that function
48generic_mtrr_compute_physical_mask() in intel.cpp is
49executing successfully.
50So, next i try to be sure that generic_dump_mtrrs
51is executing successfully in intel.cpp:
52[...]
53- generic_dump_mtrrs(generic_count_mtrrs());
54+ generic_dump_mtrrs(0);
55[...]
56If i understood correctly we want
57generic_count_mtrrs() returns 0 in the case
58of a pentium mmx without mttrs.
59Surprise!! even with generic_dump_mtrrs(0);
60a got the same stacktrace.
61So i focused in generic_dump_mtrrs (in generic_x86.cpp)
62and did the following: (svn diff generic_x86.cpp > generic_x86.diff)
63
64Index: 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
86capabilities(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
112RESULT: the module is loaded successfully.
113I think indeed generic_count_mtrrs() returns 0
114and generic_dump_mtrrs returns immediately after the if
115statement. The problem was indeed the execution of
116x86_read_msr in generic_dump_mtrrs.Jérôme had the idea checking if MSR bit is active before using
117msr_read/msr_write in generic_x86.cpp
118
119if (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
124haiku/trunk/headers/private/kernel/arch/x86/arch_cpu.h
125
126First i separated completely, intel from
127others, i did the following:
128Index: 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
144Index: 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
159RESULT:
160the same stacktrace as previous.
161
162After some testings i find that function
163generic_mtrr_compute_physical_mask() in intel.cpp is
164executing successfully.
165So, next i try to be sure that generic_dump_mtrrs
166is executing successfully in intel.cpp:
167[...]
168- generic_dump_mtrrs(generic_count_mtrrs());
169+ generic_dump_mtrrs(0);
170[...]
171If i understood correctly we want
172generic_count_mtrrs() returns 0 in the case
173of a pentium mmx without mttrs.
174Surprise!! even with generic_dump_mtrrs(0);
175a got the same stacktrace.
176So i focused in generic_dump_mtrrs (in generic_x86.cpp)
177and did the following: (svn diff generic_x86.cpp > generic_x86.diff)
178
179Index: 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
201capabilities(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
227RESULT: the module is loaded successfully.
228I think indeed generic_count_mtrrs() returns 0
229and generic_dump_mtrrs returns immediately after the if
230statement. The problem was indeed the execution of
231x86_read_msr in generic_dump_mtrrs.