diff mbox

[kvm-unit-tests,RFC,01/10] x86: vm: Remove virt_to_phys() on CR3 initialization

Message ID 1483288652-18983-2-git-send-email-agordeev@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alexander Gordeev Jan. 1, 2017, 4:37 p.m. UTC
CR3 register is initialized when no paging is yet enabled.
Therefore, translation with virt_to_phys() is erroneous.

Cc: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
---
 lib/x86/vm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/lib/x86/vm.c b/lib/x86/vm.c
index cda4c5f46da3..362497cfa341 100644
--- a/lib/x86/vm.c
+++ b/lib/x86/vm.c
@@ -137,7 +137,7 @@  static void setup_mmu(unsigned long len)
     vfree_top = (void*)(3ul << 30);
 #endif
 
-    write_cr3(virt_to_phys(cr3));
+    write_cr3((unsigned long)cr3);
 #ifndef __x86_64__
     write_cr4(X86_CR4_PSE);
 #endif