diff mbox series

target/i386: hax: Move hax_setup_qemu_emulator.

Message ID 20180110064706.49777-1-lepton@google.com
State New
Headers show
Series target/i386: hax: Move hax_setup_qemu_emulator. | expand

Commit Message

Cameron Esfahani via Jan. 10, 2018, 6:47 a.m. UTC
hax_setup_qemu_emulator reference env->efer which is updated in
hax_get_msrs, so it has to be called after hax_get_msrs. This fix
the bug that sometimes dump_state show 32 bits regs even in 64 bits
mode.

Signed-off-by: Tao Wu <lepton@google.com>
---
 target/i386/hax-all.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Paolo Bonzini Jan. 10, 2018, 1:27 p.m. UTC | #1
On 10/01/2018 07:47, Tao Wu wrote:
> hax_setup_qemu_emulator reference env->efer which is updated in
> hax_get_msrs, so it has to be called after hax_get_msrs. This fix
> the bug that sometimes dump_state show 32 bits regs even in 64 bits
> mode.
> 
> Signed-off-by: Tao Wu <lepton@google.com>
> ---
>  target/i386/hax-all.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c
> index 3ce6950296..a933bd462d 100644
> --- a/target/i386/hax-all.c
> +++ b/target/i386/hax-all.c
> @@ -887,9 +887,6 @@ static int hax_sync_vcpu_register(CPUArchState *env, int set)
>              return -1;
>          }
>      }
> -    if (!set) {
> -        hax_setup_qemu_emulator(env);
> -    }
>      return 0;
>  }
>  
> @@ -1070,6 +1067,7 @@ static int hax_arch_get_registers(CPUArchState *env)
>          return ret;
>      }
>  
> +    hax_setup_qemu_emulator(env);
>      return 0;
>  }
>  
> 

Queued, thanks.

Please look into sharing the similar code in target/i386/kvm.c
(kvm_get_sregs), since the HAX code has some bugs (for example,
HF_CPL_MASK should be SS.DPL, not CS.DPL).

Paolo
Cameron Esfahani via Jan. 10, 2018, 6:05 p.m. UTC | #2
Thanks. Then it seems I should put this piece of code in a common
function first and then update this CL.

On Wed, Jan 10, 2018 at 5:27 AM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> On 10/01/2018 07:47, Tao Wu wrote:
>> hax_setup_qemu_emulator reference env->efer which is updated in
>> hax_get_msrs, so it has to be called after hax_get_msrs. This fix
>> the bug that sometimes dump_state show 32 bits regs even in 64 bits
>> mode.
>>
>> Signed-off-by: Tao Wu <lepton@google.com>
>> ---
>>  target/i386/hax-all.c | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c
>> index 3ce6950296..a933bd462d 100644
>> --- a/target/i386/hax-all.c
>> +++ b/target/i386/hax-all.c
>> @@ -887,9 +887,6 @@ static int hax_sync_vcpu_register(CPUArchState *env, int set)
>>              return -1;
>>          }
>>      }
>> -    if (!set) {
>> -        hax_setup_qemu_emulator(env);
>> -    }
>>      return 0;
>>  }
>>
>> @@ -1070,6 +1067,7 @@ static int hax_arch_get_registers(CPUArchState *env)
>>          return ret;
>>      }
>>
>> +    hax_setup_qemu_emulator(env);
>>      return 0;
>>  }
>>
>>
>
> Queued, thanks.
>
> Please look into sharing the similar code in target/i386/kvm.c
> (kvm_get_sregs), since the HAX code has some bugs (for example,
> HF_CPL_MASK should be SS.DPL, not CS.DPL).
>
> Paolo
diff mbox series

Patch

diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c
index 3ce6950296..a933bd462d 100644
--- a/target/i386/hax-all.c
+++ b/target/i386/hax-all.c
@@ -887,9 +887,6 @@  static int hax_sync_vcpu_register(CPUArchState *env, int set)
             return -1;
         }
     }
-    if (!set) {
-        hax_setup_qemu_emulator(env);
-    }
     return 0;
 }
 
@@ -1070,6 +1067,7 @@  static int hax_arch_get_registers(CPUArchState *env)
         return ret;
     }
 
+    hax_setup_qemu_emulator(env);
     return 0;
 }