From 96b24aef3f26ba0e78de7524ad8334cc8537f25a Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 13 Jun 2009 11:35:57 +0000 Subject: [PATCH] When clearing the MTRRs also set the default type to uncacheable. Otherwise on systems where the default is set to a cachable type and MTRRs are used to define the uncacheable areas, everything would become cacheable after clearing them. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31026 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/cpu/x86/generic_x86.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/cpu/x86/generic_x86.cpp b/src/add-ons/kernel/cpu/x86/generic_x86.cpp index de300b0ce9..253f5a0c5a 100644 --- a/src/add-ons/kernel/cpu/x86/generic_x86.cpp +++ b/src/add-ons/kernel/cpu/x86/generic_x86.cpp @@ -101,8 +101,12 @@ generic_init_mtrrs(uint32 count) // but turn on variable MTRR functionality + // we need to ensure that the default type is uncacheable, otherwise + // clearing the mtrrs could result in ranges that aren't supposed to be + // cacheable to become cacheable due to the default type + x86_write_msr(IA32_MSR_MTRR_DEFAULT_TYPE, - x86_read_msr(IA32_MSR_MTRR_DEFAULT_TYPE) | IA32_MTRR_ENABLE); + (x86_read_msr(IA32_MSR_MTRR_DEFAULT_TYPE) & ~0xff) | IA32_MTRR_ENABLE); }