Re: [PATCH] sh4: Coding style: Remove tabs

2023-11-26 Thread Thomas Huth

On 24/11/2023 16.30, Philippe Mathieu-Daudé wrote:

Hi,

On 24/11/23 05:45, xun wrote:

From: Yihuan Pan 

Replaces TABS with spaces to ensure have a consistent coding
style with an indentation of 4 spaces in the SH4 subsystem.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/376
Signed-off-by: Yihuan Pan 
---
  linux-user/sh4/termbits.h |  204 +++---
  target/sh4/cpu.h  |   80 +-
  target/sh4/helper.c   |  236 +++---
  target/sh4/op_helper.c    |   70 +-
  target/sh4/translate.c    | 1466 ++---
  5 files changed, 1028 insertions(+), 1028 deletions(-)



@@ -241,17 +241,17 @@ static int find_tlb_entry(CPUSH4State * env, 
target_ulong address,

  asid = env->pteh & 0xff;
  for (i = 0; i < nbtlb; i++) {
-    if (!entries[i].v)
-    continue;    /* Invalid entry */
-    if (!entries[i].sh && use_asid && entries[i].asid != asid)
-    continue;    /* Bad ASID */
-    start = (entries[i].vpn << 10) & ~(entries[i].size - 1);
-    end = start + entries[i].size - 1;
-    if (address >= start && address <= end) {    /* Match */
-    if (match != MMU_DTLB_MISS)
-    return MMU_DTLB_MULTIPLE;    /* Multiple match */
-    match = i;
-    }
+    if (!entries[i].v)
+    continue; /* Invalid entry */


Thomas, better fix the 'if { }' in this patch or a following one?


Normally I would not mind either way, but this patch is already quite big, 
so I think it would be better to fix other coding style issues in separate 
patches.
This way, you can also verify with "git show -b" that there are no other 
unwanted changes in here.


I now also quickly skimmed through the changes and the patch looks fine to 
me, so:


Reviewed-by: Thomas Huth 

Since the sh4 subsystem currently does not have a maintainer, I'll take the 
patch for my next pull request.


Thank you for tackling this!

 Thomas




Re: [PATCH] sh4: Coding style: Remove tabs

2023-11-24 Thread Philippe Mathieu-Daudé

Hi,

On 24/11/23 05:45, xun wrote:

From: Yihuan Pan 

Replaces TABS with spaces to ensure have a consistent coding
style with an indentation of 4 spaces in the SH4 subsystem.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/376
Signed-off-by: Yihuan Pan 
---
  linux-user/sh4/termbits.h |  204 +++---
  target/sh4/cpu.h  |   80 +-
  target/sh4/helper.c   |  236 +++---
  target/sh4/op_helper.c|   70 +-
  target/sh4/translate.c| 1466 ++---
  5 files changed, 1028 insertions(+), 1028 deletions(-)




@@ -241,17 +241,17 @@ static int find_tlb_entry(CPUSH4State * env, target_ulong 
address,
  asid = env->pteh & 0xff;
  
  for (i = 0; i < nbtlb; i++) {

-   if (!entries[i].v)
-   continue;   /* Invalid entry */
-   if (!entries[i].sh && use_asid && entries[i].asid != asid)
-   continue;   /* Bad ASID */
-   start = (entries[i].vpn << 10) & ~(entries[i].size - 1);
-   end = start + entries[i].size - 1;
-   if (address >= start && address <= end) { /* Match */
-   if (match != MMU_DTLB_MISS)
-   return MMU_DTLB_MULTIPLE;   /* Multiple match */
-   match = i;
-   }
+if (!entries[i].v)
+continue; /* Invalid entry */


Thomas, better fix the 'if { }' in this patch or a following one?


+if (!entries[i].sh && use_asid && entries[i].asid != asid)
+continue; /* Bad ASID */
+start = (entries[i].vpn << 10) & ~(entries[i].size - 1);
+end = start + entries[i].size - 1;
+if (address >= start && address <= end) { /* Match */
+if (match != MMU_DTLB_MISS)
+return MMU_DTLB_MULTIPLE; /* Multiple match */
+match = i;
+}
  }
  return match;
  }
@@ -265,7 +265,7 @@ static void increment_urc(CPUSH4State * env)
  urc = ((env->mmucr) >> 10) & 0x3f;
  urc++;
  if ((urb > 0 && urc > urb) || urc > (UTLB_SIZE - 1))
-   urc = 0;
+urc = 0;
  env->mmucr = (env->mmucr & 0x03ff) | (urc << 10);
  }





[PATCH] sh4: Coding style: Remove tabs

2023-11-24 Thread xun
From: Yihuan Pan 

Replaces TABS with spaces to ensure have a consistent coding
style with an indentation of 4 spaces in the SH4 subsystem.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/376
Signed-off-by: Yihuan Pan 
---
 linux-user/sh4/termbits.h |  204 +++---
 target/sh4/cpu.h  |   80 +-
 target/sh4/helper.c   |  236 +++---
 target/sh4/op_helper.c|   70 +-
 target/sh4/translate.c| 1466 ++---
 5 files changed, 1028 insertions(+), 1028 deletions(-)

diff --git a/linux-user/sh4/termbits.h b/linux-user/sh4/termbits.h
index eeabd2d7a9..28e79f2c9a 100644
--- a/linux-user/sh4/termbits.h
+++ b/linux-user/sh4/termbits.h
@@ -39,86 +39,86 @@ struct target_termios {
 #define TARGET_VEOL2 16
 
 /* c_iflag bits */
-#define TARGET_IGNBRK  001
-#define TARGET_BRKINT  002
-#define TARGET_IGNPAR  004
-#define TARGET_PARMRK  010
-#define TARGET_INPCK   020
-#define TARGET_ISTRIP  040
-#define TARGET_INLCR   100
-#define TARGET_IGNCR   200
-#define TARGET_ICRNL   400
-#define TARGET_IUCLC   0001000
-#define TARGET_IXON0002000
-#define TARGET_IXANY   0004000
-#define TARGET_IXOFF   001
-#define TARGET_IMAXBEL 002
-#define TARGET_IUTF8   004
+#define TARGET_IGNBRK  001
+#define TARGET_BRKINT  002
+#define TARGET_IGNPAR  004
+#define TARGET_PARMRK  010
+#define TARGET_INPCK   020
+#define TARGET_ISTRIP  040
+#define TARGET_INLCR   100
+#define TARGET_IGNCR   200
+#define TARGET_ICRNL   400
+#define TARGET_IUCLC   0001000
+#define TARGET_IXON0002000
+#define TARGET_IXANY   0004000
+#define TARGET_IXOFF   001
+#define TARGET_IMAXBEL 002
+#define TARGET_IUTF8   004
 
 /* c_oflag bits */
-#define TARGET_OPOST   001
-#define TARGET_OLCUC   002
-#define TARGET_ONLCR   004
-#define TARGET_OCRNL   010
-#define TARGET_ONOCR   020
-#define TARGET_ONLRET  040
-#define TARGET_OFILL   100
-#define TARGET_OFDEL   200
-#define TARGET_NLDLY   400
-#define TARGET_NL0 000
-#define TARGET_NL1 400
-#define TARGET_CRDLY   0003000
-#define TARGET_CR0 000
-#define TARGET_CR1 0001000
-#define TARGET_CR2 0002000
-#define TARGET_CR3 0003000
-#define TARGET_TABDLY  0014000
-#define TARGET_TAB0000
-#define TARGET_TAB10004000
-#define TARGET_TAB2001
-#define TARGET_TAB30014000
-#define TARGET_XTABS   0014000
-#define TARGET_BSDLY   002
-#define TARGET_BS0 000
-#define TARGET_BS1 002
-#define TARGET_VTDLY   004
-#define TARGET_VT0 000
-#define TARGET_VT1 004
-#define TARGET_FFDLY   010
-#define TARGET_FF0 000
-#define TARGET_FF1 010
+#define TARGET_OPOST   001
+#define TARGET_OLCUC   002
+#define TARGET_ONLCR   004
+#define TARGET_OCRNL   010
+#define TARGET_ONOCR   020
+#define TARGET_ONLRET  040
+#define TARGET_OFILL   100
+#define TARGET_OFDEL   200
+#define TARGET_NLDLY   400
+#define TARGET_NL0 000
+#define TARGET_NL1 400
+#define TARGET_CRDLY   0003000
+#define TARGET_CR0 000
+#define TARGET_CR1 0001000
+#define TARGET_CR2 0002000
+#define TARGET_CR3 0003000
+#define TARGET_TABDLY  0014000
+#define TARGET_TAB0000
+#define TARGET_TAB10004000
+#define TARGET_TAB2001
+#define TARGET_TAB30014000
+#define TARGET_XTABS   0014000
+#define TARGET_BSDLY   002
+#define TARGET_BS0 000
+#define TARGET_BS1 002
+#define TARGET_VTDLY   004
+#define TARGET_VT0 000
+#define TARGET_VT1 004
+#define TARGET_FFDLY   010
+#define TARGET_FF0 000
+#define TARGET_FF1 010
 
 /* c_cflag bit meaning */
-#define TARGET_CBAUD   0010017
-#define TARGET_B0  000 /* hang up */
-#define TARGET_B50 001
-#define TARGET_B75 002
-#define TARGET_B110003
-#define TARGET_B134004
-#define TARGET_B150005
-#define TARGET_B200006
-#define TARGET_B300007
-#define TARGET_B600010
-#define TARGET_B1200   011
-#define TARGET_B1800   012
-#define TARGET_B2400   013
-#define TARGET_B4800   014
-#define TARGET_B9600   015
-#define TARGET_B19200  016
-#define TARGET_B38400  017
+#define TARGET_CBAUD   0010017
+#define TARGET_B0  000 /* hang up */
+#define TARGET_B50 001
+#define TARGET_B75 002
+#define TARGET_B110003
+#define TARGET_B134004
+#define TARGET_B150005
+#define TARGET_B200006
+#define TARGET_B300007
+#define TARGET_B600010
+#define TARGET_B1200   011
+#define TARGET_B1800   012
+#define TARGET_B2400   013
+#define TARGET_B4800   014
+#define TARGET_B9600   015
+#define TARGET_B19200  016
+#define TARGET_B38400  017
 #define TARGET_EXTA B19200
 #define TARGET_EXTB B38400
-#define TARGET_CSIZE   060
-#define TARGET_C