bfd:
[deliverable/binutils-gdb.git] / cpu / ms1.opc
index 57c2913bd146a2fe8cd9f7197b14be0d62bbf985..e3b32db7b94b5beb5064831ae9a1c5ee12d63878 100644 (file)
@@ -89,16 +89,6 @@ ms1_asm_hash (const char* insn)
 
 \f
 /* -- asm.c */
-static int signed_out_of_bounds (long);
-static const char * parse_imm16 (CGEN_CPU_DESC, const char **, int, long *);
-static const char * parse_dup   (CGEN_CPU_DESC, const char **, int, long *);
-static const char * parse_ball  (CGEN_CPU_DESC, const char **, int, long *);
-static const char * parse_xmode (CGEN_CPU_DESC, const char **, int, long *);
-static const char * parse_rc    (CGEN_CPU_DESC, const char **, int, long *);
-static const char * parse_cbrb  (CGEN_CPU_DESC, const char **, int, long *);
-static const char * parse_rbbc  (CGEN_CPU_DESC, const char **, int, long *);
-static const char * parse_type  (CGEN_CPU_DESC, const char **, int, long *);
-
 /* Range checking for signed numbers.  Returns 0 if acceptable
    and 1 if the value is out of bounds for a signed quantity.  */
 
@@ -110,12 +100,38 @@ signed_out_of_bounds (long val)
   return 0;
 }
 
+static const char *
+parse_loopsize (CGEN_CPU_DESC cd,
+               const char **strp,
+               int opindex,
+               void *arg)
+{
+  signed long * valuep = (signed long *) arg;
+  const char *errmsg;
+  bfd_reloc_code_real_type code = BFD_RELOC_NONE;
+  enum cgen_parse_operand_result result_type;
+  bfd_vma value;
+
+  /* Is it a control transfer instructions?  */ 
+  if (opindex == (CGEN_OPERAND_TYPE) MS1_OPERAND_LOOPSIZE)
+    {
+      code = BFD_RELOC_MS1_PCINSN8;
+      errmsg = cgen_parse_address (cd, strp, opindex, code,
+                                   & result_type, & value);
+      *valuep = value;
+      return errmsg;
+    }
+
+  abort ();
+}
+
 static const char *
 parse_imm16 (CGEN_CPU_DESC cd,
             const char **strp,
             int opindex,
-            long *valuep)
+            void *arg)
 {
+  signed long * valuep = (signed long *) arg;
   const char *errmsg;
   enum cgen_parse_operand_result result_type;
   bfd_reloc_code_real_type code = BFD_RELOC_NONE;
@@ -138,7 +154,9 @@ parse_imm16 (CGEN_CPU_DESC cd,
 
   /* If it's not a control transfer instruction, then
      we have to check for %OP relocating operators.  */
-  if (strncmp (*strp, "%hi16", 5) == 0)
+  if (opindex == (CGEN_OPERAND_TYPE) MS1_OPERAND_IMM16L)
+    ;
+  else if (strncmp (*strp, "%hi16", 5) == 0)
     {
       *strp += 5;
       code = BFD_RELOC_HI16;
@@ -218,9 +236,9 @@ parse_imm16 (CGEN_CPU_DESC cd,
       else  
        {
           /* MS1_OPERAND_IMM16Z.  Parse as an unsigned integer.  */
-          errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, valuep);
+          errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, (unsigned long *) valuep);
 
-         if (opindex == (CGEN_OPERAND_TYPE)MS1_OPERAND_IMM16
+         if (opindex == (CGEN_OPERAND_TYPE) MS1_OPERAND_IMM16
              && *valuep >= 0x8000
              && *valuep <= 0xffff)
            *valuep -= 0x10000;
@@ -235,7 +253,7 @@ static const char *
 parse_dup (CGEN_CPU_DESC cd,
           const char **strp,
           int opindex,
-          long *valuep)
+          unsigned long *valuep)
 {
   const char *errmsg = NULL;
 
@@ -260,7 +278,7 @@ static const char *
 parse_ball (CGEN_CPU_DESC cd,
            const char **strp,
            int opindex,
-           long *valuep)
+           unsigned long *valuep)
 {
   const char *errmsg = NULL;
 
@@ -284,7 +302,7 @@ static const char *
 parse_xmode (CGEN_CPU_DESC cd,
             const char **strp,
             int opindex,
-            long *valuep)
+            unsigned long *valuep)
 {
   const char *errmsg = NULL;
 
@@ -308,7 +326,7 @@ static const char *
 parse_rc (CGEN_CPU_DESC cd,
          const char **strp,
          int opindex,
-         long *valuep)
+         unsigned long *valuep)
 {
   const char *errmsg = NULL;
 
@@ -332,7 +350,7 @@ static const char *
 parse_cbrb (CGEN_CPU_DESC cd,
            const char **strp,
            int opindex,
-           long *valuep)
+           unsigned long *valuep)
 {
   const char *errmsg = NULL;
 
@@ -356,7 +374,7 @@ static const char *
 parse_rbbc (CGEN_CPU_DESC cd,
            const char **strp,
            int opindex,
-           long *valuep)
+           unsigned long *valuep)
 {
   const char *errmsg = NULL;
 
@@ -390,7 +408,7 @@ static const char *
 parse_type (CGEN_CPU_DESC cd,
            const char **strp,
            int opindex,
-           long *valuep)
+           unsigned long *valuep)
 {
   const char *errmsg = NULL;
 
@@ -420,6 +438,7 @@ parse_type (CGEN_CPU_DESC cd,
 
 /* -- dis.c */
 static void print_dollarhex (CGEN_CPU_DESC, PTR, long, unsigned, bfd_vma, int);
+static void print_pcrel (CGEN_CPU_DESC, PTR, long, unsigned, bfd_vma, int);
 
 static void
 print_dollarhex (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
@@ -431,12 +450,22 @@ print_dollarhex (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 {
   disassemble_info *info = (disassemble_info *) dis_info;
 
-  info->fprintf_func (info->stream, "$%x", value);
+  info->fprintf_func (info->stream, "$%lx", value);
 
   if (0)
     print_normal (cd, dis_info, value, attrs, pc, length);
 }
 
+static void
+print_pcrel (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
+            void * dis_info,
+            long value,
+            unsigned int attrs ATTRIBUTE_UNUSED,
+            bfd_vma pc ATTRIBUTE_UNUSED,
+            int length ATTRIBUTE_UNUSED)
+{
+  print_address (cd, dis_info, value + pc, attrs, pc, length);
+}
 
 /* -- */
 
This page took 0.108451 seconds and 4 git commands to generate.