Skip to contentSkip to conversation

m68k comments break patch submission due to being incorrectly formatted

PATCH Superseded Lucien Murray-Pitts 2 participants 2 messages Jun 6, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 m68k comments break patch submission due to being incorrectly formatted

Altering all comments in target/m68k to match Qemu coding styles so that future patches wont fail due to style breaches.

---
 target/m68k/cpu.c        |   4 +-
 target/m68k/cpu.h        |  30 ++++--
 target/m68k/fpu_helper.c |   6 +-
 target/m68k/gdbstub.c    |   6 +-
 target/m68k/helper.c     |  16 +--
 target/m68k/m68k-semi.c  |  18 ++--
 target/m68k/op_helper.c  |  54 ++++++----
 target/m68k/softfloat.c  | 226 +++++++++++++++++++++++---------------
 target/m68k/translate.c  | 227 ++++++++++++++++++++++++---------------
 9 files changed, 365 insertions(+), 222 deletions(-)
target/m68k/cpu.c +2 -2
index b16957934a..d12d906b11 100644
@@ -204,8 +204,8 @@ static void any_cpu_initfn(Object *obj)
     m68k_set_feature(env, M68K_FEATURE_CF_ISA_APLUSC);
     m68k_set_feature(env, M68K_FEATURE_BRAL);
     m68k_set_feature(env, M68K_FEATURE_CF_FPU);
-    /* MAC and EMAC are mututally exclusive, so pick EMAC.
-       It's mostly backwards compatible.  */
+    /* MAC and EMAC are mututally exclusive, so pick EMAC. */
+    /* It's mostly backwards compatible.  */
     m68k_set_feature(env, M68K_FEATURE_CF_EMAC);
     m68k_set_feature(env, M68K_FEATURE_CF_EMAC_B);
     m68k_set_feature(env, M68K_FEATURE_USP);
target/m68k/cpu.h +19 -11
index 9deff9e234..3e60bf885c 100644
@@ -112,9 +112,11 @@ typedef struct CPUM68KState {
     float_status fp_status;
 
     uint64_t mactmp;
-    /* EMAC Hardware deals with 48-bit values composed of one 32-bit and
-       two 8-bit parts.  We store a single 64-bit value and
-       rearrange/extend this when changing modes.  */
+    /*
+     * EMAC Hardware deals with 48-bit values composed of one 32-bit and
+     * two 8-bit parts.  We store a single 64-bit value and
+     * rearrange/extend this when changing modes.
+     */
     uint64_t macc[4];
     uint32_t macsr;
     uint32_t mac_mask;
@@ -186,9 +188,11 @@ int m68k_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
 
 void m68k_tcg_init(void);
 void m68k_cpu_init_gdb(M68kCPU *cpu);
-/* you can call this signal handler from your SIGBUS and SIGSEGV
-   signal handlers to inform the virtual CPU of exceptions. non zero
-   is returned if the signal was handled by the virtual CPU.  */
+/*
+ * you can call this signal handler from your SIGBUS and SIGSEGV
+ * signal handlers to inform the virtual CPU of exceptions. non zero
+ * is returned if the signal was handled by the virtual CPU.
+ */
 int cpu_m68k_signal_handler(int host_signum, void *pinfo,
                            void *puc);
 uint32_t cpu_m68k_get_ccr(CPUM68KState *env);
@@ -197,7 +201,8 @@ void cpu_m68k_set_sr(CPUM68KState *env, uint32_t);
 void cpu_m68k_set_fpcr(CPUM68KState *env, uint32_t val);
 
 
-/* Instead of computing the condition codes after each m68k instruction,
+/*
+ * Instead of computing the condition codes after each m68k instruction,
  * QEMU just stores one operand (called CC_SRC), the result
  * (called CC_DEST) and the type of operation (called CC_OP). When the
  * condition codes are needed, the condition codes can be calculated
@@ -462,9 +467,11 @@ void m68k_switch_sp(CPUM68KState *env);
 
 void do_m68k_semihosting(CPUM68KState *env, int nr);
 
-/* There are 4 ColdFire core ISA revisions: A, A+, B and C.
-   Each feature covers the subset of instructions common to the
-   ISA revisions mentioned.  */
+/*
+ * There are 4 ColdFire core ISA revisions: A, A+, B and C.
+ * Each feature covers the subset of instructions common to the
+ * ISA revisions mentioned.
+ */
 
 enum m68k_features {
     M68K_FEATURE_M68000,
@@ -502,7 +509,8 @@ void m68k_cpu_list(void);
 
 void register_m68k_insns (CPUM68KState *env);
 
-/* Coldfire Linux uses 8k pages
+/*
+ * Coldfire Linux uses 8k pages
  * and m68k linux uses 4k pages
  * use the smallest one
  */
target/m68k/fpu_helper.c +4 -2
index b35489ba4e..9b039c856d 100644
@@ -25,7 +25,8 @@
 #include "exec/cpu_ldst.h"
 #include "softfloat.h"
 
-/* Undefined offsets may be different on various FPU.
+/*
+ * Undefined offsets may be different on various FPU.
  * On 68040 they return 0.0 (floatx80_zero)
  */
 
@@ -611,7 +612,8 @@ void HELPER(fcos)(CPUM68KState *env, FPReg *res, FPReg *val)
 void HELPER(fsincos)(CPUM68KState *env, FPReg *res0, FPReg *res1, FPReg *val)
 {
     floatx80 a = val->d;
-    /* If res0 and res1 specify the same floating-point data register,
+    /*
+     * If res0 and res1 specify the same floating-point data register,
      * the sine result is stored in the register, and the cosine
      * result is discarded.
      */
target/m68k/gdbstub.c +4 -2
index fd2bb46c42..6bcf1a9b9f 100644
@@ -41,8 +41,10 @@ int m68k_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
             return gdb_get_reg32(mem_buf, env->pc);
         }
     }
-    /* FP registers not included here because they vary between
-       ColdFire and m68k.  Use XML bits for these.  */
+    /*
+     * FP registers not included here because they vary between
+     * ColdFire and m68k.  Use XML bits for these.
+     */
     return 0;
 }
 
target/m68k/helper.c +10 -6
index 6db93bdd81..b0bb579403 100644
@@ -972,9 +972,11 @@ void HELPER(set_sr)(CPUM68KState *env, uint32_t val)
 }
 
 /* MAC unit.  */
-/* FIXME: The MAC unit implementation is a bit of a mess.  Some helpers
-   take values,  others take register numbers and manipulate the contents
-   in-place.  */
+/*
+ * FIXME: The MAC unit implementation is a bit of a mess.  Some helpers
+ * take values,  others take register numbers and manipulate the contents
+ * in-place.
+ */
 void HELPER(mac_move)(CPUM68KState *env, uint32_t dest, uint32_t src)
 {
     uint32_t mask;
@@ -1054,9 +1056,11 @@ void HELPER(macsats)(CPUM68KState *env, uint32_t acc)
     if (env->macsr & MACSR_V) {
         env->macsr |= MACSR_PAV0 << acc;
         if (env->macsr & MACSR_OMC) {
-            /* The result is saturated to 32 bits, despite overflow occurring
-               at 48 bits.  Seems weird, but that's what the hardware docs
-               say.  */
+            /*
+             * The result is saturated to 32 bits, despite overflow occurring
+             * at 48 bits.  Seems weird, but that's what the hardware docs
+             * say.
+             */
             result = (result >> 63) ^ 0x7fffffff;
         }
     }
target/m68k/m68k-semi.c +10 -8
index 1402145c8f..ed9245f366 100644
@@ -131,7 +131,8 @@ static void m68k_semi_return_u32(CPUM68KState *env, uint32_t ret, uint32_t err)
     target_ulong args = env->dregs[1];
     if (put_user_u32(ret, args) ||
         put_user_u32(err, args + 4)) {
-        /* The m68k semihosting ABI does not provide any way to report this
+        /*
+         * The m68k semihosting ABI does not provide any way to report this
          * error to the guest, so the best we can do is log it in qemu.
          * It is always a guest error not to pass us a valid argument block.
          */
@@ -160,8 +161,8 @@ static void m68k_semi_cb(CPUState *cs, target_ulong ret, target_ulong err)
     CPUM68KState *env = &cpu->env;
 
     if (m68k_semi_is_fseek) {
-        /* FIXME: We've already lost the high bits of the fseek
-           return value.  */
+        /* FIXME: We've already lost the high bits of the fseek */
+        /* return value.  */
         m68k_semi_return_u64(env, ret, err);
         m68k_semi_is_fseek = 0;
     } else {
@@ -169,7 +170,8 @@ static void m68k_semi_cb(CPUState *cs, target_ulong ret, target_ulong err)
     }
 }
 
-/* Read the input value from the argument block; fail the semihosting
+/*
+ * Read the input value from the argument block; fail the semihosting
  * call if the memory read fails.
  */
 #define GET_ARG(n) do {                                 \
@@ -441,14 +443,14 @@ void do_m68k_semihosting(CPUM68KState *env, int nr)
             }
             ts->heap_limit = base + size;
         }
-        /* This call may happen before we have writable memory, so return
-           values directly in registers.  */
+        /* This call may happen before we have writable memory, so return */
+        /* values directly in registers.  */
         env->dregs[1] = ts->heap_limit;
         env->aregs[7] = ts->stack_base;
         }
 #else
-        /* FIXME: This is wrong for boards where RAM does not start at
-           address zero.  */
+        /* FIXME: This is wrong for boards where RAM does not start at */
+        /* address zero.  */
         env->dregs[1] = ram_size;
         env->aregs[7] = ram_size;
 #endif
target/m68k/op_helper.c +33 -21

115 lines not on this page · raw message

target/m68k/softfloat.c +140 -86

404 lines not on this page · raw message

target/m68k/translate.c +143 -84

514 lines not on this page · raw message

Signature · 1 line
2.21.0
#1 lore raw

CC Trivial

Le 06/06/2019 à 18:43, Lucien Murray-Pitts a écrit :

Quoted 4 lines

Altering all comments in target/m68k to match Qemu coding styles so that future patches wont fail due to style breaches.

Quoted 11 lines
---
 target/m68k/cpu.c        |   4 +-
 target/m68k/cpu.h        |  30 ++++--
 target/m68k/fpu_helper.c |   6 +-
 target/m68k/gdbstub.c    |   6 +-
 target/m68k/helper.c     |  16 +--
 target/m68k/m68k-semi.c  |  18 ++--
 target/m68k/op_helper.c  |  54 ++++++----
 target/m68k/softfloat.c  | 226 +++++++++++++++++++++++---------------
 target/m68k/translate.c  | 227 ++++++++++++++++++++++++---------------
 9 files changed, 365 insertions(+), 222 deletions(-)

Looks good, except:

target/m68k/cpu.c static void any_cpu_initfn(Object *obj) · line 208

Quoted 13 lines
target/m68k/cpu.c +2 -2
index b16957934a..d12d906b11 100644
@@ -204,8 +204,8 @@ static void any_cpu_initfn(Object *obj)
     m68k_set_feature(env, M68K_FEATURE_CF_ISA_APLUSC);
     m68k_set_feature(env, M68K_FEATURE_BRAL);
     m68k_set_feature(env, M68K_FEATURE_CF_FPU);
-    /* MAC and EMAC are mututally exclusive, so pick EMAC.
-       It's mostly backwards compatible.  */
+    /* MAC and EMAC are mututally exclusive, so pick EMAC. */
+    /* It's mostly backwards compatible.  */

Use /*
* MAC and EMAC are mututally exclusive, so pick EMAC.
* It's mostly backwards compatible.
*/

Quoted 3 lines
target/m68k/cpu.c +0 -0
     m68k_set_feature(env, M68K_FEATURE_CF_EMAC);
     m68k_set_feature(env, M68K_FEATURE_CF_EMAC_B);
     m68k_set_feature(env, M68K_FEATURE_USP);

...

Quoted 15 lines
target/m68k/m68k-semi.c +2 -1
index 1402145c8f..ed9245f366 100644
@@ -131,7 +131,8 @@ static void m68k_semi_return_u32(CPUM68KState *env, uint32_t ret, uint32_t err)
     target_ulong args = env->dregs[1];
     if (put_user_u32(ret, args) ||
         put_user_u32(err, args + 4)) {
-        /* The m68k semihosting ABI does not provide any way to report this
+        /*
+         * The m68k semihosting ABI does not provide any way to report this
          * error to the guest, so the best we can do is log it in qemu.
          * It is always a guest error not to pass us a valid argument block.
          */

target/m68k/m68k-semi.c static void m68k_semi_cb(CPUState *cs, target_ulong ret, target_ulong err) · line 165

Quoted 7 lines
target/m68k/m68k-semi.c +2 -2
@@ -160,8 +161,8 @@ static void m68k_semi_cb(CPUState *cs, target_ulong ret, target_ulong err)
     CPUM68KState *env = &cpu->env;
 
     if (m68k_semi_is_fseek) {
-        /* FIXME: We've already lost the high bits of the fseek
-           return value.  */
+        /* FIXME: We've already lost the high bits of the fseek */
+        /* return value.  */

ditto like:

/*
* FIXME: We've already lost the high bits of the fseek
* return value.
*/

Quoted 19 lines
target/m68k/m68k-semi.c +2 -3
         m68k_semi_return_u64(env, ret, err);
         m68k_semi_is_fseek = 0;
     } else {
@@ -169,7 +170,8 @@ static void m68k_semi_cb(CPUState *cs, target_ulong ret, target_ulong err)
     }
 }
 
-/* Read the input value from the argument block; fail the semihosting
+/*
+ * Read the input value from the argument block; fail the semihosting
  * call if the memory read fails.
  */
 #define GET_ARG(n) do {                                 \
@@ -441,14 +443,14 @@ void do_m68k_semihosting(CPUM68KState *env, int nr)
             }
             ts->heap_limit = base + size;
         }
-        /* This call may happen before we have writable memory, so return
-           values directly in registers.  */

target/m68k/m68k-semi.c void do_m68k_semihosting(CPUM68KState *env, int nr) · line 453

Quoted 10 lines
target/m68k/m68k-semi.c +4 -2
+        /* This call may happen before we have writable memory, so return */
+        /* values directly in registers.  */
         env->dregs[1] = ts->heap_limit;
         env->aregs[7] = ts->stack_base;
         }
 #else
-        /* FIXME: This is wrong for boards where RAM does not start at
-           address zero.  */
+        /* FIXME: This is wrong for boards where RAM does not start at */
+        /* address zero.  */

ditto

Quoted 9 lines
target/m68k/m68k-semi.c +0 -0
         env->dregs[1] = ram_size;
         env->aregs[7] = ram_size;
 #endif
target/m68k/op_helper.c +0 -0
index bde2d551ff..0fa6f2c92e 100644

target/m68k/op_helper.c static struct bf_data bf_prep(uint32_t addr, int32_t ofs, uint32_t len) · line 848

Quoted 7 lines
target/m68k/op_helper.c +2 -2
@@ -838,14 +844,16 @@ static struct bf_data bf_prep(uint32_t addr, int32_t ofs, uint32_t len)
         addr -= 1;
     }
 
-    /* Compute the number of bytes required (minus one) to
-       satisfy the bitfield.  */
+    /* Compute the number of bytes required (minus one) to */
+    /* satisfy the bitfield.  */

ditto

Quoted 16 lines
target/m68k/op_helper.c +6 -4
     blen = (bofs + len - 1) / 8;
 
-    /* Canonicalize the bit offset for data loaded into a 64-bit big-endian
-       word.  For the cases where BLEN is not a power of 2, adjust ADDR so
-       that we can use the next power of two sized load without crossing a
-       page boundary, unless the field itself crosses the boundary.  */
+    /*
+     * Canonicalize the bit offset for data loaded into a 64-bit big-endian
+     * word.  For the cases where BLEN is not a power of 2, adjust ADDR so
+     * that we can use the next power of two sized load without crossing a
+     * page boundary, unless the field itself crosses the boundary.
+     */
     switch (blen) {
     case 0:
         bofs += 56;

target/m68k/op_helper.c uint64_t HELPER(bfextu_mem)(CPUM68KState *env, uint32_t addr, · line 949

Quoted 7 lines
target/m68k/op_helper.c +2 -2
@@ -937,8 +945,8 @@ uint64_t HELPER(bfextu_mem)(CPUM68KState *env, uint32_t addr,
     struct bf_data d = bf_prep(addr, ofs, len);
     uint64_t data = bf_load(env, d.addr, d.blen, ra);
 
-    /* Put CC_N at the top of the high word; put the zero-extended value
-       at the bottom of the low word.  */
+    /* Put CC_N at the top of the high word; put the zero-extended value */
+    /* at the bottom of the low word.  */

ditto

Quoted 3 lines
target/m68k/op_helper.c +0 -0
     data <<= d.bofs;
     data >>= 64 - d.len;
     data |= data << (64 - d.len);

...

target/m68k/softfloat.c

Quoted 4 lines
target/m68k/softfloat.c +0 -0
index b45a5e8690..3cb1f494ba 100644

In this file, it's better to remove the "/*------------------------" and "*---------------------------------------*/" lines if you update them.

target/m68k/translate.c static void set_cc_op(DisasContext *s, CCOp op) · line 252

Quoted 12 lines
target/m68k/translate.c +2 -2
index f0534a4ba0..b796b6c22e 100644
@@ -248,8 +248,8 @@ static void set_cc_op(DisasContext *s, CCOp op)
     s->cc_op = op;
     s->cc_op_synced = 0;
 
-    /* Discard CC computation that will no longer be used.
-       Note that X and N are never dead.  */
+    /* Discard CC computation that will no longer be used. */
+    /* Note that X and N are never dead.  */

don't split in two comments.

Quoted 3 lines
target/m68k/translate.c +0 -0
     dead = cc_op_live[old_op] & ~cc_op_live[op];
     if (dead & CCF_C) {
         tcg_gen_discard_i32(QREG_CC_C);

...

target/m68k/translate.c DISAS_INSN(movem) · line 2059

Quoted 8 lines
target/m68k/translate.c +2 -2
@@ -2029,8 +2055,8 @@ DISAS_INSN(movem)
             /* pre-decrement is not allowed */
             goto do_addr_fault;
         }
-        /* We want a bare copy of the address reg, without any pre-decrement
-           adjustment, as gen_lea would provide.  */
+        /* We want a bare copy of the address reg, without any pre-decrement */
+        /* adjustment, as gen_lea would provide.  */

ditto

Quoted 3 lines
target/m68k/translate.c +0 -0
         break;
 
     default:

...

target/m68k/translate.c DISAS_INSN(jump) · line 2976

Quoted 8 lines
target/m68k/translate.c +2 -2
@@ -2938,8 +2972,8 @@ DISAS_INSN(jump)
 {
     TCGv tmp;
 
-    /* Load the target address first to ensure correct exception
-       behavior.  */
+    /* Load the target address first to ensure correct exception */
+    /* behavior.  */

ditto

target/m68k/translate.c DISAS_INSN(addsubq) · line 3014

Quoted 11 lines
target/m68k/translate.c +2 -2
     tmp = gen_lea(env, s, insn, OS_LONG);
     if (IS_NULL_QREG(tmp)) {
         gen_addr_fault(s);
@@ -2976,8 +3010,8 @@ DISAS_INSN(addsubq)
     dest = tcg_temp_new();
     tcg_gen_mov_i32(dest, src);
     if ((insn & 0x38) == 0x08) {
-        /* Don't update condition codes if the destination is an
-           address register.  */
+        /* Don't update condition codes if the destination is an */
+        /* address register.  */

ditto

target/m68k/translate.c DISAS_INSN(bfext_reg) · line 4077

Quoted 12 lines
target/m68k/translate.c +2 -2
         if (insn & 0x0100) {
             tcg_gen_sub_i32(dest, dest, val);
         } else {
@@ -4028,8 +4073,8 @@ DISAS_INSN(bfext_reg)
             src = tmp;
             pos = 32 - len;
         } else {
-            /* Immediate offset.  If the field doesn't wrap around the
-               end of the word, rely on (s)extract completely.  */
+            /* Immediate offset.  If the field doesn't wrap around the */
+            /*   end of the word, rely on (s)extract completely.  */

ditto

Quoted 3 lines
target/m68k/translate.c +0 -0
             if (pos < 0) {
                 tcg_gen_rotli_i32(tmp, src, ofs);
                 src = tmp;

...

target/m68k/translate.c DISAS_INSN(mac) · line 5690

Quoted 8 lines
target/m68k/translate.c +2 -2
@@ -5635,8 +5686,8 @@ DISAS_INSN(mac)
         TCGv rw;
         rw = (insn & 0x40) ? AREG(insn, 9) : DREG(insn, 9);
         tcg_gen_mov_i32(rw, loadval);
-        /* FIXME: Should address writeback happen with the masked or
-           unmasked value?  */
+        /* FIXME: Should address writeback happen with the masked or */
+        /*  unmasked value?  */

ditto

target/m68k/translate.c register_opcode (disas_proc proc, uint16_t opcode, uint16_t mask) · line 5841

Quoted 11 lines
target/m68k/translate.c +2 -2
         switch ((insn >> 3) & 7) {
         case 3: /* Post-increment.  */
             tcg_gen_addi_i32(AREG(insn, 0), addr, 4);
@@ -5786,8 +5837,8 @@ register_opcode (disas_proc proc, uint16_t opcode, uint16_t mask)
               opcode, mask);
       abort();
   }
-  /* This could probably be cleverer.  For now just optimize the case where
-     the top bits are known.  */
+  /* This could probably be cleverer.  For now just optimize the case where */
+  /*   the top bits are known.  */

ditto

Quoted 9 lines
target/m68k/translate.c +0 -2
   /* Find the first zero bit in the mask.  */
   i = 0x8000;
   while ((i & mask) != 0)
@@ -5805,17 +5856,20 @@ register_opcode (disas_proc proc, uint16_t opcode, uint16_t mask)
   }
 }
 
-/* Register m68k opcode handlers.  Order is important.
-   Later insn override earlier ones.  */

target/m68k/translate.c register_opcode (disas_proc proc, uint16_t opcode, uint16_t mask) · line 5866

Quoted 10 lines
target/m68k/translate.c +6 -2
+/*
+ * Register m68k opcode handlers.  Order is important.
+ * Later insn override earlier ones.
+ */
 void register_m68k_insns (CPUM68KState *env)
 {
-    /* Build the opcode table only once to avoid
-       multithreading issues. */
+    /* Build the opcode table only once to avoid */
+    /*   multithreading issues. */

ditto

target/m68k/translate.c register_opcode (disas_proc proc, uint16_t opcode, uint16_t mask) · line 5875

Quoted 10 lines
target/m68k/translate.c +2 -1
     if (opcode_table[0] != NULL) {
         return;
     }
 
-    /* use BASE() for instruction available
+    /*
+     * use BASE() for instruction available
      * for CF_ISA_A and M68000.
      */
 #define BASE(name, opcode, mask) \

Thanks,
Laurent