All of lore.kernel.org
 help / color / mirror / Atom feed
From: TeLeMan <geleman@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH]SVM CR8 undefined bug fix
Date: Thu, 17 Jan 2008 07:34:45 -0800 (PST)	[thread overview]
Message-ID: <14921864.post@talk.nabble.com> (raw)


env->cr[8] used by SVM codes was not defined.

http://www.nabble.com/file/p14921864/svm_cr8.patch svm_cr8.patch: 

diff -p -u qemu.orig/target-i386/cpu.h qemu/target-i386/cpu.h
--- qemu.orig/target-i386/cpu.h	Mon Jan 14 11:11:08 2008
+++ qemu/target-i386/cpu.h	Thu Jan 17 23:21:22 2008
@@ -493,7 +493,7 @@ typedef struct CPUX86State {
     SegmentCache gdt; /* only base and limit are used */
     SegmentCache idt; /* only base and limit are used */
 
-    target_ulong cr[5]; /* NOTE: cr1 is unused */
+    target_ulong cr[9]; /* NOTE: cr1,cr5-cr7 are unused */
     uint32_t a20_mask;
 
     /* FPU state */
diff -p -u qemu.orig/target-i386/helper.c qemu/target-i386/helper.c
--- qemu.orig/target-i386/helper.c	Mon Jan 14 11:11:08 2008
+++ qemu/target-i386/helper.c	Thu Jan 17 23:24:04 2008
@@ -2718,6 +2718,7 @@ void helper_movl_crN_T0(int reg)
         break;
     case 8:
         cpu_set_apic_tpr(env, T0);
+        env->cr[8] = T0;
         break;
     default:
         env->cr[reg] = T0;
@@ -4065,6 +4066,7 @@ void helper_vmrun(target_ulong addr)
     int_ctl = ldl_phys(env->vm_vmcb + offsetof(struct vmcb,
control.int_ctl));
     if (int_ctl & V_INTR_MASKING_MASK) {
         env->cr[8] = int_ctl & V_TPR_MASK;
+	cpu_set_apic_tpr(env,env->cr[8]);
         if (env->eflags & IF_MASK)
             env->hflags |= HF_HIF_MASK;
     }
@@ -4376,8 +4378,10 @@ void vmexit(uint64_t exit_code, uint64_t
     cpu_x86_update_cr0(env, ldq_phys(env->vm_hsave + offsetof(struct vmcb,
save.cr0)) | CR0_PE_MASK);
     cpu_x86_update_cr4(env, ldq_phys(env->vm_hsave + offsetof(struct vmcb,
save.cr4)));
     cpu_x86_update_cr3(env, ldq_phys(env->vm_hsave + offsetof(struct vmcb,
save.cr3)));
-    if (int_ctl & V_INTR_MASKING_MASK)
+    if (int_ctl & V_INTR_MASKING_MASK) {
         env->cr[8] = ldq_phys(env->vm_hsave + offsetof(struct vmcb,
save.cr8));
+        cpu_set_apic_tpr(env,env->cr[8]);
+    }
     /* we need to set the efer after the crs so the hidden flags get set
properly */
 #ifdef TARGET_X86_64
     env->efer  = ldq_phys(env->vm_hsave + offsetof(struct vmcb,
save.efer));

-- 
View this message in context: http://www.nabble.com/-PATCH-SVM-CR8-undefined-bug-fix-tp14921864p14921864.html
Sent from the QEMU - Dev mailing list archive at Nabble.com.

             reply	other threads:[~2008-01-17 15:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-17 15:34 TeLeMan [this message]
2008-01-17 15:52 ` [Qemu-devel] [PATCH]SVM CR8 undefined bug fix Alexander Graf
2008-01-17 15:57   ` Robert William Fuller
2008-01-17 16:13     ` Alexander Graf
2008-01-17 17:37       ` Bernhard Kauer
2008-02-03  2:45   ` andrzej zaborowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14921864.post@talk.nabble.com \
    --to=geleman@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.