diff mbox

[15/29] microblaze: use QEMU_IS_ALIGNED macro

Message ID 20170718061005.29518-16-f4bug@amsat.org
State New
Headers show

Commit Message

Philippe Mathieu-Daudé July 18, 2017, 6:09 a.m. UTC
Applied using the Coccinelle semantic patch scripts/coccinelle/use_osdep.cocci
(also added braces to satisfy checkpatch)

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 target/microblaze/op_helper.c | 3 ++-
 target/microblaze/translate.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

Comments

Marc-André Lureau July 18, 2017, 11:08 a.m. UTC | #1
On Mon, Jul 17, 2017 at 11:09 PM, Philippe Mathieu-Daudé
<f4bug@amsat.org> wrote:
> Applied using the Coccinelle semantic patch scripts/coccinelle/use_osdep.cocci
> (also added braces to satisfy checkpatch)
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  target/microblaze/op_helper.c | 3 ++-
>  target/microblaze/translate.c | 3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/target/microblaze/op_helper.c b/target/microblaze/op_helper.c
> index 1e07e21c1c..41ab52fb7a 100644
> --- a/target/microblaze/op_helper.c
> +++ b/target/microblaze/op_helper.c
> @@ -108,8 +108,9 @@ void helper_debug(CPUMBState *env)
>               (env->sregs[SR_MSR] & MSR_IE));
>      for (i = 0; i < 32; i++) {
>          qemu_log("r%2.2d=%8.8x ", i, env->regs[i]);
> -        if ((i + 1) % 4 == 0)
> +        if (QEMU_IS_ALIGNED(i + 1, 4)) {
>              qemu_log("\n");
> +        }
>      }
>      qemu_log("\n\n");
>  }
> diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c
> index cb65d1e129..ae7b3c71b0 100644
> --- a/target/microblaze/translate.c
> +++ b/target/microblaze/translate.c
> @@ -1839,9 +1839,10 @@ void mb_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
>
>      for (i = 0; i < 32; i++) {
>          cpu_fprintf(f, "r%2.2d=%8.8x ", i, env->regs[i]);
> -        if ((i + 1) % 4 == 0)
> +        if (QEMU_IS_ALIGNED(i + 1, 4)) {
>              cpu_fprintf(f, "\n");
>          }
> +    }
>      cpu_fprintf(f, "\n\n");
>  }
>
> --
> 2.13.2
>
>
Thomas Huth July 18, 2017, 2:46 p.m. UTC | #2
On 18.07.2017 13:08, Marc-André Lureau wrote:
> On Mon, Jul 17, 2017 at 11:09 PM, Philippe Mathieu-Daudé
> <f4bug@amsat.org> wrote:
>> Applied using the Coccinelle semantic patch scripts/coccinelle/use_osdep.cocci
>> (also added braces to satisfy checkpatch)
[...]
>> diff --git a/target/microblaze/op_helper.c b/target/microblaze/op_helper.c
>> index 1e07e21c1c..41ab52fb7a 100644
>> --- a/target/microblaze/op_helper.c
>> +++ b/target/microblaze/op_helper.c
>> @@ -108,8 +108,9 @@ void helper_debug(CPUMBState *env)
>>               (env->sregs[SR_MSR] & MSR_IE));
>>      for (i = 0; i < 32; i++) {
>>          qemu_log("r%2.2d=%8.8x ", i, env->regs[i]);
>> -        if ((i + 1) % 4 == 0)
>> +        if (QEMU_IS_ALIGNED(i + 1, 4)) {
>>              qemu_log("\n");
>> +        }
>>      }
>>      qemu_log("\n\n");
>>  }
>> diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c
>> index cb65d1e129..ae7b3c71b0 100644
>> --- a/target/microblaze/translate.c
>> +++ b/target/microblaze/translate.c
>> @@ -1839,9 +1839,10 @@ void mb_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
>>
>>      for (i = 0; i < 32; i++) {
>>          cpu_fprintf(f, "r%2.2d=%8.8x ", i, env->regs[i]);
>> -        if ((i + 1) % 4 == 0)
>> +        if (QEMU_IS_ALIGNED(i + 1, 4)) {
>>              cpu_fprintf(f, "\n");
>>          }
>> +    }
>>      cpu_fprintf(f, "\n\n");
>>  }

I'd also vote to keep the original code here ... it's about pretty
printing, not about checking the alignment of addresses.

 Thomas
diff mbox

Patch

diff --git a/target/microblaze/op_helper.c b/target/microblaze/op_helper.c
index 1e07e21c1c..41ab52fb7a 100644
--- a/target/microblaze/op_helper.c
+++ b/target/microblaze/op_helper.c
@@ -108,8 +108,9 @@  void helper_debug(CPUMBState *env)
              (env->sregs[SR_MSR] & MSR_IE));
     for (i = 0; i < 32; i++) {
         qemu_log("r%2.2d=%8.8x ", i, env->regs[i]);
-        if ((i + 1) % 4 == 0)
+        if (QEMU_IS_ALIGNED(i + 1, 4)) {
             qemu_log("\n");
+        }
     }
     qemu_log("\n\n");
 }
diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c
index cb65d1e129..ae7b3c71b0 100644
--- a/target/microblaze/translate.c
+++ b/target/microblaze/translate.c
@@ -1839,9 +1839,10 @@  void mb_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
 
     for (i = 0; i < 32; i++) {
         cpu_fprintf(f, "r%2.2d=%8.8x ", i, env->regs[i]);
-        if ((i + 1) % 4 == 0)
+        if (QEMU_IS_ALIGNED(i + 1, 4)) {
             cpu_fprintf(f, "\n");
         }
+    }
     cpu_fprintf(f, "\n\n");
 }