Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142606752
D48331.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
995 B
Referenced Files
None
Subscribers
None
D48331.diff
View Options
diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c
--- a/sys/x86/x86/tsc.c
+++ b/sys/x86/x86/tsc.c
@@ -212,10 +212,24 @@
memcpy(p, regs, sizeof(regs));
p += sizeof(regs);
}
+
+ /*
+ * Begin the search at &brand[5]: we currently expect no less
+ * than four digits for the frequency and either M/G/T modifier
+ * beforehand. See Figure 3-10, "Algorithm for Extracting
+ * Processor Frequency," in the above-noted document.
+ *
+ * Note that this may be inaccurate in some corner cases.
+ * Future work might consider scanning backward for a space
+ * instead and doing digit calculations from there as depicted
+ * in the algorithm described to future-proof it, in case more
+ * or fewer digits are used in the frequency description.
+ */
p = NULL;
- for (i = 0; i < sizeof(brand) - 1; i++)
+ for (i = 5; i < sizeof(brand) - 1; i++)
if (brand[i] == 'H' && brand[i + 1] == 'z')
p = brand + i;
+
if (p != NULL) {
p -= 5;
switch (p[4]) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 22, 11:27 AM (4 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27844225
Default Alt Text
D48331.diff (995 B)
Attached To
Mode
D48331: x86: tsc: more resilient cpuid parsing
Attached
Detach File
Event Timeline
Log In to Comment