qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>, qemu-devel@nongnu.org
Cc: "Marek Vasut" <marex@denx.de>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Thomas Huth" <thuth@redhat.com>,
	"Chris Wulff" <crwulff@gmail.com>,
	"Richard Henderson" <richard.henderson@linaro.org>
Subject: Re: [PATCH-for-6.2 1/2] disas/nios2: Fix style in print_insn_nios2()
Date: Wed, 29 Sep 2021 17:28:13 +0200	[thread overview]
Message-ID: <d41d0802-51a3-b540-84e2-f8d0a5646d8f@vivier.eu> (raw)
In-Reply-To: <20210807110939.95853-2-f4bug@amsat.org>

Le 07/08/2021 à 13:09, Philippe Mathieu-Daudé a écrit :
> We are going to modify this function, fix its style first.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  disas/nios2.c | 53 +++++++++++++++++++++++++--------------------------
>  1 file changed, 26 insertions(+), 27 deletions(-)
> 
> diff --git a/disas/nios2.c b/disas/nios2.c
> index c3e82140c79..d124902ae3e 100644
> --- a/disas/nios2.c
> +++ b/disas/nios2.c
> @@ -3482,38 +3482,37 @@ static int
>  print_insn_nios2 (bfd_vma address, disassemble_info *info,
>  		  enum bfd_endian endianness)
>  {
> -  bfd_byte buffer[INSNLEN];
> -  int status;
> +    bfd_byte buffer[INSNLEN];
> +    int status;
>  
> -  status = (*info->read_memory_func) (address, buffer, INSNLEN, info);
> -  if (status == 0)
> -    {
> -      unsigned long insn;
> -      if (endianness == BFD_ENDIAN_BIG)
> -	insn = (unsigned long) bfd_getb32 (buffer);
> -      else
> -	insn = (unsigned long) bfd_getl32 (buffer);
> -      return nios2_disassemble (address, insn, info);
> +    status = (*info->read_memory_func)(address, buffer, INSNLEN, info);
> +    if (status == 0) {
> +        unsigned long insn;
> +        if (endianness == BFD_ENDIAN_BIG) {
> +            insn = (unsigned long) bfd_getb32(buffer);
> +        } else {
> +            insn = (unsigned long) bfd_getl32(buffer);
> +        }
> +        return nios2_disassemble(address, insn, info);
>      }
>  
> -  /* We might have a 16-bit R2 instruction at the end of memory.  Try that.  */
> -  if (info->mach == bfd_mach_nios2r2)
> -    {
> -      status = (*info->read_memory_func) (address, buffer, 2, info);
> -      if (status == 0)
> -	{
> -	  unsigned long insn;
> -	  if (endianness == BFD_ENDIAN_BIG)
> -	    insn = (unsigned long) bfd_getb16 (buffer);
> -	  else
> -	    insn = (unsigned long) bfd_getl16 (buffer);
> -	  return nios2_disassemble (address, insn, info);
> -	}
> +    /* We might have a 16-bit R2 instruction at the end of memory. Try that. */
> +    if (info->mach == bfd_mach_nios2r2) {
> +        status = (*info->read_memory_func)(address, buffer, 2, info);
> +        if (status == 0) {
> +            unsigned long insn;
> +            if (endianness == BFD_ENDIAN_BIG) {
> +                insn = (unsigned long) bfd_getb16(buffer);
> +            } else {
> +                insn = (unsigned long) bfd_getl16(buffer);
> +            }
> +            return nios2_disassemble(address, insn, info);
> +        }
>      }
>  
> -  /* If we got here, we couldn't read anything.  */
> -  (*info->memory_error_func) (status, address, info);
> -  return -1;
> +    /* If we got here, we couldn't read anything.  */
> +    (*info->memory_error_func)(status, address, info);
> +    return -1;
>  }
>  
>  /* These two functions are the main entry points, accessed from
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>


  parent reply	other threads:[~2021-09-29 15:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-07 11:09 [PATCH-for-6.2 0/2] disas/nios2: Simplify endianess conversion Philippe Mathieu-Daudé
2021-08-07 11:09 ` [PATCH-for-6.2 1/2] disas/nios2: Fix style in print_insn_nios2() Philippe Mathieu-Daudé
2021-08-09  6:08   ` Thomas Huth
2021-08-09  7:14     ` Philippe Mathieu-Daudé
2021-09-29 15:28   ` Laurent Vivier [this message]
2021-08-07 11:09 ` [PATCH-for-6.2 2/2] disas/nios2: Simplify endianess conversion Philippe Mathieu-Daudé
2021-08-09  6:12   ` Thomas Huth
2021-08-09  9:48     ` Philippe Mathieu-Daudé
2021-09-29 15:28   ` Laurent Vivier
2021-09-18  9:19 ` [PATCH-for-6.2 0/2] " Philippe Mathieu-Daudé
2021-09-23 15:14   ` Laurent Vivier
2021-09-24  9:40     ` Philippe Mathieu-Daudé
2021-10-19  7:43 ` Laurent Vivier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d41d0802-51a3-b540-84e2-f8d0a5646d8f@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=alex.bennee@linaro.org \
    --cc=crwulff@gmail.com \
    --cc=f4bug@amsat.org \
    --cc=marex@denx.de \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).