From eb8c20f6c59e2dc22ec1f498c02c26903a30d2a2 Mon Sep 17 00:00:00 2001 From: CleverMouse Date: Wed, 16 Nov 2016 18:24:32 +0000 Subject: [PATCH] don't set_mtrr if only fixed MTRRs exist; fixes triple fault in VirtualBox on some CPUs git-svn-id: svn://kolibrios.org@6721 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/core/mtrr.inc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kernel/trunk/core/mtrr.inc b/kernel/trunk/core/mtrr.inc index 5335011708..eda74474fb 100644 --- a/kernel/trunk/core/mtrr.inc +++ b/kernel/trunk/core/mtrr.inc @@ -764,6 +764,10 @@ proc set_mtrr stdcall, base:dword,size:dword,mem_type:dword ; find unused register mov ecx, 0x201 .scan: + mov eax, [num_variable_mtrrs] + lea eax, [0x200+eax*2] + cmp ecx, eax + jae .ret rdmsr dec ecx test ah, 8 @@ -776,10 +780,7 @@ proc set_mtrr stdcall, base:dword,size:dword,mem_type:dword jz .ret @@: add ecx, 3 - mov eax, [num_variable_mtrrs] - lea eax, [0x200+eax*2] - cmp ecx, eax - jb .scan + jmp .scan ; no free registers, ignore the call .ret: ret