From 9ecaa867f7ba62d9edf0b192aba4b809b9de0d82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 22 Jan 2007 14:45:50 +0000 Subject: [PATCH] Applied patch by Vasilis Kaoutsis: now checks for the MSR feature as well; obviously some Pentium 200 MMX pretend to support MTRRs. This should fix bug #553. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19899 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/arch/x86/arch_cpu.h | 1 + src/add-ons/kernel/cpu/x86/generic_x86.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/headers/private/kernel/arch/x86/arch_cpu.h b/headers/private/kernel/arch/x86/arch_cpu.h index 8796f690a4..bda8b3bee4 100644 --- a/headers/private/kernel/arch/x86/arch_cpu.h +++ b/headers/private/kernel/arch/x86/arch_cpu.h @@ -22,6 +22,7 @@ #define IA32_MSR_MTRR_PHYSICAL_MASK_0 0x201 // cpuid eax 1 features +#define IA32_FEATURE_MSR (1UL << 5) #define IA32_FEATURE_MTRR (1UL << 12) #define IA32_FEATURE_GLOBAL_PAGES (1UL << 13) #define IA32_FEATURE_SSE (1UL << 25) diff --git a/src/add-ons/kernel/cpu/x86/generic_x86.cpp b/src/add-ons/kernel/cpu/x86/generic_x86.cpp index 11bb1038fc..05373d674c 100644 --- a/src/add-ons/kernel/cpu/x86/generic_x86.cpp +++ b/src/add-ons/kernel/cpu/x86/generic_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2005-2006, Haiku, Inc. + * Copyright 2005-2007, Haiku, Inc. * Distributed under the terms of the MIT License. * * Authors: @@ -48,7 +48,8 @@ generic_count_mtrrs(void) { cpuid_info cpuInfo; if (get_current_cpuid(&cpuInfo, 1) != B_OK - || (cpuInfo.eax_1.features & IA32_FEATURE_MTRR) == 0) + || (cpuInfo.eax_1.features & IA32_FEATURE_MTRR) == 0 + || (cpuInfo.eax_1.features & IA32_FEATURE_MSR) == 0) return 0; mtrr_capabilities capabilities(x86_read_msr(IA32_MSR_MTRR_CAPABILITIES)); @@ -160,6 +161,9 @@ generic_mtrr_compute_physical_mask(void) void generic_dump_mtrrs(uint32 count) { + if (count == 0) + return; + if (x86_read_msr(IA32_MSR_MTRR_DEFAULT_TYPE) & IA32_MTRR_ENABLE) { TRACE(("MTRR enabled\n")); } else {