[PATCH v2 2/5] target/hppa: Remove unnecessary @cpu variable by using cpu_env()

Philippe Mathieu-Daudé posted 5 patches 1 week, 1 day ago
Maintainers: Laurent Vivier <laurent@vivier.eu>, Richard Henderson <richard.henderson@linaro.org>, Helge Deller <deller@gmx.de>
[PATCH v2 2/5] target/hppa: Remove unnecessary @cpu variable by using cpu_env()
Posted by Philippe Mathieu-Daudé 1 week, 1 day ago
Partly revert changes introduced by commit b2c2d00f48c ("target/hppa:
add 64 bit support to gdbstub"), restoring the cpu_env() call and
removing the unused @cpu argument.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/hppa/gdbstub.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/target/hppa/gdbstub.c b/target/hppa/gdbstub.c
index 777f4a48b99..0c5e41410a0 100644
--- a/target/hppa/gdbstub.c
+++ b/target/hppa/gdbstub.c
@@ -33,8 +33,7 @@ static int hppa_reg_size(CPUHPPAState *env)
 
 int hppa_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
 {
-    HPPACPU *cpu = HPPA_CPU(cs);
-    CPUHPPAState *env = &cpu->env;
+    CPUHPPAState *env = cpu_env(cs);
     target_ulong val;
 
     if (n >= hppa_num_regs(env)) {
@@ -162,8 +161,7 @@ int hppa_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
 
 int hppa_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
 {
-    HPPACPU *cpu = HPPA_CPU(cs);
-    CPUHPPAState *env = &cpu->env;
+    CPUHPPAState *env = cpu_env(cs);
     target_ulong val;
 
     if (n >= hppa_num_regs(env)) {
-- 
2.52.0


Re: [PATCH v2 2/5] target/hppa: Remove unnecessary @cpu variable by using cpu_env()
Posted by Richard Henderson 2 days, 6 hours ago
On 12/30/25 09:55, Philippe Mathieu-Daudé wrote:
> Partly revert changes introduced by commit b2c2d00f48c ("target/hppa:
> add 64 bit support to gdbstub"), restoring the cpu_env() call and
> removing the unused @cpu argument.
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   target/hppa/gdbstub.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~

Re: [PATCH v2 2/5] target/hppa: Remove unnecessary @cpu variable by using cpu_env()
Posted by Manos Pitsidianakis 1 week, 1 day ago
On Tue, Dec 30, 2025 at 12:55 AM Philippe Mathieu-Daudé
<philmd@linaro.org> wrote:
>
> Partly revert changes introduced by commit b2c2d00f48c ("target/hppa:
> add 64 bit support to gdbstub"), restoring the cpu_env() call and
> removing the unused @cpu argument.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>

>  target/hppa/gdbstub.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/target/hppa/gdbstub.c b/target/hppa/gdbstub.c
> index 777f4a48b99..0c5e41410a0 100644
> --- a/target/hppa/gdbstub.c
> +++ b/target/hppa/gdbstub.c
> @@ -33,8 +33,7 @@ static int hppa_reg_size(CPUHPPAState *env)
>
>  int hppa_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
>  {
> -    HPPACPU *cpu = HPPA_CPU(cs);
> -    CPUHPPAState *env = &cpu->env;
> +    CPUHPPAState *env = cpu_env(cs);
>      target_ulong val;
>
>      if (n >= hppa_num_regs(env)) {
> @@ -162,8 +161,7 @@ int hppa_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
>
>  int hppa_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
>  {
> -    HPPACPU *cpu = HPPA_CPU(cs);
> -    CPUHPPAState *env = &cpu->env;
> +    CPUHPPAState *env = cpu_env(cs);
>      target_ulong val;
>
>      if (n >= hppa_num_regs(env)) {
> --
> 2.52.0
>