Re: [PATCH] target/i386: Fixed size of constant for Windows

2021-08-12 Thread Paolo Bonzini

On 12/08/21 13:10, Lara Lazier wrote:

~0UL has 64 bits on Linux and 32 bits on Windows.
Fixes: https://gitlab.com/qemu-project/qemu/-/issues/512;.

Reported-by: Volker RĂ¼melin 
Signed-off-by: Lara Lazier 
---
  target/i386/tcg/sysemu/misc_helper.c | 2 +-
  target/i386/tcg/sysemu/svm_helper.c  | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/i386/tcg/sysemu/misc_helper.c 
b/target/i386/tcg/sysemu/misc_helper.c
index 0a7a58ca9a..91b0fc916b 100644
--- a/target/i386/tcg/sysemu/misc_helper.c
+++ b/target/i386/tcg/sysemu/misc_helper.c
@@ -97,7 +97,7 @@ void helper_write_crN(CPUX86State *env, int reg, target_ulong 
t0)
  break;
  case 3:
  if ((env->efer & MSR_EFER_LMA) &&
-(t0 & ((~0UL) << env_archcpu(env)->phys_bits))) {
+(t0 & ((~0ULL) << env_archcpu(env)->phys_bits))) {
  cpu_vmexit(env, SVM_EXIT_ERR, 0, GETPC());
  }
  if (!(env->efer & MSR_EFER_LMA)) {
diff --git a/target/i386/tcg/sysemu/svm_helper.c 
b/target/i386/tcg/sysemu/svm_helper.c
index 3891f4e4a8..42cd5053e5 100644
--- a/target/i386/tcg/sysemu/svm_helper.c
+++ b/target/i386/tcg/sysemu/svm_helper.c
@@ -290,7 +290,7 @@ void helper_vmrun(CPUX86State *env, int aflag, int 
next_eip_addend)
  }
  new_cr3 = x86_ldq_phys(cs, env->vm_vmcb + offsetof(struct vmcb, 
save.cr3));
  if ((env->efer & MSR_EFER_LMA) &&
-(new_cr3 & ((~0UL) << cpu->phys_bits))) {
+(new_cr3 & ((~0ULL) << cpu->phys_bits))) {
  cpu_vmexit(env, SVM_EXIT_ERR, 0, GETPC());
  }
  new_cr4 = x86_ldq_phys(cs, env->vm_vmcb + offsetof(struct vmcb, 
save.cr4));



Queued, thanks.

Paolo




[PATCH] target/i386: Fixed size of constant for Windows

2021-08-12 Thread Lara Lazier
~0UL has 64 bits on Linux and 32 bits on Windows.
Fixes: https://gitlab.com/qemu-project/qemu/-/issues/512;.

Reported-by: Volker RĂ¼melin 
Signed-off-by: Lara Lazier 
---
 target/i386/tcg/sysemu/misc_helper.c | 2 +-
 target/i386/tcg/sysemu/svm_helper.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/i386/tcg/sysemu/misc_helper.c 
b/target/i386/tcg/sysemu/misc_helper.c
index 0a7a58ca9a..91b0fc916b 100644
--- a/target/i386/tcg/sysemu/misc_helper.c
+++ b/target/i386/tcg/sysemu/misc_helper.c
@@ -97,7 +97,7 @@ void helper_write_crN(CPUX86State *env, int reg, target_ulong 
t0)
 break;
 case 3:
 if ((env->efer & MSR_EFER_LMA) &&
-(t0 & ((~0UL) << env_archcpu(env)->phys_bits))) {
+(t0 & ((~0ULL) << env_archcpu(env)->phys_bits))) {
 cpu_vmexit(env, SVM_EXIT_ERR, 0, GETPC());
 }
 if (!(env->efer & MSR_EFER_LMA)) {
diff --git a/target/i386/tcg/sysemu/svm_helper.c 
b/target/i386/tcg/sysemu/svm_helper.c
index 3891f4e4a8..42cd5053e5 100644
--- a/target/i386/tcg/sysemu/svm_helper.c
+++ b/target/i386/tcg/sysemu/svm_helper.c
@@ -290,7 +290,7 @@ void helper_vmrun(CPUX86State *env, int aflag, int 
next_eip_addend)
 }
 new_cr3 = x86_ldq_phys(cs, env->vm_vmcb + offsetof(struct vmcb, save.cr3));
 if ((env->efer & MSR_EFER_LMA) &&
-(new_cr3 & ((~0UL) << cpu->phys_bits))) {
+(new_cr3 & ((~0ULL) << cpu->phys_bits))) {
 cpu_vmexit(env, SVM_EXIT_ERR, 0, GETPC());
 }
 new_cr4 = x86_ldq_phys(cs, env->vm_vmcb + offsetof(struct vmcb, save.cr4));
-- 
2.25.1