qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/5] target/ppc: Drop use of gdb_get_float64() and ldfq_p()


From: David Gibson
Subject: Re: [PATCH 3/5] target/ppc: Drop use of gdb_get_float64() and ldfq_p()
Date: Tue, 9 Feb 2021 16:10:05 +1100

On Mon, Feb 08, 2021 at 11:34:26AM +0000, Peter Maydell wrote:
> We used to make a distinction between 'float64'/'float32' types and
> the 'uint64_t'/'uint32_t' types, requiring special conversion
> operations to go between them.  We've now dropped this distinction as
> unnecessary, and the 'float*' types remain primarily for
> documentation purposes when used in places like the function
> prototypes of TCG helper functions.
> 
> This means that there's no need for a special gdb_get_float64()
> function to write a float64 value to the GDB protocol buffer; we can
> just use gdb_get_reg64().
> 
> Similarly, for reading a value out of the GDB buffer into a float64
> we can use ldq_p() and need not use ldfq_p().
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Acked-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  target/ppc/gdbstub.c            | 8 ++++----
>  target/ppc/translate_init.c.inc | 4 ++--
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c
> index 01459dd31d2..c28319fb974 100644
> --- a/target/ppc/gdbstub.c
> +++ b/target/ppc/gdbstub.c
> @@ -130,7 +130,7 @@ int ppc_cpu_gdb_read_register(CPUState *cs, GByteArray 
> *buf, int n)
>          gdb_get_regl(buf, env->gpr[n]);
>      } else if (n < 64) {
>          /* fprs */
> -        gdb_get_float64(buf, *cpu_fpr_ptr(env, n - 32));
> +        gdb_get_reg64(buf, *cpu_fpr_ptr(env, n - 32));
>      } else {
>          switch (n) {
>          case 64:
> @@ -184,7 +184,7 @@ int ppc_cpu_gdb_read_register_apple(CPUState *cs, 
> GByteArray *buf, int n)
>          gdb_get_reg64(buf, env->gpr[n]);
>      } else if (n < 64) {
>          /* fprs */
> -        gdb_get_float64(buf, *cpu_fpr_ptr(env, n - 32));
> +        gdb_get_reg64(buf, *cpu_fpr_ptr(env, n - 32));
>      } else if (n < 96) {
>          /* Altivec */
>          gdb_get_reg64(buf, n - 64);
> @@ -241,7 +241,7 @@ int ppc_cpu_gdb_write_register(CPUState *cs, uint8_t 
> *mem_buf, int n)
>          env->gpr[n] = ldtul_p(mem_buf);
>      } else if (n < 64) {
>          /* fprs */
> -        *cpu_fpr_ptr(env, n - 32) = ldfq_p(mem_buf);
> +        *cpu_fpr_ptr(env, n - 32) = ldq_p(mem_buf);
>      } else {
>          switch (n) {
>          case 64:
> @@ -291,7 +291,7 @@ int ppc_cpu_gdb_write_register_apple(CPUState *cs, 
> uint8_t *mem_buf, int n)
>          env->gpr[n] = ldq_p(mem_buf);
>      } else if (n < 64) {
>          /* fprs */
> -        *cpu_fpr_ptr(env, n - 32) = ldfq_p(mem_buf);
> +        *cpu_fpr_ptr(env, n - 32) = ldq_p(mem_buf);
>      } else {
>          switch (n) {
>          case 64 + 32:
> diff --git a/target/ppc/translate_init.c.inc b/target/ppc/translate_init.c.inc
> index 9867d0a6e4a..7bd111d905e 100644
> --- a/target/ppc/translate_init.c.inc
> +++ b/target/ppc/translate_init.c.inc
> @@ -9907,7 +9907,7 @@ static int gdb_get_float_reg(CPUPPCState *env, 
> GByteArray *buf, int n)
>  {
>      uint8_t *mem_buf;
>      if (n < 32) {
> -        gdb_get_float64(buf, *cpu_fpr_ptr(env, n));
> +        gdb_get_reg64(buf, *cpu_fpr_ptr(env, n));
>          mem_buf = gdb_get_reg_ptr(buf, 8);
>          ppc_maybe_bswap_register(env, mem_buf, 8);
>          return 8;
> @@ -9925,7 +9925,7 @@ static int gdb_set_float_reg(CPUPPCState *env, uint8_t 
> *mem_buf, int n)
>  {
>      if (n < 32) {
>          ppc_maybe_bswap_register(env, mem_buf, 8);
> -        *cpu_fpr_ptr(env, n) = ldfq_p(mem_buf);
> +        *cpu_fpr_ptr(env, n) = ldq_p(mem_buf);
>          return 8;
>      }
>      if (n == 32) {

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]