Skip to contentSkip to conversation

m68k: 680x0 processors family support

PATCH In review Laurent Vivier 4 participants 8 messages Jun 21, 2015 – Jun 22, 2015

lore
Share & tools
lore
#0 lore raw

cover m68k: 680x0 processors family support

I carry this series for several years now.

I was reluctant to merge it with the mainstream because I was sure it was breaking Coldfire support.

But with the kernel provided by Greg Ungerer I was able to check and correct the support of ColdFire family in my tree.

This series allows:
- to start a ColdFire semi-hosted kernel (m68k-softmmu)
- chroot or start a container of debian etch-m68k (m68k-linux-user)

I have another series providing privileged instructions and allowing to boot a 680x0 debian kernel (Macintosh Quadra 800), but this one needs more work (and love). Based on this work, we will also be able to boot a NextStation (Bryce Lanham, GSoC)

This work is based on the work of Andreas Schwab.

Laurent Vivier (2):
m68k: Add compatibility with 680x0 processors family
m68k: Implement 680x0 processors family 96 bit FPU

 configure                  |    2 +-
 cpu-exec.c                 |    6 -
 disas.c                    |    4 +
 fpu/softfloat-specialize.h |   48 +-
 fpu/softfloat.c            |   38 +-
 gdb-xml/m68k-fp.xml        |   21 +
 include/fpu/softfloat.h    |   11 +-
 target-m68k/cpu.c          |   67 +-
 target-m68k/cpu.h          |   76 +-
 target-m68k/helper.c       | 1691 ++++++++++++++++++--
 target-m68k/helper.h       |  100 +-
 target-m68k/m68k-qreg.h    |   11 -
 target-m68k/op_helper.c    |  182 ++-
 target-m68k/qregs.def      |    6 +-
 target-m68k/translate.c    | 3682 +++++++++++++++++++++++++++++++++++---------
 15 files changed, 5013 insertions(+), 932 deletions(-)
 create mode 100644 gdb-xml/m68k-fp.xml
 delete mode 100644 target-m68k/m68k-qreg.h
Signature · 1 line
2.4.3
#1 lore raw

PATCH 1/2 m68k: Add compatibility with 680x0 processors family

This patch adds all non-privileged instructions of the 680x0 family. The FPU is not modified and we always use the ColdFire FPU emulation, so some 680x0 FPU instructions are missing.

---
 cpu-exec.c              |    6 -
 disas.c                 |    4 +
 target-m68k/cpu.c       |   58 +-
 target-m68k/cpu.h       |   38 +-
 target-m68k/helper.c    |  823 +++++++++++++----
 target-m68k/helper.h    |   56 +-
 target-m68k/m68k-qreg.h |   11 -
 target-m68k/op_helper.c |  182 +++-
 target-m68k/qregs.def   |    1 +
 target-m68k/translate.c | 2332 +++++++++++++++++++++++++++++++++++++----------
 10 files changed, 2836 insertions(+), 675 deletions(-)
 delete mode 100644 target-m68k/m68k-qreg.h
cpu-exec.c +0 -6
index 2ffeb6e..e6c512e 100644
@@ -183,12 +183,6 @@ static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, uint8_t *tb_ptr)
     if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) {
 #if defined(TARGET_I386)
         log_cpu_state(cpu, CPU_DUMP_CCOP);
-#elif defined(TARGET_M68K)
-        /* ??? Should not modify env state for dumping.  */
-        cpu_m68k_flush_flags(env, env->cc_op);
-        env->cc_op = CC_OP_FLAGS;
-        env->sr = (env->sr & 0xffe0) | env->cc_dest | (env->cc_x << 4);
-        log_cpu_state(cpu, 0);
 #else
         log_cpu_state(cpu, 0);
 #endif
disas.c +4 -0
index 44a019a..cee0b3a 100644
@@ -193,6 +193,7 @@ static int print_insn_od_target(bfd_vma pc, disassemble_info *info)
     arm  - bit 0 = thumb, bit 1 = reverse endian, bit 2 = A64
     ppc  - bits 0:15 specify (optionally) the machine instruction set;
            bit 16 indicates little endian.
+    m68k - 1 means 680x0 family, otherwise coldfire
     other targets - unused
  */
 void target_disas(FILE *out, CPUArchState *env, target_ulong code,
@@ -269,6 +270,9 @@ void target_disas(FILE *out, CPUArchState *env, target_ulong code,
     print_insn = print_insn_ppc;
 #elif defined(TARGET_M68K)
     print_insn = print_insn_m68k;
+    if (flags) {
+        s.info.mach = bfd_mach_m68040;
+    }
 #elif defined(TARGET_MIPS)
 #ifdef TARGET_WORDS_BIGENDIAN
     print_insn = print_insn_big_mips;
target-m68k/cpu.c +55 -3

82 lines not on this page · raw message

target-m68k/cpu.h +30 -8
index 5f165da..7a8eabf 100644
@@ -90,6 +90,9 @@ typedef struct CPUM68KState {
     uint32_t div1;
     uint32_t div2;
 
+    /* Upper 32 bits of a 64bit operand for quad MUL/DIV.  */
+    uint32_t quadh;
+
     /* MMU status.  */
     struct {
         uint32_t ar;
@@ -123,20 +126,31 @@ int cpu_m68k_exec(CPUM68KState *s);
    is returned if the signal was handled by the virtual CPU.  */
 int cpu_m68k_signal_handler(int host_signum, void *pinfo,
                            void *puc);
-void cpu_m68k_flush_flags(CPUM68KState *, int);
 
-enum {
+typedef enum {
     CC_OP_DYNAMIC, /* Use env->cc_op  */
     CC_OP_FLAGS, /* CC_DEST = CVZN, CC_SRC = unused */
+    CC_OP_LOGICB, /* CC_DEST = result, CC_SRC = unused */
+    CC_OP_LOGICW, /* CC_DEST = result, CC_SRC = unused */
     CC_OP_LOGIC, /* CC_DEST = result, CC_SRC = unused */
+    CC_OP_ADDB,   /* CC_DEST = result, CC_SRC = source */
+    CC_OP_ADDW,   /* CC_DEST = result, CC_SRC = source */
     CC_OP_ADD,   /* CC_DEST = result, CC_SRC = source */
+    CC_OP_SUBB,   /* CC_DEST = result, CC_SRC = source */
+    CC_OP_SUBW,   /* CC_DEST = result, CC_SRC = source */
     CC_OP_SUB,   /* CC_DEST = result, CC_SRC = source */
-    CC_OP_CMPB,  /* CC_DEST = result, CC_SRC = source */
-    CC_OP_CMPW,  /* CC_DEST = result, CC_SRC = source */
+    CC_OP_ADDXB,  /* CC_DEST = result, CC_SRC = source */
+    CC_OP_ADDXW,  /* CC_DEST = result, CC_SRC = source */
     CC_OP_ADDX,  /* CC_DEST = result, CC_SRC = source */
+    CC_OP_SUBXB,  /* CC_DEST = result, CC_SRC = source */
+    CC_OP_SUBXW,  /* CC_DEST = result, CC_SRC = source */
     CC_OP_SUBX,  /* CC_DEST = result, CC_SRC = source */
+    CC_OP_SHIFTB, /* CC_DEST = result, CC_SRC = carry */
+    CC_OP_SHIFTW, /* CC_DEST = result, CC_SRC = carry */
     CC_OP_SHIFT, /* CC_DEST = result, CC_SRC = carry */
-};
+
+    CC_OP_NB,
+} CCOp;
 
 #define CCF_C 0x01
 #define CCF_V 0x02
@@ -179,6 +193,7 @@ void do_m68k_semihosting(CPUM68KState *env, int nr);
    ISA revisions mentioned.  */
 
 enum m68k_features {
+    M68K_FEATURE_M68000,
     M68K_FEATURE_CF_ISA_A,
     M68K_FEATURE_CF_ISA_B, /* (ISA B or C).  */
     M68K_FEATURE_CF_ISA_APLUSC, /* BIT/BITREV, FF1, STRLDSR (ISA A+ or C).  */
@@ -189,7 +204,14 @@ enum m68k_features {
     M68K_FEATURE_CF_EMAC_B, /* Revision B EMAC (dual accumulate).  */
     M68K_FEATURE_USP, /* User Stack Pointer.  (ISA A+, B or C).  */
     M68K_FEATURE_EXT_FULL, /* 68020+ full extension word.  */
-    M68K_FEATURE_WORD_INDEX /* word sized address index registers.  */
+    M68K_FEATURE_WORD_INDEX, /* word sized address index registers.  */
+    M68K_FEATURE_SCALED_INDEX, /* scaled address index registers.  */
+    M68K_FEATURE_LONG_MULDIV, /* 32 bit multiply/divide. */
+    M68K_FEATURE_QUAD_MULDIV, /* 64 bit multiply/divide. */
+    M68K_FEATURE_BCCL,        /* Long conditional branches.  */
+    M68K_FEATURE_BITFIELD,    /* Bit field insns.  */
+    M68K_FEATURE_FPU,
+    M68K_FEATURE_CAS
 };
 
 static inline int m68k_feature(CPUM68KState *env, int feature)
@@ -202,8 +224,8 @@ void m68k_cpu_list(FILE *f, fprintf_function cpu_fprintf);
 void register_m68k_insns (CPUM68KState *env);
 
 #ifdef CONFIG_USER_ONLY
-/* Linux uses 8k pages.  */
-#define TARGET_PAGE_BITS 13
+/* Linux uses 4k pages.  */
+#define TARGET_PAGE_BITS 12
 #else
 /* Smallest TLB entry size is 1k.  */
 #define TARGET_PAGE_BITS 10
target-m68k/helper.c +658 -165

918 lines not on this page · raw message

target-m68k/helper.h +49 -7

68 lines not on this page · raw message

target-m68k/m68k-qreg.h deleted +0 -11
deleted file mode 100644
index c224d5e..0000000
@@ -1,11 +0,0 @@
-enum {
-#define DEFO32(name, offset) QREG_##name,
-#define DEFR(name, reg, mode) QREG_##name,
-#define DEFF64(name, offset) QREG_##name,
-    QREG_NULL,
-#include "qregs.def"
-    TARGET_NUM_QREGS = 0x100
-#undef DEFO32
-#undef DEFR
-#undef DEFF64
-};
target-m68k/op_helper.c +171 -11

196 lines not on this page · raw message

target-m68k/qregs.def +1 -0
index 204663e..aba6c9a 100644
@@ -7,5 +7,6 @@ DEFO32(CC_SRC, cc_src)
 DEFO32(CC_X, cc_x)
 DEFO32(DIV1, div1)
 DEFO32(DIV2, div2)
+DEFO32(QUADH, quadh)
 DEFO32(MACSR, macsr)
 DEFO32(MAC_MASK, mac_mask)
target-m68k/translate.c +1868 -464

1,614 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.4.3

Part of the diff is not shown here. View the raw message.

#2 lore raw

PATCH 2/2 m68k: Implement 680x0 processors family 96 bit FPU

In reply to Laurent Vivier
---
 configure                  |   2 +-
 fpu/softfloat-specialize.h |  48 ++-
 fpu/softfloat.c            |  38 +-
 gdb-xml/m68k-fp.xml        |  21 +
 include/fpu/softfloat.h    |  11 +-
 target-m68k/cpu.c          |   9 +
 target-m68k/cpu.h          |  38 +-
 target-m68k/helper.c       | 868 +++++++++++++++++++++++++++++++++++++++++-
 target-m68k/helper.h       |  44 +++
 target-m68k/qregs.def      |   5 +-
 target-m68k/translate.c    | 930 ++++++++++++++++++++++++++++++++++++++++++++-
 11 files changed, 1967 insertions(+), 47 deletions(-)
 create mode 100644 gdb-xml/m68k-fp.xml
configure +1 -1
index 4a66b2e..a282979 100755
@@ -5211,7 +5211,7 @@ case "$target_name" in
   ;;
   m68k)
     bflt="yes"
-    gdb_xml_files="cf-core.xml cf-fp.xml"
+    gdb_xml_files="cf-core.xml cf-fp.xml m68k-fp.xml"
   ;;
   microblaze|microblazeel)
     TARGET_ARCH=microblaze
fpu/softfloat-specialize.h +44 -4

84 lines not on this page · raw message

fpu/softfloat.c +26 -12
index f1170fe..19992a9 100644
@@ -902,7 +902,9 @@ static floatx80 roundAndPackFloatx80(int8 roundingPrecision, flag zSign,
                ) {
                 return packFloatx80( zSign, 0x7FFE, ~ roundMask );
             }
-            return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
+            return packFloatx80(zSign,
+                                floatx80_default_inf_high,
+                                floatx80_default_inf_low);
         }
         if ( zExp <= 0 ) {
             isTiny =
@@ -1861,7 +1863,9 @@ floatx80 float32_to_floatx80(float32 a, float_status *status)
         if (aSig) {
             return commonNaNToFloatx80(float32ToCommonNaN(a, status), status);
         }
-        return packFloatx80( aSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
+        return packFloatx80(aSign,
+                            floatx80_default_inf_high,
+                            floatx80_default_inf_low);
     }
     if ( aExp == 0 ) {
         if ( aSig == 0 ) return packFloatx80( aSign, 0, 0 );
@@ -3633,7 +3637,9 @@ floatx80 float64_to_floatx80(float64 a, float_status *status)
         if (aSig) {
             return commonNaNToFloatx80(float64ToCommonNaN(a, status), status);
         }
-        return packFloatx80( aSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
+        return packFloatx80(aSign,
+                            floatx80_default_inf_high,
+                            floatx80_default_inf_low);
     }
     if ( aExp == 0 ) {
         if ( aSig == 0 ) return packFloatx80( aSign, 0, 0 );
@@ -4878,8 +4884,8 @@ int64 floatx80_to_int64(floatx80 a, float_status *status)
         if ( shiftCount ) {
             float_raise(float_flag_invalid, status);
             if (    ! aSign
-                 || (    ( aExp == 0x7FFF )
-                      && ( aSig != LIT64( 0x8000000000000000 ) ) )
+                 || ((aExp == floatx80_default_inf_high)
+                     && (aSig != floatx80_default_inf_low))
                ) {
                 return LIT64( 0x7FFFFFFFFFFFFFFF );
             }
@@ -5150,7 +5156,9 @@ static floatx80 addFloatx80Sigs(floatx80 a, floatx80 b, flag zSign,
             if ((uint64_t)(bSig << 1)) {
                 return propagateFloatx80NaN(a, b, status);
             }
-            return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
+            return packFloatx80(zSign,
+                                floatx80_default_inf_high,
+                                floatx80_default_inf_low);
         }
         if ( aExp == 0 ) ++expDiff;
         shift64ExtraRightJamming( aSig, 0, - expDiff, &aSig, &zSig1 );
@@ -5228,7 +5236,8 @@ static floatx80 subFloatx80Sigs(floatx80 a, floatx80 b, flag zSign,
         if ((uint64_t)(bSig << 1)) {
             return propagateFloatx80NaN(a, b, status);
         }
-        return packFloatx80( zSign ^ 1, 0x7FFF, LIT64( 0x8000000000000000 ) );
+        return packFloatx80(zSign ^ 1, floatx80_default_inf_high,
+                            floatx80_default_inf_low);
     }
     if ( aExp == 0 ) ++expDiff;
     shift128RightJamming( aSig, 0, - expDiff, &aSig, &zSig1 );
@@ -5322,7 +5331,8 @@ floatx80 floatx80_mul(floatx80 a, floatx80 b, float_status *status)
             return propagateFloatx80NaN(a, b, status);
         }
         if ( ( bExp | bSig ) == 0 ) goto invalid;
-        return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
+        return packFloatx80(zSign, floatx80_default_inf_high,
+                                   floatx80_default_inf_low);
     }
     if ( bExp == 0x7FFF ) {
         if ((uint64_t)(bSig << 1)) {
@@ -5335,7 +5345,8 @@ floatx80 floatx80_mul(floatx80 a, floatx80 b, float_status *status)
             z.high = floatx80_default_nan_high;
             return z;
         }
-        return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
+        return packFloatx80(zSign, floatx80_default_inf_high,
+                            floatx80_default_inf_low);
     }
     if ( aExp == 0 ) {
         if ( aSig == 0 ) return packFloatx80( zSign, 0, 0 );
@@ -5386,7 +5397,8 @@ floatx80 floatx80_div(floatx80 a, floatx80 b, float_status *status)
             }
             goto invalid;
         }
-        return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
+        return packFloatx80(zSign, floatx80_default_inf_high,
+                                   floatx80_default_inf_low);
     }
     if ( bExp == 0x7FFF ) {
         if ((uint64_t)(bSig << 1)) {
@@ -5404,7 +5416,8 @@ floatx80 floatx80_div(floatx80 a, floatx80 b, float_status *status)
                 return z;
             }
             float_raise(float_flag_divbyzero, status);
-            return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
+            return packFloatx80(zSign, floatx80_default_inf_high,
+                                       floatx80_default_inf_low);
         }
         normalizeFloatx80Subnormal( bSig, &bExp, &bSig );
     }
@@ -6118,7 +6131,8 @@ floatx80 float128_to_floatx80(float128 a, float_status *status)
         if ( aSig0 | aSig1 ) {
             return commonNaNToFloatx80(float128ToCommonNaN(a, status), status);
         }
-        return packFloatx80( aSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
+        return packFloatx80(aSign, floatx80_default_inf_high,
+                                   floatx80_default_inf_low);
     }
     if ( aExp == 0 ) {
         if ( ( aSig0 | aSig1 ) == 0 ) return packFloatx80( aSign, 0, 0 );
gdb-xml/m68k-fp.xml new file +21 -0
new file mode 100644
index 0000000..64290d1
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2008 Free Software Foundation, Inc.
+
+     Copying and distribution of this file, with or without modification,
+     are permitted in any medium without royalty provided the copyright
+     notice and this notice are preserved.  -->
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.coldfire.fp">
+  <reg name="fp0" bitsize="96" type="float" group="float"/>
+  <reg name="fp1" bitsize="96" type="float" group="float"/>
+  <reg name="fp2" bitsize="96" type="float" group="float"/>
+  <reg name="fp3" bitsize="96" type="float" group="float"/>
+  <reg name="fp4" bitsize="96" type="float" group="float"/>
+  <reg name="fp5" bitsize="96" type="float" group="float"/>
+  <reg name="fp6" bitsize="96" type="float" group="float"/>
+  <reg name="fp7" bitsize="96" type="float" group="float"/>
+
+  <reg name="fpcontrol" bitsize="32" group="float"/>
+  <reg name="fpstatus" bitsize="32" group="float"/>,
+  <reg name="fpiaddr" bitsize="32" type="code_ptr" group="float"/>
+</feature>
include/fpu/softfloat.h +10 -1
index ded34eb..ce6e3ed 100644
@@ -605,6 +605,11 @@ float64 floatx80_to_float64(floatx80, float_status *status);
 float128 floatx80_to_float128(floatx80, float_status *status);
 
 /*----------------------------------------------------------------------------
+| The pattern for a default generated extended double-precision inf.
+*----------------------------------------------------------------------------*/
+extern const floatx80 floatx80_default_inf;
+
+/*----------------------------------------------------------------------------
 | Software IEC/IEEE extended double-precision operations.
 *----------------------------------------------------------------------------*/
 floatx80 floatx80_round_to_int(floatx80, float_status *status);
@@ -643,7 +648,8 @@ static inline floatx80 floatx80_chs(floatx80 a)
 
 static inline int floatx80_is_infinity(floatx80 a)
 {
-    return (a.high & 0x7fff) == 0x7fff && a.low == 0x8000000000000000LL;
+    return (a.high & 0x7fff) == floatx80_default_inf.high &&
+                       a.low == floatx80_default_inf.low;
 }
 
 static inline int floatx80_is_neg(floatx80 a)
@@ -672,6 +678,9 @@ static inline int floatx80_is_any_nan(floatx80 a)
 #define floatx80_pi make_floatx80(0x4000, 0xc90fdaa22168c235LL)
 #define floatx80_half make_floatx80(0x3ffe, 0x8000000000000000LL)
 #define floatx80_infinity make_floatx80(0x7fff, 0x8000000000000000LL)
+#define floatx80_e make_floatx80(0x4000, 0xadf85458a2bb4a9aULL)
+#define floatx80_log2e make_floatx80(0x3fff, 0xb8aa3b295c17f0bcULL)
+#define floatx80_10 make_floatx80(0x4002, 0xa000000000000000ULL)
 
 /*----------------------------------------------------------------------------
 | The pattern for a default generated extended double-precision NaN.
target-m68k/cpu.c +9 -0
index 4c6760b..c79d289 100644
@@ -46,6 +46,7 @@ static void m68k_cpu_reset(CPUState *s)
     M68kCPU *cpu = M68K_CPU(s);
     M68kCPUClass *mcc = M68K_CPU_GET_CLASS(cpu);
     CPUM68KState *env = &cpu->env;
+    int i;
 
     mcc->parent_reset(s);
 
@@ -55,6 +56,14 @@ static void m68k_cpu_reset(CPUState *s)
 #endif
     m68k_switch_sp(env);
 
+    for (i = 0; i < 8; i++) {
+        env->m68k_fregs[i].d = floatx80_default_nan;
+    }
+    env->fp0h = floatx80_default_nan.high;
+    env->fp0l = floatx80_default_nan.low;
+    env->fp1h = floatx80_default_nan.high;
+    env->fp1l = floatx80_default_nan.low;
+
     env->cc_op = CC_OP_FLAGS;
     /* TODO: We should set PC from the interrupt vector.  */
     env->pc = 0;
target-m68k/cpu.h +36 -2
index 7a8eabf..ce2ad0d 100644
@@ -56,6 +56,23 @@
 
 #define NB_MMU_MODES 2
 
+typedef uint32_t CPUM68K_SingleU;
+typedef uint64_t CPUM68K_DoubleU;
+
+typedef struct {
+    uint32_t high;
+    uint64_t low;
+} __attribute__((packed)) CPUM68K_XDoubleU;
+
+typedef struct {
+   uint8_t high[2];
+   uint8_t low[10];
+} __attribute__((packed)) CPUM68K_PDoubleU;
+
+typedef CPU_LDoubleU FPReg;
+#define PRIxFPH PRIx16
+#define PRIxFPL PRIx64
+
 typedef struct CPUM68KState {
     uint32_t dregs[8];
     uint32_t aregs[8];
@@ -72,8 +89,11 @@ typedef struct CPUM68KState {
     uint32_t cc_src;
     uint32_t cc_x;
 
-    float64 fregs[8];
-    float64 fp_result;
+    /* 680x0 */
+    FPReg m68k_fregs[8];
+    /* ColdFire */
+    float64 cf_fregs[8];
+    float64 cf_fp_result;
     uint32_t fpcr;
     uint32_t fpsr;
     float_status fp_status;
@@ -86,6 +106,13 @@ typedef struct CPUM68KState {
     uint32_t macsr;
     uint32_t mac_mask;
 
+    /* Temporary storage for FPU */
+
+    uint32_t fp0h;
+    uint64_t fp0l;
+    uint32_t fp1h;
+    uint64_t fp1l;
+
     /* Temporary storage for DIV helpers.  */
     uint32_t div1;
     uint32_t div2;
@@ -167,6 +194,13 @@ typedef enum {
 #define M68K_SSP    0
 #define M68K_USP    1
 
+#define FCCF_SHIFT 24
+#define FCCF_MASK  (0xff << FCCF_SHIFT)
+#define FCCF_A     (0x01 << FCCF_SHIFT) /* Not-A-Number */
+#define FCCF_I     (0x02 << FCCF_SHIFT) /* Infinity */
+#define FCCF_Z     (0x04 << FCCF_SHIFT) /* Zero */
+#define FCCF_N     (0x08 << FCCF_SHIFT) /* Negative */
+
 /* CACR fields are implementation defined, but some bits are common.  */
 #define M68K_CACR_EUSP  0x10
 
target-m68k/helper.c +862 -6

911 lines not on this page · raw message

target-m68k/helper.h +44 -0

50 lines not on this page · raw message

target-m68k/qregs.def +4 -1
index aba6c9a..af37602 100644
@@ -1,4 +1,6 @@
-DEFF64(FP_RESULT, fp_result)
+DEFF64(FP_RESULT, cf_fp_result)
+DEFF96(FP0, fp0)
+DEFF96(FP1, fp1)
 DEFO32(PC, pc)
 DEFO32(SR, sr)
 DEFO32(CC_OP, cc_op)
@@ -10,3 +12,4 @@ DEFO32(DIV2, div2)
 DEFO32(QUADH, quadh)
 DEFO32(MACSR, macsr)
 DEFO32(MAC_MASK, mac_mask)
+DEFO32(FPSR, fpsr)
target-m68k/translate.c +910 -20

1,032 lines not on this page · raw message

Signature · 1 line
2.4.3
#3 lore raw

Re: [Qemu-devel] [PATCH 2/2] m68k: Implement 680x0 processors family 96 bit FPU

fpu/softfloat-specialize.h const float64 float64_default_nan = const_float64(LIT64( 0xFFF8000000000000 )); · line 143

Quoted 3 lines · Laurent Vivier
fpu/softfloat-specialize.h +3 -0
+#if defined(TARGET_M68K)
+#define floatx80_default_nan_high 0x7FFF
+#define floatx80_default_nan_low  LIT64(0x4000000000000000)

The default NaN generated by the m68k FPU is all-bits-one (this is true for all formats).

Andreas.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#4 lore raw
In reply to Laurent Vivier
Quoted 34 lines · Laurent Vivier

I carry this series for several years now.

I was reluctant to merge it with the mainstream because I was sure it was breaking Coldfire support.

But with the kernel provided by Greg Ungerer I was able to check and correct the support of ColdFire family in my tree.

This series allows:
- to start a ColdFire semi-hosted kernel (m68k-softmmu)
- chroot or start a container of debian etch-m68k (m68k-linux-user)

I have another series providing privileged instructions and allowing to boot a 680x0 debian kernel (Macintosh Quadra 800), but this one needs more work (and love). Based on this work, we will also be able to boot a NextStation (Bryce Lanham, GSoC)

This work is based on the work of Andreas Schwab.

Laurent Vivier (2):
m68k: Add compatibility with 680x0 processors family
m68k: Implement 680x0 processors family 96 bit FPU

 configure                  |    2 +-
 cpu-exec.c                 |    6 -
 disas.c                    |    4 +
 fpu/softfloat-specialize.h |   48 +-
 fpu/softfloat.c            |   38 +-
 gdb-xml/m68k-fp.xml        |   21 +
 include/fpu/softfloat.h    |   11 +-
 target-m68k/cpu.c          |   67 +-
 target-m68k/cpu.h          |   76 +-
 target-m68k/helper.c       | 1691 ++++++++++++++++++--
Quoted 8 lines
 target-m68k/helper.h       |  100 +-
 target-m68k/m68k-qreg.h    |   11 -
 target-m68k/op_helper.c    |  182 ++-
 target-m68k/qregs.def      |    6 +-
 target-m68k/translate.c    | 3682 +++++++++++++++++++++++++++++++++++---------
 15 files changed, 5013 insertions(+), 932 deletions(-)
 create mode 100644 gdb-xml/m68k-fp.xml
 delete mode 100644 target-m68k/m68k-qreg.h

Thanks for sending this. My initial feeling is that this would really benefit from being split up into more patches to make it easier to review.

-- PMM

#5 lore raw
Quoted 44 lines · Peter Maydell
Quoted 34 lines · Laurent Vivier

I carry this series for several years now.

I was reluctant to merge it with the mainstream because I was sure it was breaking Coldfire support.

But with the kernel provided by Greg Ungerer I was able to check and correct the support of ColdFire family in my tree.

This series allows:
- to start a ColdFire semi-hosted kernel (m68k-softmmu)
- chroot or start a container of debian etch-m68k (m68k-linux-user)

I have another series providing privileged instructions and allowing to boot a 680x0 debian kernel (Macintosh Quadra 800), but this one needs more work (and love). Based on this work, we will also be able to boot a NextStation (Bryce Lanham, GSoC)

This work is based on the work of Andreas Schwab.

Laurent Vivier (2):
m68k: Add compatibility with 680x0 processors family
m68k: Implement 680x0 processors family 96 bit FPU

 configure                  |    2 +-
 cpu-exec.c                 |    6 -
 disas.c                    |    4 +
 fpu/softfloat-specialize.h |   48 +-
 fpu/softfloat.c            |   38 +-
 gdb-xml/m68k-fp.xml        |   21 +
 include/fpu/softfloat.h    |   11 +-
 target-m68k/cpu.c          |   67 +-
 target-m68k/cpu.h          |   76 +-
 target-m68k/helper.c       | 1691 ++++++++++++++++++--
Quoted 8 lines
 target-m68k/helper.h       |  100 +-
 target-m68k/m68k-qreg.h    |   11 -
 target-m68k/op_helper.c    |  182 ++-
 target-m68k/qregs.def      |    6 +-
 target-m68k/translate.c    | 3682 +++++++++++++++++++++++++++++++++++---------
 15 files changed, 5013 insertions(+), 932 deletions(-)
 create mode 100644 gdb-xml/m68k-fp.xml
 delete mode 100644 target-m68k/m68k-qreg.h
Quoted 3 lines

Thanks for sending this. My initial feeling is that this would really benefit from being split up into more patches to make it easier to review.

Thank you Peter, I understand.

In fact, in my tree, I have 160 commits I have merged in two big ones ;-) (some are new features, other bug fixes).

So, no problem, just define the granularity, I will create the patches accordingly.

Is it possible to integrate them little by little ? I really want to see my patches stack to decrease.

Laurent

#6 lore raw
Quoted 7 lines · Laurent Vivier
Quoted 3 lines · Peter Maydell

Thanks for sending this. My initial feeling is that this would really benefit from being split up into more patches to make it easier to review.

Thank you Peter, I understand.

Quoted 8 lines

In fact, in my tree, I have 160 commits I have merged in two big ones ;-) (some are new features, other bug fixes).

So, no problem, just define the granularity, I will create the patches accordingly.

Is it possible to integrate them little by little ? I really want to see my patches stack to decrease.

(this is summarising/repeating my remarks on IRC)

Yes, and in fact little by little is my recommendation. My rule of thumb is that individual patches should be ideally less than 250 lines in the diffstat. (But they should also be coherent lumps of functionality, so prefer an occasional larger patch rather than a completely artificial patch split. It's pretty rare that something really doesn't have a sensible split point, though, unless it's a purely mechanical change like a renaming.)

If a patch series gets over 15 or so patches it's pretty oppressive to review all at once, though. I find the easiest thing to do for this kind of thing is extract a coherent thematic subset of the total lump of code, split that into individual patches, and send that as a series. Once that's reviewed and on its way into the tree, then repeat. This is how we did the ARM 64-bit support. It means that if there are general issues (code needing updates to new APIs or best practices, for example) then they'll be caught in review of the first series, and you can then get subsequent series right from the start.

As a random example pulled from the archives, this was about the sixth patchseries for A64 Neon:
https://lists.gnu.org/archive/html/qemu-devel/2014-03/msg01615.html
Each patch implements one insn or a few related insns.

thanks
-- PMM

#7 lore raw
In reply to Laurent Vivier

Hi Laurent,

Quoted 13 lines · Laurent Vivier

I carry this series for several years now.

I was reluctant to merge it with the mainstream because I was sure it was breaking Coldfire support.

But with the kernel provided by Greg Ungerer I was able to check and correct the support of ColdFire family in my tree.

This series allows:
- to start a ColdFire semi-hosted kernel (m68k-softmmu)
- chroot or start a container of debian etch-m68k (m68k-linux-user)

Quoted 6 lines

I have another series providing privileged instructions and allowing to boot a 680x0 debian kernel (Macintosh Quadra 800), but this one needs more work (and love). Based on this work, we will also be able to boot a NextStation (Bryce Lanham, GSoC)

This work is based on the work of Andreas Schwab.

All together that is impressive. Would be nice if you can work to get it all in.

Regards
Greg

Quoted 23 lines

Laurent Vivier (2):
m68k: Add compatibility with 680x0 processors family
m68k: Implement 680x0 processors family 96 bit FPU

  configure                  |    2 +-
  cpu-exec.c                 |    6 -
  disas.c                    |    4 +
  fpu/softfloat-specialize.h |   48 +-
  fpu/softfloat.c            |   38 +-
  gdb-xml/m68k-fp.xml        |   21 +
  include/fpu/softfloat.h    |   11 +-
  target-m68k/cpu.c          |   67 +-
  target-m68k/cpu.h          |   76 +-
  target-m68k/helper.c       | 1691 ++++++++++++++++++--
  target-m68k/helper.h       |  100 +-
  target-m68k/m68k-qreg.h    |   11 -
  target-m68k/op_helper.c    |  182 ++-
  target-m68k/qregs.def      |    6 +-
  target-m68k/translate.c    | 3682 +++++++++++++++++++++++++++++++++++---------
  15 files changed, 5013 insertions(+), 932 deletions(-)

create mode 100644 gdb-xml/m68k-fp.xml
delete mode 100644 target-m68k/m68k-qreg.h