diff mbox series

[1/7] KVM: i386: Use symbolic constant for #DB/#BP exception constants

Message ID 20190615004256.16367-2-pbonzini@redhat.com
State New
Headers show
Series target-i386/kvm: live migration support for nested VMX | expand

Commit Message

Paolo Bonzini June 15, 2019, 12:42 a.m. UTC
From: Liran Alon <liran.alon@oracle.com>

Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/kvm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Liran Alon June 15, 2019, 12:46 a.m. UTC | #1
> On 15 Jun 2019, at 3:42, Paolo Bonzini <pbonzini@redhat.com> wrote:
> 
> From: Liran Alon <liran.alon@oracle.com>
> 
> Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
> Signed-off-by: Liran Alon <liran.alon@oracle.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> target/i386/kvm.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> index 3b29ce5c0d..c8d8196e71 100644
> --- a/target/i386/kvm.c
> +++ b/target/i386/kvm.c
> @@ -2994,9 +2994,9 @@ static int kvm_guest_debug_workarounds(X86CPU *cpu)
>     unsigned long reinject_trap = 0;
> 
>     if (!kvm_has_vcpu_events()) {
> -        if (env->exception_injected == 1) {
> +        if (env->exception_injected == EXCP01_DB) {
>             reinject_trap = KVM_GUESTDBG_INJECT_DB;
> -        } else if (env->exception_injected == 3) {
> +        } else if (env->exception_injected == EXCP03_INT3) {
>             reinject_trap = KVM_GUESTDBG_INJECT_BP;
>         }
>         env->exception_injected = -1;
> @@ -3508,7 +3508,7 @@ static int kvm_handle_debug(X86CPU *cpu,
>     int ret = 0;
>     int n;
> 
> -    if (arch_info->exception == 1) {
> +    if (arch_info->exception == EXCP01_DB) {
>         if (arch_info->dr6 & (1 << 14)) {

Note: In the patch-series I will submit, I also replaced this “1 << 14” with DR6_BS.

>             if (cs->singlestep_enabled) {
>                 ret = EXCP_DEBUG;
> -- 
> 2.21.0
> 
>
diff mbox series

Patch

diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 3b29ce5c0d..c8d8196e71 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -2994,9 +2994,9 @@  static int kvm_guest_debug_workarounds(X86CPU *cpu)
     unsigned long reinject_trap = 0;
 
     if (!kvm_has_vcpu_events()) {
-        if (env->exception_injected == 1) {
+        if (env->exception_injected == EXCP01_DB) {
             reinject_trap = KVM_GUESTDBG_INJECT_DB;
-        } else if (env->exception_injected == 3) {
+        } else if (env->exception_injected == EXCP03_INT3) {
             reinject_trap = KVM_GUESTDBG_INJECT_BP;
         }
         env->exception_injected = -1;
@@ -3508,7 +3508,7 @@  static int kvm_handle_debug(X86CPU *cpu,
     int ret = 0;
     int n;
 
-    if (arch_info->exception == 1) {
+    if (arch_info->exception == EXCP01_DB) {
         if (arch_info->dr6 & (1 << 14)) {
             if (cs->singlestep_enabled) {
                 ret = EXCP_DEBUG;