qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [COMMIT ccd59d0] target-i386: add lock mov cr0 = cr8


From: Anthony Liguori
Subject: [Qemu-commits] [COMMIT ccd59d0] target-i386: add lock mov cr0 = cr8
Date: Sun, 04 Oct 2009 12:10:03 -0000

From: Andre Przywara <address@hidden>

AMD CPUs featuring a shortcut to access CR8 even from 32-bit mode.
If you use the LOCK prefix with "mov CR0", it accesses CR8 instead.
This behavior is guarded by the CR8_LEGACY CPUID bit
(Fn8000_0001:ECX[1]).

Signed-off-by: Andre Przywara <address@hidden>
Signed-off-by: Aurelien Jarno <address@hidden>

diff --git a/target-i386/translate.c b/target-i386/translate.c
index 5b11d7f..0f62a97 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -7351,6 +7351,10 @@ static target_ulong disas_insn(DisasContext *s, 
target_ulong pc_start)
                 ot = OT_QUAD;
             else
                 ot = OT_LONG;
+            if ((prefixes & PREFIX_LOCK) && (reg == 0) &&
+                (s->cpuid_ext3_features & CPUID_EXT3_CR8LEG)) {
+                reg = 8;
+            }
             switch(reg) {
             case 0:
             case 2:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]