diff mbox series

[4/5] target/s390x: Use s390_cpu_{set_psw, get_psw_mask} in gdbstub

Message ID 20210615030744.1252385-5-richard.henderson@linaro.org
State Superseded
Headers show
Series linux-user/s390x: Fix psw.mask handling in signals | expand

Commit Message

Richard Henderson June 15, 2021, 3:07 a.m. UTC
No change in behaviour, as gdbstub was correctly written to
install and extract the cc value.

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

---
 target/s390x/gdbstub.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

-- 
2.25.1

Comments

David Hildenbrand June 15, 2021, 7:52 a.m. UTC | #1
On 15.06.21 05:07, Richard Henderson wrote:
> No change in behaviour, as gdbstub was correctly written to

> install and extract the cc value.

> 

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

> ---

>   target/s390x/gdbstub.c | 15 ++-------------

>   1 file changed, 2 insertions(+), 13 deletions(-)

> 

> diff --git a/target/s390x/gdbstub.c b/target/s390x/gdbstub.c

> index d6fce5ff1e..5b4e38a13b 100644

> --- a/target/s390x/gdbstub.c

> +++ b/target/s390x/gdbstub.c

> @@ -31,18 +31,10 @@ int s390_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)

>   {

>       S390CPU *cpu = S390_CPU(cs);

>       CPUS390XState *env = &cpu->env;

> -    uint64_t val;

> -    int cc_op;

>   

>       switch (n) {

>       case S390_PSWM_REGNUM:

> -        if (tcg_enabled()) {

> -            cc_op = calc_cc(env, env->cc_op, env->cc_src, env->cc_dst,

> -                            env->cc_vr);

> -            val = deposit64(env->psw.mask, 44, 2, cc_op);

> -            return gdb_get_regl(mem_buf, val);

> -        }

> -        return gdb_get_regl(mem_buf, env->psw.mask);

> +        return gdb_get_regl(mem_buf, s390_cpu_get_psw_mask(env));

>       case S390_PSWA_REGNUM:

>           return gdb_get_regl(mem_buf, env->psw.addr);

>       case S390_R0_REGNUM ... S390_R15_REGNUM:

> @@ -59,10 +51,7 @@ int s390_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)

>   

>       switch (n) {

>       case S390_PSWM_REGNUM:

> -        env->psw.mask = tmpl;

> -        if (tcg_enabled()) {

> -            env->cc_op = extract64(tmpl, 44, 2);

> -        }

> +        s390_cpu_set_psw(env, tmpl, env->psw.addr);

>           break;

>       case S390_PSWA_REGNUM:

>           env->psw.addr = tmpl;

> 


Reviewed-by: David Hildenbrand <david@redhat.com>


-- 
Thanks,

David / dhildenb
diff mbox series

Patch

diff --git a/target/s390x/gdbstub.c b/target/s390x/gdbstub.c
index d6fce5ff1e..5b4e38a13b 100644
--- a/target/s390x/gdbstub.c
+++ b/target/s390x/gdbstub.c
@@ -31,18 +31,10 @@  int s390_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
 {
     S390CPU *cpu = S390_CPU(cs);
     CPUS390XState *env = &cpu->env;
-    uint64_t val;
-    int cc_op;
 
     switch (n) {
     case S390_PSWM_REGNUM:
-        if (tcg_enabled()) {
-            cc_op = calc_cc(env, env->cc_op, env->cc_src, env->cc_dst,
-                            env->cc_vr);
-            val = deposit64(env->psw.mask, 44, 2, cc_op);
-            return gdb_get_regl(mem_buf, val);
-        }
-        return gdb_get_regl(mem_buf, env->psw.mask);
+        return gdb_get_regl(mem_buf, s390_cpu_get_psw_mask(env));
     case S390_PSWA_REGNUM:
         return gdb_get_regl(mem_buf, env->psw.addr);
     case S390_R0_REGNUM ... S390_R15_REGNUM:
@@ -59,10 +51,7 @@  int s390_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
 
     switch (n) {
     case S390_PSWM_REGNUM:
-        env->psw.mask = tmpl;
-        if (tcg_enabled()) {
-            env->cc_op = extract64(tmpl, 44, 2);
-        }
+        s390_cpu_set_psw(env, tmpl, env->psw.addr);
         break;
     case S390_PSWA_REGNUM:
         env->psw.addr = tmpl;