cstart: do not assume CR4 starts as zero
The BIOS might leave some bits set in CR4; for example, CR4.DE=1 would
cause the SVM test for the DR intercept to fail, because DR4/DR5
can only be written when CR4.DE is clear, and otherwise trigger
a #GP exception.
Reported-by: Nadav Amit <namit@vmware.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/x86/cstart.S b/x86/cstart.S
index 409cb00..e63e4e2 100644
--- a/x86/cstart.S
+++ b/x86/cstart.S
@@ -125,8 +125,7 @@
jmpl $8, $start32
prepare_32:
- mov %cr4, %eax
- bts $4, %eax // pse
+ mov %(1 << 4), %eax // pse
mov %eax, %cr4
mov $pt, %eax
diff --git a/x86/cstart64.S b/x86/cstart64.S
index fabcdbf..3ae98d3 100644
--- a/x86/cstart64.S
+++ b/x86/cstart64.S
@@ -176,8 +176,7 @@
setup_segments
enter_long_mode:
- mov %cr4, %eax
- bts $5, %eax // pae
+ mov $(1 << 5), %eax // pae
mov %eax, %cr4
mov pt_root, %eax