qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 2/4] TCG x86: add lock mov cr0 = cr8


From: Andre Przywara
Subject: [Qemu-devel] [PATCH 2/4] TCG x86: add lock mov cr0 = cr8
Date: Sat, 19 Sep 2009 00:30:47 +0200

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>
---
 target-i386/translate.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/target-i386/translate.c b/target-i386/translate.c
index aaa4492..134c870 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -7362,6 +7362,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:
-- 
1.6.1.3






reply via email to

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