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

Philippe Mathieu-Daudé posted 1 patch 1 year, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230210125700.13474-1-philmd@linaro.org
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Eduardo Habkost <eduardo@habkost.net>
target/i386/tcg/sysemu/misc_helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] target/i386: Remove pointless env_archcpu() in helper_rdmsr()
Posted by Philippe Mathieu-Daudé 1 year, 2 months ago
We have a X86CPU *cpu pointer available at the start of the function.

Inspired-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/i386/tcg/sysemu/misc_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/i386/tcg/sysemu/misc_helper.c b/target/i386/tcg/sysemu/misc_helper.c
index e1528b7f80..e47db9376e 100644
--- a/target/i386/tcg/sysemu/misc_helper.c
+++ b/target/i386/tcg/sysemu/misc_helper.c
@@ -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.38.1


Re: [PATCH] target/i386: Remove pointless env_archcpu() in helper_rdmsr()
Posted by Philippe Mathieu-Daudé 1 year, 2 months ago
ping

On 10/2/23 13:57, Philippe Mathieu-Daudé wrote:
> We have a X86CPU *cpu pointer available at the start of the function.
> 
> Inspired-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   target/i386/tcg/sysemu/misc_helper.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/i386/tcg/sysemu/misc_helper.c b/target/i386/tcg/sysemu/misc_helper.c
> index e1528b7f80..e47db9376e 100644
> --- a/target/i386/tcg/sysemu/misc_helper.c
> +++ b/target/i386/tcg/sysemu/misc_helper.c
> @@ -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;


Re: [PATCH] target/i386: Remove pointless env_archcpu() in helper_rdmsr()
Posted by Daniel Henrique Barboza 1 year, 2 months ago

On 2/10/23 09:57, Philippe Mathieu-Daudé wrote:
> We have a X86CPU *cpu pointer available at the start of the function.
> 
> Inspired-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---

Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>


>   target/i386/tcg/sysemu/misc_helper.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/i386/tcg/sysemu/misc_helper.c b/target/i386/tcg/sysemu/misc_helper.c
> index e1528b7f80..e47db9376e 100644
> --- a/target/i386/tcg/sysemu/misc_helper.c
> +++ b/target/i386/tcg/sysemu/misc_helper.c
> @@ -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;