Skip to contentSkip to conversation

target/i386: Remove pointless env_archcpu() in helper_rdmsr()

PATCH In review Philippe Mathieu-Daudé 2 participants 3 messages Feb 10, 2023 – Feb 23, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/i386: Remove pointless env_archcpu() in helper_rdmsr()

We have a X86CPU *cpu pointer available at the start of the function.

---
 target/i386/tcg/sysemu/misc_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/i386/tcg/sysemu/misc_helper.c +1 -1
index e1528b7f80..e47db9376e 100644
@@ -326,7 +326,7 @@ void helper_rdmsr(CPUX86State *env)
         val = env->sysenter_eip;
         break;
     case MSR_IA32_APICBASE:
-        val = cpu_get_apic_base(env_archcpu(env)->apic_state);
+        val = cpu_get_apic_base(x86_cpu->apic_state);
         break;
     case MSR_EFER:
         val = env->efer;
Signature · 1 line
2.38.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Philippe Mathieu-Daudé

We have a X86CPU *cpu pointer available at the start of the function.

---

Quoted 16 lines
  target/i386/tcg/sysemu/misc_helper.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
target/i386/tcg/sysemu/misc_helper.c +1 -1
index e1528b7f80..e47db9376e 100644
@@ -326,7 +326,7 @@ void helper_rdmsr(CPUX86State *env)
          val = env->sysenter_eip;
          break;
      case MSR_IA32_APICBASE:
-        val = cpu_get_apic_base(env_archcpu(env)->apic_state);
+        val = cpu_get_apic_base(x86_cpu->apic_state);
          break;
      case MSR_EFER:
          val = env->efer;
#2 lore raw
In reply to Philippe Mathieu-Daudé

ping

Quoted 21 lines · Philippe Mathieu-Daudé

We have a X86CPU *cpu pointer available at the start of the function.

---
  target/i386/tcg/sysemu/misc_helper.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
target/i386/tcg/sysemu/misc_helper.c +1 -1
index e1528b7f80..e47db9376e 100644
@@ -326,7 +326,7 @@ void helper_rdmsr(CPUX86State *env)
          val = env->sysenter_eip;
          break;
      case MSR_IA32_APICBASE:
-        val = cpu_get_apic_base(env_archcpu(env)->apic_state);
+        val = cpu_get_apic_base(x86_cpu->apic_state);
          break;
      case MSR_EFER:
          val = env->efer;