Coverage Report

Created: 2026-03-10 08:46

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/binutils-gdb/opcodes/csky-dis.c
Line
Count
Source
1
/* C-SKY disassembler.
2
   Copyright (C) 1988-2026 Free Software Foundation, Inc.
3
   Contributed by C-SKY Microsystems and Mentor Graphics.
4
5
   This file is part of the GNU opcodes library.
6
7
   This library is free software; you can redistribute it and/or modify
8
   it under the terms of the GNU General Public License as published by
9
   the Free Software Foundation; either version 3, or (at your option)
10
   any later version.
11
12
   It is distributed in the hope that it will be useful, but WITHOUT
13
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14
   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
15
   License for more details.
16
17
   You should have received a copy of the GNU General Public License
18
   along with this program; if not, write to the Free Software
19
   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20
   MA 02110-1301, USA.  */
21
22
#include "sysdep.h"
23
#include "config.h"
24
#include <stdio.h>
25
#include <stdint.h>
26
#include <elf/csky.h>
27
#include "disassemble.h"
28
#include "elf-bfd.h"
29
#include "opcode/csky.h"
30
#include "libiberty.h"
31
#include "csky-opc.h"
32
#include "floatformat.h"
33
34
690k
#define CSKY_INST_TYPE unsigned long
35
178M
#define HAS_SUB_OPERAND (unsigned int)0xffffffff
36
865
#define CSKY_DEFAULT_ISA 0xffffffff
37
38
enum sym_type
39
{
40
  CUR_TEXT,
41
  CUR_DATA
42
};
43
44
struct csky_dis_info
45
{
46
  /* Mem to disassemble.  */
47
  bfd_vma mem;
48
  /* Disassemble info.  */
49
  disassemble_info *info;
50
  /* Opcode information.  */
51
  struct csky_opcode_info const *opinfo;
52
  uint64_t isa;
53
  /* The value of operand to show.  */
54
  int value;
55
  /* Whether to look up/print a symbol name.  */
56
  int need_output_symbol;
57
} dis_info;
58
59
60
enum sym_type last_type;
61
int last_map_sym = 1;
62
bfd_vma last_map_addr = 0;
63
int using_abi = 0;
64
65
/* Only for objdump tool.  */
66
1.63M
#define INIT_MACH_FLAG  0xffffffff
67
2.07M
#define BINARY_MACH_FLAG 0x0
68
69
static unsigned int mach_flag = INIT_MACH_FLAG;
70
71
static void
72
print_insn_data (bfd_vma pc ATTRIBUTE_UNUSED,
73
     struct disassemble_info *info,
74
     long given)
75
0
{
76
0
  switch (info->bytes_per_chunk)
77
0
    {
78
0
    case 1:
79
0
      info->fprintf_func (info->stream, ".byte\t0x%02lx", given);
80
0
      break;
81
0
    case 2:
82
0
      info->fprintf_func (info->stream, ".short\t0x%04lx", given);
83
0
      break;
84
0
    case 4:
85
0
      info->fprintf_func (info->stream, ".long\t0x%08lx", given);
86
0
      break;
87
0
    default:
88
0
      abort ();
89
0
    }
90
0
}
91
92
static int
93
get_sym_code_type (struct disassemble_info *info,
94
       int n,
95
       enum sym_type *sym_type)
96
0
{
97
0
  const char *name;
98
0
  name = bfd_asymbol_name (info->symtab[n]);
99
0
  if (name[0] == '$' && (name[1] == 't' || name[1] == 'd')
100
0
      && (name[2] == 0 || name[2] == '.'))
101
0
    {
102
0
      *sym_type = ((name[1] == 't') ? CUR_TEXT : CUR_DATA);
103
0
      return true;
104
0
    }
105
0
  return false;
106
0
}
107
108
static int
109
csky_get_operand_mask (struct operand const *oprnd)
110
177M
{
111
177M
  int mask = 0;
112
177M
  if (oprnd->mask == HAS_SUB_OPERAND)
113
8.64M
    {
114
8.64M
      struct soperand *sop = (struct soperand *)oprnd;
115
8.64M
      mask |= csky_get_operand_mask (&sop->subs[0]);
116
8.64M
      mask |= csky_get_operand_mask (&sop->subs[1]);
117
8.64M
      return mask;
118
8.64M
    }
119
169M
  return oprnd->mask;
120
177M
}
121
122
static int
123
csky_get_mask (struct csky_opcode_info const *pinfo)
124
415M
{
125
415M
  int i = 0;
126
415M
  int mask = 0;
127
  /* List type.  */
128
415M
  if (pinfo->operand_num == -1)
129
1.19M
    mask |= csky_get_operand_mask (&pinfo->oprnd.oprnds[i]);
130
414M
  else
131
573M
    for (; i < pinfo->operand_num; i++)
132
159M
      mask |= csky_get_operand_mask (&pinfo->oprnd.oprnds[i]);
133
134
415M
  mask = ~mask;
135
415M
  return mask;
136
415M
}
137
138
static unsigned int
139
csky_chars_to_number (unsigned char * buf, int n)
140
65.7k
{
141
65.7k
  int i;
142
65.7k
  unsigned int val = 0;
143
144
65.7k
  if (dis_info.info->endian == BFD_ENDIAN_BIG)
145
203k
    for (i = 0; i < n; i++)
146
162k
      val = val << 8 | buf[i];
147
25.1k
  else
148
125k
    for (i = n - 1; i >= 0; i--)
149
100k
      val = val << 8 | buf[i];
150
65.7k
  return val;
151
65.7k
}
152
153
static struct csky_opcode const *g_opcodeP;
154
155
static struct csky_opcode const *
156
csky_find_inst_info (struct csky_opcode_info const **pinfo,
157
         CSKY_INST_TYPE inst, int length)
158
690k
{
159
690k
  int i;
160
690k
  unsigned int mask;
161
690k
  struct csky_opcode const *p;
162
163
690k
  p = g_opcodeP;
164
240M
  while (p->mnemonic)
165
240M
    {
166
240M
  if (!(p->isa_flag16 & dis_info.isa)
167
196M
        && !(p->isa_flag32 & dis_info.isa))
168
32.6M
  {
169
32.6M
    p++;
170
32.6M
    continue;
171
32.6M
  }
172
173
      /* Get the opcode mask.  */
174
623M
      for (i = 0; i < OP_TABLE_NUM; i++)
175
415M
  if (length == 2)
176
371M
    {
177
371M
      mask =  csky_get_mask (&p->op16[i]);
178
371M
      if (mask != 0 && (inst & mask) == p->op16[i].opcode)
179
577k
        {
180
577k
    *pinfo = &p->op16[i];
181
577k
    g_opcodeP = p;
182
577k
    return p;
183
577k
        }
184
371M
    }
185
44.0M
  else if (length == 4)
186
44.0M
    {
187
44.0M
      mask =  csky_get_mask (&p->op32[i]);
188
44.0M
      if (mask != 0
189
44.0M
    && ((unsigned long)(inst & mask)
190
44.0M
        == (unsigned long)p->op32[i].opcode))
191
19.5k
        {
192
19.5k
    *pinfo = &p->op32[i];
193
19.5k
    g_opcodeP = p;
194
19.5k
    return p;
195
19.5k
        }
196
44.0M
    }
197
207M
      p++;
198
207M
    }
199
200
93.6k
  return NULL;
201
690k
}
202
203
static bool
204
is_extern_symbol (struct disassemble_info *info, int addr)
205
54.2k
{
206
54.2k
  unsigned int rel_count = 0;
207
208
54.2k
  if (info->section == NULL)
209
14.3k
    return 0;
210
39.8k
  if ((info->section->flags & SEC_RELOC) != 0)  /* Fit .o file.  */
211
0
    {
212
0
      struct reloc_cache_entry *pt = info->section->relocation;
213
0
      for (; rel_count < info->section->reloc_count; rel_count++, pt++)
214
0
  if ((long unsigned int)addr == pt->address)
215
0
    return true;
216
0
      return false;
217
0
    }
218
39.8k
  return false;
219
39.8k
}
220
221
222
/* Suppress printing of mapping symbols emitted by the assembler to mark
223
   the beginning of code and data sequences.  */
224
225
bool
226
csky_symbol_is_valid (asymbol *sym,
227
          struct disassemble_info *info ATTRIBUTE_UNUSED)
228
0
{
229
0
  const char *name;
230
231
0
  if (sym == NULL)
232
0
    return false;
233
0
  name = bfd_asymbol_name (sym);
234
0
  return name && *name != '$';
235
0
}
236
237
disassembler_ftype
238
csky_get_disassembler (bfd *abfd)
239
863
{
240
863
  obj_attribute *attr;
241
863
  const char *sec_name = NULL;
242
863
  if (!abfd || bfd_get_flavour (abfd) != bfd_target_elf_flavour)
243
762
    dis_info.isa = CSKY_DEFAULT_ISA;
244
101
  else
245
101
    {
246
101
      mach_flag = elf_elfheader (abfd)->e_flags;
247
248
101
      sec_name = get_elf_backend_data (abfd)->obj_attrs_section;
249
      /* Skip any input that hasn't attribute section.
250
         This enables to link object files without attribute section with
251
         any others.  */
252
101
      if (bfd_get_section_by_name (abfd, sec_name) != NULL)
253
0
        {
254
0
          attr = elf_known_obj_attributes_proc (abfd);
255
0
          dis_info.isa = attr[Tag_CSKY_ISA_EXT_FLAGS].i;
256
0
          dis_info.isa <<= 32;
257
0
          dis_info.isa |= attr[Tag_CSKY_ISA_FLAGS].i;
258
0
        }
259
101
      else
260
101
        dis_info.isa = CSKY_DEFAULT_ISA;
261
101
    }
262
263
863
   return print_insn_csky;
264
863
}
265
266
/* Parse a disassembler option.  */
267
static bool
268
parse_csky_option (const char *opt, void *data ATTRIBUTE_UNUSED)
269
2.27k
{
270
2.27k
  if (strcmp (opt, "abi-names") == 0)
271
86
    using_abi = 1;
272
2.19k
  else
273
2.19k
    fprintf (stderr, "unrecognized disassembler option: %s", opt);
274
2.27k
  return true;
275
2.27k
}
276
277
/* Get general register name.  */
278
static const char *
279
get_gr_name (int regno)
280
725k
{
281
725k
  return csky_get_general_reg_name (mach_flag, regno, using_abi);
282
725k
}
283
284
/* Get control register name.  */
285
static const char *
286
get_cr_name (unsigned int regno, int bank)
287
2.62k
{
288
2.62k
  return csky_get_control_reg_name (mach_flag, bank, regno, using_abi);
289
2.62k
}
290
291
static int
292
csky_output_operand (char *str, struct operand const *oprnd,
293
         CSKY_INST_TYPE inst, int reloc ATTRIBUTE_UNUSED)
294
1.13M
{
295
1.13M
  int ret = 0;;
296
1.13M
  int bit = 0;
297
1.13M
  int result = 0;
298
1.13M
  bfd_vma value;
299
1.13M
  int mask = oprnd->mask;
300
1.13M
  int max = 0;
301
1.13M
  char buf[128];
302
303
  /* Get operand value with mask.  */
304
1.13M
  value = inst & mask;
305
10.6M
  for (; mask; mask >>= 1, value >>=1)
306
9.47M
    if (mask & 0x1)
307
5.24M
      {
308
5.24M
  result |= ((value & 0x1) << bit);
309
5.24M
  max |= (1 << bit);
310
5.24M
  bit++;
311
5.24M
      }
312
1.13M
  value = result;
313
314
  /* Here is general instructions that have no reloc.  */
315
1.13M
  switch (oprnd->type)
316
1.13M
    {
317
2.64k
    case OPRND_TYPE_CTRLREG:
318
2.64k
  if (IS_CSKY_V1(mach_flag) && ((value & 0x1f) == 0x1f))
319
23
    return -1;
320
2.62k
  strcat (str, get_cr_name((value & 0x1f), (value >> 5)));
321
2.62k
  break;
322
19.5k
    case OPRND_TYPE_DUMMY_REG:
323
19.5k
      mask = dis_info.opinfo->oprnd.oprnds[0].mask;
324
19.5k
      value = inst & mask;
325
97.5k
      for (; mask; mask >>= 1, value >>=1)
326
78.0k
  if (mask & 0x1)
327
78.0k
    {
328
78.0k
      result |= ((value & 0x1) << bit);
329
78.0k
      bit++;
330
78.0k
    }
331
19.5k
      value = result;
332
19.5k
      strcat (str, get_gr_name (value));
333
19.5k
      break;
334
360k
    case OPRND_TYPE_GREG0_7:
335
626k
    case OPRND_TYPE_GREG0_15:
336
626k
    case OPRND_TYPE_GREG16_31:
337
631k
    case OPRND_TYPE_REGnsplr:
338
645k
    case OPRND_TYPE_AREG:
339
645k
      strcat (str, get_gr_name (value));
340
645k
      break;
341
1.80k
    case OPRND_TYPE_CPREG:
342
1.80k
      sprintf (buf, "cpr%d", (int)value);
343
1.80k
      strcat (str, buf);
344
1.80k
      break;
345
273
    case OPRND_TYPE_FREG:
346
273
      sprintf (buf, "fr%d", (int)value);
347
273
      strcat (str, buf);
348
273
      break;
349
859
    case OPRND_TYPE_VREG:
350
859
      dis_info.value = value;
351
859
      sprintf (buf, "vr%d", (int)value);
352
859
      strcat (str, buf);
353
859
      break;
354
733
    case OPRND_TYPE_CPCREG:
355
733
      sprintf (buf, "cpcr%d", (int)value);
356
733
      strcat (str, buf);
357
733
      break;
358
1.25k
    case OPRND_TYPE_CPIDX:
359
1.25k
      sprintf (buf, "cp%d", (int)value);
360
1.25k
      strcat (str, buf);
361
1.25k
      break;
362
2.15k
    case OPRND_TYPE_IMM2b_JMPIX:
363
2.15k
      value = (value + 2) << 3;
364
2.15k
      sprintf (buf, "%d", (int)value);
365
2.15k
      strcat (str, buf);
366
2.15k
      break;
367
115k
    case OPRND_TYPE_IMM_LDST:
368
115k
    case OPRND_TYPE_IMM_FLDST:
369
115k
      value <<= oprnd->shift;
370
115k
      sprintf (buf, "0x%x", (unsigned int)value);
371
115k
      strcat (str, buf);
372
115k
      break;
373
6.58k
    case OPRND_TYPE_IMM7b_LS2:
374
15.9k
    case OPRND_TYPE_IMM8b_LS2:
375
15.9k
      sprintf (buf, "%d", (int)(value << 2));
376
15.9k
      strcat (str, buf);
377
15.9k
      ret = 0;
378
15.9k
      break;
379
567
    case OPRND_TYPE_IMM5b_BMASKI:
380
567
      if ((value != 0) && (value > 31 || value < 8))
381
126
  {
382
126
    ret = -1;
383
126
    break;
384
126
  }
385
441
      sprintf (buf, "%d", (int)value);
386
441
      strcat (str, buf);
387
441
      ret = 0;
388
441
      break;
389
2.35k
    case OPRND_TYPE_IMM5b_1_31:
390
2.35k
      if (value > 31 || value < 1)
391
105
  {
392
105
    ret = -1;
393
105
    break;
394
105
  }
395
2.25k
      sprintf (buf, "%d", (int)value);
396
2.25k
      strcat (str, buf);
397
2.25k
      ret = 0;
398
2.25k
      break;
399
1.17k
    case OPRND_TYPE_IMM5b_7_31:
400
1.17k
      if (value > 31 || value < 7)
401
312
  {
402
312
    ret = -1;
403
312
    break;
404
312
  }
405
864
      sprintf (buf, "%d", (int)value);
406
864
      strcat (str, buf);
407
864
      ret = 0;
408
864
      break;
409
2
    case OPRND_TYPE_IMM5b_VSH:
410
2
      {
411
2
  char num[128];
412
2
  value = ((value & 0x1) << 4) | (value >> 1);
413
2
  sprintf (num, "%d", (int)value);
414
2
  strcat (str, num);
415
2
  ret = 0;
416
2
  break;
417
1.17k
      }
418
8
    case OPRND_TYPE_MSB2SIZE:
419
16
    case OPRND_TYPE_LSB2SIZE:
420
16
      {
421
16
  static int size;
422
16
  if (oprnd->type == OPRND_TYPE_MSB2SIZE)
423
8
    size = value;
424
8
  else
425
8
    {
426
8
      str[strlen (str) - 2] = '\0';
427
8
      sprintf (buf, "%d, %d", (int)(size + value), (int)value);
428
8
      strcat (str, buf);
429
8
    }
430
16
  break;
431
8
      }
432
0
    case OPRND_TYPE_IMM1b:
433
519
    case OPRND_TYPE_IMM2b:
434
588
    case OPRND_TYPE_IMM4b:
435
46.2k
    case OPRND_TYPE_IMM5b:
436
46.3k
    case OPRND_TYPE_IMM5b_LS:
437
49.4k
    case OPRND_TYPE_IMM7b:
438
71.1k
    case OPRND_TYPE_IMM8b:
439
74.0k
    case OPRND_TYPE_IMM12b:
440
79.3k
    case OPRND_TYPE_IMM15b:
441
79.4k
    case OPRND_TYPE_IMM16b:
442
79.5k
    case OPRND_TYPE_IMM16b_MOVIH:
443
81.2k
    case OPRND_TYPE_IMM16b_ORI:
444
81.2k
      sprintf (buf, "%d", (int)value);
445
81.2k
      strcat (str, buf);
446
81.2k
      ret = 0;
447
81.2k
      break;
448
1.15k
    case OPRND_TYPE_OFF8b:
449
1.16k
    case OPRND_TYPE_OFF16b:
450
1.16k
      {
451
1.16k
  unsigned char ibytes[4];
452
1.16k
  int shift = oprnd->shift;
453
1.16k
  int status;
454
1.16k
  unsigned int mem_val;
455
456
1.16k
  dis_info.info->stop_vma = 0;
457
458
1.16k
  value = ((dis_info.mem + (value << shift)
459
1.16k
      + ((IS_CSKY_V1 (mach_flag)) ? 2 : 0))
460
1.16k
     & 0xfffffffc);
461
1.16k
  status = dis_info.info->read_memory_func (value, ibytes, 4,
462
1.16k
              dis_info.info);
463
1.16k
  if (status != 0)
464
106
    {
465
106
      dis_info.info->memory_error_func (status, dis_info.mem,
466
106
                dis_info.info);
467
106
      return -1;
468
106
    }
469
1.05k
  mem_val = csky_chars_to_number (ibytes, 4);
470
  /* Remove [] around literal value to match ABI syntax.  */
471
1.05k
  sprintf (buf, "0x%X", mem_val);
472
1.05k
  strcat (str, buf);
473
  /* For jmpi/jsri, we'll try to get a symbol for the target.  */
474
1.05k
  if (dis_info.info->print_address_func && mem_val != 0)
475
986
    {
476
986
      dis_info.value = mem_val;
477
986
      dis_info.need_output_symbol = 1;
478
986
    }
479
72
  else
480
72
    {
481
72
      sprintf (buf, "\t// from address pool at 0x%x",
482
72
         (unsigned int)value);
483
72
      strcat (str, buf);
484
72
    }
485
1.05k
  break;
486
1.16k
      }
487
50
    case OPRND_TYPE_BLOOP_OFF4b:
488
100
    case OPRND_TYPE_BLOOP_OFF12b:
489
22.0k
    case OPRND_TYPE_OFF11b:
490
22.5k
    case OPRND_TYPE_OFF16b_LSL1:
491
23.2k
    case OPRND_TYPE_IMM_OFF18b:
492
26.7k
    case OPRND_TYPE_OFF26b:
493
26.7k
      {
494
26.7k
  int shift = oprnd->shift;
495
26.7k
  if (value & ((max >> 1) + 1))
496
16.8k
    value |= ~max;
497
26.7k
  if (is_extern_symbol (dis_info.info, dis_info.mem))
498
0
    value = 0;
499
26.7k
  else if (IS_CSKY_V1 (mach_flag))
500
21.9k
    value = dis_info.mem + 2 + (value << shift);
501
4.81k
  else
502
4.81k
    value = dis_info.mem + (value << shift);
503
26.7k
  dis_info.need_output_symbol = 1;
504
26.7k
  dis_info.value= value;
505
26.7k
  sprintf (buf, "0x%x", (unsigned int)value);
506
26.7k
  strcat (str, buf);
507
26.7k
  break;
508
23.2k
      }
509
20.5k
    case OPRND_TYPE_CONSTANT:
510
20.5k
    case OPRND_TYPE_FCONSTANT:
511
20.5k
      {
512
20.5k
  int shift = oprnd->shift;
513
20.5k
  bfd_byte ibytes[8];
514
20.5k
  int status;
515
20.5k
  bfd_vma addr;
516
20.5k
  int nbytes;
517
518
20.5k
  dis_info.info->stop_vma = 0;
519
20.5k
  value <<= shift;
520
521
20.5k
  if (IS_CSKY_V1 (mach_flag))
522
5.06k
    addr = (dis_info.mem + 2 + value) & 0xfffffffc;
523
15.4k
  else
524
15.4k
    addr = (dis_info.mem + value) & 0xfffffffc;
525
526
20.5k
  if (oprnd->type == OPRND_TYPE_FCONSTANT
527
0
      && dis_info.opinfo->opcode != CSKYV2_INST_FLRW)
528
0
    nbytes = 8;
529
20.5k
  else
530
20.5k
    nbytes = 4;
531
532
20.5k
  status = dis_info.info->read_memory_func (addr, ibytes,
533
20.5k
              nbytes, dis_info.info);
534
20.5k
  if (status != 0)
535
    /* Address out of bounds.  -> lrw rx, [pc, 0ffset]. */
536
2.70k
    sprintf (buf, "[pc, %d]\t// from address pool at %x", (int)value,
537
2.70k
       (unsigned int)addr);
538
17.8k
  else if (oprnd->type == OPRND_TYPE_FCONSTANT)
539
0
    {
540
0
      double f;
541
542
0
      if (dis_info.opinfo->opcode == CSKYV2_INST_FLRW)
543
        /* flrws.  */
544
0
        floatformat_to_double ((dis_info.info->endian == BFD_ENDIAN_BIG
545
0
              ? &floatformat_ieee_single_big
546
0
              : &floatformat_ieee_single_little),
547
0
             ibytes, &f);
548
0
      else
549
0
        floatformat_to_double ((dis_info.info->endian == BFD_ENDIAN_BIG
550
0
              ? &floatformat_ieee_double_big
551
0
              : &floatformat_ieee_double_little),
552
0
             ibytes, &f);
553
0
      sprintf (buf, "%.7g", f);
554
0
    }
555
17.8k
  else
556
17.8k
    {
557
17.8k
      dis_info.value = addr;
558
17.8k
      dis_info.need_output_symbol = 1;
559
17.8k
      value = csky_chars_to_number (ibytes, 4);
560
17.8k
      sprintf (buf, "0x%x", (unsigned int) value);
561
17.8k
    }
562
563
20.5k
  strcat (str, buf);
564
20.5k
  break;
565
20.5k
      }
566
62.6k
    case OPRND_TYPE_ELRW_CONSTANT:
567
62.6k
      {
568
62.6k
  int shift = oprnd->shift;
569
62.6k
  char ibytes[4];
570
62.6k
  int status;
571
62.6k
  bfd_vma addr;
572
62.6k
  dis_info.info->stop_vma = 0;
573
574
62.6k
  value = 0x80 + ((~value) & 0x7f);
575
576
62.6k
  value = value << shift;
577
62.6k
  addr = (dis_info.mem + value) & 0xfffffffc;
578
579
62.6k
  status = dis_info.info->read_memory_func (addr, (bfd_byte *)ibytes,
580
62.6k
              4, dis_info.info);
581
62.6k
  if (status != 0)
582
    /* Address out of bounds.  -> lrw rx, [pc, 0ffset]. */
583
15.8k
    sprintf (buf, "[pc, %d]\t// from address pool at %x", (int) value,
584
15.8k
       (unsigned int)addr);
585
46.8k
  else
586
46.8k
    {
587
46.8k
      dis_info.value = addr;
588
46.8k
      value = csky_chars_to_number ((unsigned char *)ibytes, 4);
589
46.8k
      dis_info.need_output_symbol = 1;
590
46.8k
      sprintf (buf, "0x%x", (unsigned int)value);
591
46.8k
    }
592
593
62.6k
  strcat (str, buf);
594
62.6k
  break;
595
20.5k
      }
596
0
    case OPRND_TYPE_SFLOAT:
597
1
    case OPRND_TYPE_DFLOAT:
598
1
      {
599
  /* This is for fmovis/fmovid, which have an internal 13-bit
600
     encoding that they convert to single/double precision
601
     (respectively).  We'll convert the 13-bit encoding to an IEEE
602
     double and then to host double format to print it.
603
     Sign bit: bit 20.
604
     4-bit exponent: bits 19:16, biased by 11.
605
     8-bit mantissa: split between 24:21 and 7:4.  */
606
1
  uint64_t imm4;
607
1
  uint64_t imm8;
608
1
  uint64_t dbnum;
609
1
  unsigned char valbytes[8];
610
1
  double fvalue;
611
612
1
  imm4 = ((inst >> 16) & 0xf);
613
1
  imm4 = (uint64_t)(1023 - (imm4 - 11)) << 52;
614
615
1
  imm8 = (uint64_t)((inst >> 4) & 0xf) << 44;
616
1
  imm8 |= (uint64_t)((inst >> 21) & 0xf) << 48;
617
618
1
  dbnum = (uint64_t)((inst >> 20) & 1) << 63;
619
1
  dbnum |= imm4 | imm8;
620
621
  /* Do this a byte at a time so we don't have to
622
     worry about the host's endianness.  */
623
1
  valbytes[0] = dbnum & 0xff;
624
1
  valbytes[1] = (dbnum >> 8) & 0xff;
625
1
  valbytes[2] = (dbnum >> 16) & 0xff;
626
1
  valbytes[3] = (dbnum >> 24) & 0xff;
627
1
  valbytes[4] = (dbnum >> 32) & 0xff;
628
1
  valbytes[5] = (dbnum >> 40) & 0xff;
629
1
  valbytes[6] = (dbnum >> 48) & 0xff;
630
1
  valbytes[7] = (dbnum >> 56) & 0xff;
631
632
1
  floatformat_to_double (&floatformat_ieee_double_little, valbytes,
633
1
             &fvalue);
634
635
1
  sprintf (buf, "%.7g", fvalue);
636
1
  strcat (str, buf);
637
1
  break;
638
0
      }
639
0
    case OPRND_TYPE_HFLOAT_FMOVI:
640
0
    case OPRND_TYPE_SFLOAT_FMOVI:
641
0
      {
642
0
  int imm4;
643
0
  int imm8;
644
0
  imm4 = ((inst >> 16) & 0xf);
645
0
  imm4 = (138 - imm4) << 23;
646
647
0
  imm8 = ((inst >> 8) & 0x3);
648
0
  imm8 |= (((inst >> 20) & 0x3f) << 2);
649
0
  imm8 <<= 15;
650
651
0
  value = ((inst >> 5) & 1) << 31;
652
0
  value |= imm4 | imm8;
653
654
0
  imm4 = 138 - (imm4 >> 23);
655
0
  imm8 >>= 15;
656
0
  if ((inst >> 5) & 1)
657
0
    {
658
0
      imm8 = 0 - imm8;
659
0
    }
660
661
0
  float f = 0;
662
0
  memcpy (&f, &value, sizeof (float));
663
0
  sprintf (buf, "%.7g\t// imm9:%4d, imm4:%2d", f, imm8, imm4);
664
0
  strcat (str, buf);
665
666
0
  break;
667
0
      }
668
669
0
    case OPRND_TYPE_DFLOAT_FMOVI:
670
0
      {
671
0
  uint64_t imm4;
672
0
  uint64_t imm8;
673
0
  uint64_t dvalue;
674
0
  imm4 = ((inst >> 16) & 0xf);
675
0
  imm4 = (1034 - imm4) << 52;
676
677
0
  imm8 = ((inst >> 8) & 0x3);
678
0
  imm8 |= (((inst >> 20) & 0x3f) << 2);
679
0
  imm8 <<= 44;
680
681
0
  dvalue = (((uint64_t)inst >> 5) & 1) << 63;
682
0
  dvalue |= imm4 | imm8;
683
684
0
  imm4 = 1034 - (imm4 >> 52);
685
0
  imm8 >>= 44;
686
0
  if (inst >> 5)
687
0
    {
688
0
      imm8 = 0 - imm8;
689
0
    }
690
0
  double d = 0;
691
0
  memcpy (&d, &dvalue, sizeof (double));
692
0
  sprintf (buf, "%.7g\t// imm9:%4ld, imm4:%2ld", d, (long) imm8, (long) imm4);
693
0
  strcat (str, buf);
694
695
0
  break;
696
0
      }
697
738
    case OPRND_TYPE_LABEL_WITH_BRACKET:
698
738
      sprintf (buf, "[0x%x]", (unsigned int)value);
699
738
      strcat (str, buf);
700
738
      strcat (str, "\t// the offset is based on .data");
701
738
      break;
702
4.26k
    case OPRND_TYPE_OIMM3b:
703
4.38k
    case OPRND_TYPE_OIMM4b:
704
18.6k
    case OPRND_TYPE_OIMM5b:
705
18.6k
    case OPRND_TYPE_OIMM5b_IDLY:
706
50.7k
    case OPRND_TYPE_OIMM8b:
707
51.2k
    case OPRND_TYPE_OIMM12b:
708
51.3k
    case OPRND_TYPE_OIMM16b:
709
51.5k
    case OPRND_TYPE_OIMM18b:
710
51.5k
      value += 1;
711
51.5k
      sprintf (buf, "%d", (int)value);
712
51.5k
      strcat (str, buf);
713
51.5k
      break;
714
0
    case OPRND_TYPE_OIMM5b_BMASKI:
715
0
      if (value > 32 || value < 16)
716
0
  {
717
0
    ret = -1;
718
0
    break;
719
0
  }
720
0
      sprintf (buf, "%d", (int)(value + 1));
721
0
      strcat (str, buf);
722
0
      ret = 0;
723
0
      break;
724
27
    case OPRND_TYPE_FREGLIST_DASH:
725
27
      if (IS_CSKY_V2 (mach_flag))
726
27
  {
727
27
    int vrx = 0;
728
27
    int vry = 0;
729
27
    if (dis_info.isa & CSKY_ISA_FLOAT_7E60
730
0
        && (strstr (str, "fstm") != NULL
731
0
      || strstr (str, "fldm") != NULL))
732
0
      {
733
0
        vrx = value & 0x1f;
734
0
        vry = vrx + (value >> 5);
735
0
      }
736
27
    else
737
27
      {
738
27
        vrx = value & 0xf;
739
27
        vry = vrx + (value >> 4);
740
27
      }
741
27
    sprintf (buf, "fr%d-fr%d", vrx, vry);
742
27
    strcat (str, buf);
743
27
  }
744
27
      break;
745
593
    case OPRND_TYPE_REGLIST_DASH:
746
593
      if (IS_CSKY_V1 (mach_flag))
747
593
  {
748
593
    sprintf (buf, "%s-r15", get_gr_name (value));
749
593
    strcat (str, buf);
750
593
  }
751
0
      else
752
0
  {
753
0
    if ((value & 0x1f) + (value >> 5) > 31)
754
0
      {
755
0
        ret = -1;
756
0
        break;
757
0
      }
758
0
    strcat (str, get_gr_name ((value >> 5)));
759
0
    strcat (str, "-");
760
0
    strcat (str, get_gr_name ((value & 0x1f) + (value >> 5)));
761
0
  }
762
593
      break;
763
593
    case OPRND_TYPE_PSR_BITS_LIST:
764
14
      {
765
14
  struct psrbit const *bits;
766
14
  int first_oprnd = true;
767
14
  int i = 0;
768
14
  if (IS_CSKY_V1 (mach_flag))
769
12
    {
770
12
      if (value == 0)
771
4
        {
772
4
    strcat (str, "af");
773
4
    break;
774
4
        }
775
8
      bits = cskyv1_psr_bits;
776
8
    }
777
2
  else
778
2
    bits = cskyv2_psr_bits;
779
34
  while (value != 0 && bits[i].name != NULL)
780
24
      {
781
24
        if (value & bits[i].value)
782
22
    {
783
22
      if (!first_oprnd)
784
14
        strcat (str, ", ");
785
22
      strcat (str, bits[i].name);
786
22
      value &= ~bits[i].value;
787
22
      first_oprnd = false;
788
22
    }
789
24
        i++;
790
24
      }
791
10
  break;
792
14
      }
793
593
    case OPRND_TYPE_REGbsp:
794
593
      if (IS_CSKY_V1 (mach_flag))
795
593
  sprintf(buf, "(%s)", get_gr_name (0));
796
0
      else
797
0
  sprintf(buf, "(%s)", get_gr_name (14));
798
593
      strcat (str, buf);
799
593
      break;
800
37.1k
    case OPRND_TYPE_REGsp:
801
37.1k
      if (IS_CSKY_V1 (mach_flag))
802
0
  strcat (str, get_gr_name (0));
803
37.1k
      else
804
37.1k
  strcat (str, get_gr_name (14));
805
37.1k
      break;
806
693
    case OPRND_TYPE_REGnr4_r7:
807
726
    case OPRND_TYPE_AREG_WITH_BRACKET:
808
726
      strcat (str, "(");
809
726
      strcat (str, get_gr_name (value));
810
726
      strcat (str, ")");
811
726
      break;
812
592
    case OPRND_TYPE_AREG_WITH_LSHIFT:
813
592
      strcat (str, get_gr_name (value >> 5));
814
592
      strcat (str, " << ");
815
592
      if ((value & 0x1f) == 0x1)
816
11
  strcat (str, "0");
817
581
      else if ((value & 0x1f) == 0x2)
818
3
  strcat (str, "1");
819
578
      else if ((value & 0x1f) == 0x4)
820
26
  strcat (str, "2");
821
552
      else if ((value & 0x1f) == 0x8)
822
22
  strcat (str, "3");
823
592
      break;
824
81
    case OPRND_TYPE_AREG_WITH_LSHIFT_FPU:
825
81
      strcat (str, get_gr_name (value >> 2));
826
81
      strcat (str, " << ");
827
81
      if ((value & 0x3) == 0x0)
828
10
  strcat (str, "0");
829
71
      else if ((value & 0x3) == 0x1)
830
69
  strcat (str, "1");
831
2
      else if ((value & 0x3) == 0x2)
832
1
  strcat (str, "2");
833
1
      else if ((value & 0x3) == 0x3)
834
1
  strcat (str, "3");
835
81
      break;
836
4
    case OPRND_TYPE_VREG_WITH_INDEX:
837
4
      {
838
4
  unsigned freg_val = value & 0xf;
839
4
  unsigned index_val = (value >> 4) & 0xf;
840
4
  sprintf (buf, "vr%d[%d]", freg_val, index_val);
841
4
  strcat(str, buf);
842
4
  break;
843
693
      }
844
0
    case OPRND_TYPE_FREG_WITH_INDEX:
845
0
      {
846
0
  unsigned freg_val = value & 0xf;
847
0
  unsigned index_val = (value >> 4) & 0xf;
848
0
  sprintf (buf, "fr%d[%d]", freg_val, index_val);
849
0
  strcat(str, buf);
850
0
  break;
851
693
      }
852
693
    case OPRND_TYPE_REGr4_r7:
853
693
      if (IS_CSKY_V1 (mach_flag))
854
693
  {
855
693
    sprintf (buf, "%s-%s", get_gr_name (4), get_gr_name (7));
856
693
    strcat (str, buf);
857
693
  }
858
693
      break;
859
1.57k
    case OPRND_TYPE_CONST1:
860
1.57k
      strcat (str, "1");
861
1.57k
      break;
862
1.79k
    case OPRND_TYPE_REG_r1a:
863
1.85k
    case OPRND_TYPE_REG_r1b:
864
1.85k
      strcat (str, get_gr_name (1));
865
1.85k
      break;
866
115
    case OPRND_TYPE_REG_r28:
867
115
      strcat (str, get_gr_name (28));
868
115
      break;
869
7.46k
    case OPRND_TYPE_REGLIST_DASH_COMMA:
870
      /* 16-bit reglist.  */
871
7.46k
      if (value & 0xf)
872
5.84k
  {
873
5.84k
    strcat (str, get_gr_name (4));
874
5.84k
    if ((value & 0xf) > 1)
875
4.74k
      {
876
4.74k
        strcat (str, "-");
877
4.74k
        strcat (str, get_gr_name ((value & 0xf) + 3));
878
4.74k
      }
879
5.84k
    if (value & ~0xf)
880
4.68k
      strcat (str, ", ");
881
5.84k
  }
882
7.46k
      if (value & 0x10)
883
5.95k
  {
884
    /* r15.  */
885
5.95k
    strcat (str, get_gr_name (15));
886
5.95k
    if (value & ~0x1f)
887
0
      strcat (str, ", ");
888
5.95k
  }
889
7.46k
      if (dis_info.opinfo->oprnd.oprnds[0].mask != OPRND_MASK_0_4)
890
0
  {
891
    /* 32bits reglist.  */
892
0
    value >>= 5;
893
0
    if (value & 0x3)
894
0
      {
895
0
        strcat (str, get_gr_name (16));
896
0
        if ((value & 0x7) > 1)
897
0
    {
898
0
      strcat (str, "-");
899
0
      strcat (str, get_gr_name ((value & 0x7) + 15));
900
0
    }
901
0
        if (value & ~0x7)
902
0
    strcat (str, ", ");
903
0
        }
904
0
    if (value & 0x8)
905
      /* r15.  */
906
0
      strcat (str, get_gr_name (28));
907
0
  }
908
7.46k
      break;
909
10.3k
    case OPRND_TYPE_UNCOND10b:
910
10.9k
    case OPRND_TYPE_UNCOND16b:
911
27.4k
    case OPRND_TYPE_COND10b:
912
27.5k
    case OPRND_TYPE_COND16b:
913
27.5k
      {
914
27.5k
  int shift = oprnd->shift;
915
916
27.5k
  if (value & ((max >> 1) + 1))
917
11.1k
    value |= ~max;
918
27.5k
  if (is_extern_symbol (dis_info.info, dis_info.mem))
919
0
    value = 0;
920
27.5k
  else
921
27.5k
    value = dis_info.mem + (value << shift);
922
27.5k
  sprintf (buf, "0x%x", (unsigned int)value);
923
27.5k
  strcat (str, buf);
924
27.5k
  dis_info.need_output_symbol = 1;
925
27.5k
  dis_info.value = value;
926
27.5k
      }
927
27.5k
      break;
928
929
35
    default:
930
35
      ret = -1;
931
35
      break;
932
1.13M
    }
933
1.13M
  return ret;
934
1.13M
}
935
936
static int
937
csky_print_operand (char *str, struct operand const *oprnd,
938
        CSKY_INST_TYPE inst, int reloc)
939
1.25M
{
940
1.25M
  int ret = -1;
941
1.25M
  char *lc = "";
942
1.25M
  char *rc = "";
943
1.25M
  if (oprnd->mask == HAS_SUB_OPERAND)
944
124k
    {
945
124k
      struct soperand *sop = (struct soperand *)oprnd;
946
124k
      if (oprnd->type == OPRND_TYPE_BRACKET)
947
116k
  {
948
116k
    lc = "(";
949
116k
    rc = ")";
950
116k
  }
951
8.00k
      else if (oprnd->type == OPRND_TYPE_ABRACKET)
952
8.00k
  {
953
8.00k
    lc = "<";
954
8.00k
    rc = ">";
955
8.00k
  }
956
124k
      strcat (str, lc);
957
124k
      ret = csky_print_operand (str, &sop->subs[0], inst, reloc);
958
124k
      if (ret)
959
0
  return ret;
960
124k
      strcat (str, ", ");
961
124k
      ret = csky_print_operand (str, &sop->subs[1], inst, reloc);
962
124k
      strcat (str, rc);
963
124k
      return ret;
964
124k
    }
965
1.13M
  return csky_output_operand (str, oprnd, inst, reloc);
966
1.25M
}
967
968
static int
969
csky_print_operands (char *str, struct csky_opcode_info const *pinfo,
970
         struct disassemble_info *info, CSKY_INST_TYPE inst,
971
         int reloc)
972
597k
{
973
597k
  int i = 0;
974
597k
  int ret = 0;
975
597k
  if (pinfo->operand_num)
976
503k
    strcat (str, "      \t");
977
597k
  if (pinfo->operand_num == -1)
978
7.47k
    {
979
7.47k
      ret = csky_print_operand (str, &pinfo->oprnd.oprnds[i], inst, reloc);
980
7.47k
      if (ret)
981
0
  return ret;
982
7.47k
    }
983
589k
  else
984
1.59M
    for (; i < pinfo->operand_num; i++)
985
1.00M
      {
986
1.00M
  if (i != 0)
987
506k
    strcat (str, ", ");
988
1.00M
  ret = csky_print_operand (str, &pinfo->oprnd.oprnds[i], inst, reloc);
989
1.00M
  if (ret)
990
707
    return ret;
991
1.00M
      }
992
596k
  info->fprintf_func (info->stream, "%s", str);
993
596k
  if (dis_info.need_output_symbol)
994
119k
    {
995
119k
      info->fprintf_func (info->stream, "\t// ");
996
119k
      info->print_address_func (dis_info.value, dis_info.info);
997
119k
    }
998
596k
  return 0;
999
597k
}
1000
1001
static void
1002
number_to_chars_littleendian (char *buf, CSKY_INST_TYPE val, int n)
1003
0
{
1004
0
  if (n <= 0)
1005
0
    abort ();
1006
0
  while (n--)
1007
0
    {
1008
0
      *buf++ = val & 0xff;
1009
0
      val >>= 8;
1010
0
    }
1011
0
}
1012
1013
727k
#define CSKY_READ_DATA()                                        \
1014
727k
{                                                               \
1015
727k
  status = info->read_memory_func (memaddr, buf, 2, info);      \
1016
727k
  if (status)                                                   \
1017
727k
    {                                                           \
1018
342
      info->memory_error_func (status, memaddr, info);          \
1019
342
      return -1;                                                \
1020
342
    }                                                           \
1021
727k
  if (info->endian == BFD_ENDIAN_BIG)                           \
1022
726k
    inst |= (buf[0] << 8) | buf[1];                             \
1023
726k
  else if (info->endian == BFD_ENDIAN_LITTLE)                   \
1024
303k
    inst |= (buf[1] << 8) | buf[0];                             \
1025
303k
  else                                                          \
1026
303k
    abort();                                                    \
1027
726k
  info->bytes_per_chunk += 2;                                   \
1028
726k
  memaddr += 2;                                                 \
1029
726k
}
1030
1031
int
1032
print_insn_csky (bfd_vma memaddr, struct disassemble_info *info)
1033
690k
{
1034
690k
  unsigned char buf[4];
1035
690k
  CSKY_INST_TYPE inst = 0;
1036
690k
  int status;
1037
690k
  char str[256];
1038
690k
  unsigned long given;
1039
690k
  int is_data = false;
1040
690k
  void (*printer) (bfd_vma, struct disassemble_info *, long);
1041
690k
  unsigned int  size = 4;
1042
1043
690k
  memset (str, 0, sizeof (str));
1044
690k
  info->bytes_per_chunk = 0;
1045
690k
  info->bytes_per_chunk = 0;
1046
690k
  dis_info.mem = memaddr;
1047
690k
  dis_info.info = info;
1048
690k
  dis_info.need_output_symbol = 0;
1049
1050
690k
  if (info->disassembler_options)
1051
608
    {
1052
608
      for_each_disassembler_option (info, parse_csky_option, NULL);
1053
608
      info->disassembler_options = NULL;
1054
608
    }
1055
1056
690k
  if (mach_flag != INIT_MACH_FLAG && mach_flag != BINARY_MACH_FLAG)
1057
432k
    info->mach = mach_flag;
1058
257k
  else if (mach_flag == INIT_MACH_FLAG)
1059
2
    {
1060
2
      mach_flag = info->mach;
1061
2
      dis_info.isa = CSKY_DEFAULT_ISA;
1062
2
    }
1063
1064
690k
  if (mach_flag == BINARY_MACH_FLAG && info->endian == BFD_ENDIAN_UNKNOWN)
1065
0
    {
1066
0
      info->endian = BFD_ENDIAN_LITTLE;
1067
0
      dis_info.isa = CSKY_DEFAULT_ISA;
1068
0
    }
1069
1070
  /* First check the full symtab for a mapping symbol, even if there
1071
     are no usable non-mapping symbols for this address.  */
1072
690k
  if (info->symtab_size != 0
1073
0
      && bfd_asymbol_flavour (*info->symtab) == bfd_target_elf_flavour)
1074
0
    {
1075
0
      bfd_vma addr;
1076
0
      int n;
1077
0
      int last_sym = -1;
1078
0
      enum sym_type type = CUR_TEXT;
1079
1080
0
      if (memaddr <= last_map_addr)
1081
0
  last_map_sym = -1;
1082
      /* Start scanning at the start of the function, or wherever
1083
   we finished last time.  */
1084
0
      n = 0;
1085
0
      if (n < last_map_sym)
1086
0
  n = last_map_sym;
1087
1088
      /* Scan up to the location being disassembled.  */
1089
0
      for (; n < info->symtab_size; n++)
1090
0
  {
1091
0
    addr = bfd_asymbol_value (info->symtab[n]);
1092
0
    if (addr > memaddr)
1093
0
      break;
1094
0
    if ((info->section == NULL
1095
0
         || info->section == info->symtab[n]->section)
1096
0
        && get_sym_code_type (info, n, &type))
1097
0
      last_sym = n;
1098
0
  }
1099
0
      last_map_sym = last_sym;
1100
0
      last_type = type;
1101
0
      is_data = (last_type == CUR_DATA);
1102
0
      if (is_data)
1103
0
  {
1104
0
    size = 4 - ( memaddr & 3);
1105
0
    for (n = last_sym + 1; n < info->symtab_size; n++)
1106
0
      {
1107
0
        addr = bfd_asymbol_value (info->symtab[n]);
1108
0
        if (addr > memaddr)
1109
0
    {
1110
0
      if (addr - memaddr < size)
1111
0
        size = addr - memaddr;
1112
0
      break;
1113
0
    }
1114
0
      }
1115
    /* If the next symbol is after three bytes, we need to
1116
       print only part of the data, so that we can use either
1117
       .byte or .short.  */
1118
0
    if (size == 3)
1119
0
      size = (memaddr & 1) ? 1 : 2;
1120
0
  }
1121
0
    }
1122
690k
  info->bytes_per_line = 4;
1123
1124
690k
  if (is_data)
1125
0
    {
1126
0
      int i;
1127
1128
      /* Size was already set above.  */
1129
0
      info->bytes_per_chunk = size;
1130
0
      printer = print_insn_data;
1131
1132
0
      status = info->read_memory_func (memaddr, (bfd_byte *) buf, size, info);
1133
0
      given = 0;
1134
0
      if (info->endian == BFD_ENDIAN_LITTLE)
1135
0
  for (i = size - 1; i >= 0; i--)
1136
0
    given = buf[i] | (given << 8);
1137
0
      else
1138
0
  for (i = 0; i < (int) size; i++)
1139
0
    given = buf[i] | (given << 8);
1140
1141
0
      printer (memaddr, info, given);
1142
0
      return info->bytes_per_chunk;
1143
0
    }
1144
1145
  /* Handle instructions.  */
1146
2.07M
  CSKY_READ_DATA();
1147
2.07M
  if ((inst & 0xc000) == 0xc000 && IS_CSKY_V2 (mach_flag))
1148
37.0k
    {
1149
      /* It's a 32-bit instruction.  */
1150
37.0k
      inst <<= 16;
1151
73.9k
      CSKY_READ_DATA();
1152
73.9k
      if (info->buffer && (info->endian == BFD_ENDIAN_LITTLE))
1153
0
  {
1154
0
    char* src = (char *)(info->buffer
1155
0
             + ((memaddr - 4 - info->buffer_vma)
1156
0
          * info->octets_per_byte));
1157
0
    if (info->endian == BFD_ENDIAN_LITTLE)
1158
0
      number_to_chars_littleendian (src, inst, 4);
1159
0
  }
1160
73.9k
    }
1161
1162
689k
  if (IS_CSKY_V1 (mach_flag))
1163
146k
    g_opcodeP = csky_v1_opcodes;
1164
543k
  else
1165
543k
    g_opcodeP = csky_v2_opcodes;
1166
1167
689k
  do
1168
690k
    {
1169
690k
      struct csky_opcode const *op;
1170
690k
      struct csky_opcode_info const *pinfo = NULL;
1171
690k
      int reloc;
1172
1173
690k
      memset (str, 0, sizeof (str));
1174
690k
      op = csky_find_inst_info (&pinfo, inst, info->bytes_per_chunk);
1175
690k
      if (!op)
1176
93.6k
  {
1177
93.6k
    if (IS_CSKY_V1 (mach_flag))
1178
194
      info->fprintf_func (info->stream, ".short: 0x%04x",
1179
194
        (unsigned short)inst);
1180
93.4k
    else
1181
93.4k
      info->fprintf_func (info->stream, ".long: 0x%08x",
1182
93.4k
        (unsigned int)inst);
1183
93.6k
    return info->bytes_per_chunk;
1184
93.6k
  }
1185
1186
597k
      if (info->bytes_per_chunk == 2)
1187
577k
  reloc = op->reloc16;
1188
19.5k
      else
1189
19.5k
  reloc = op->reloc32;
1190
597k
      dis_info.opinfo = pinfo;
1191
597k
      strcat (str, op->mnemonic);
1192
1193
597k
      if (csky_print_operands (str, pinfo, info, inst, reloc))
1194
707
  g_opcodeP++;
1195
596k
      else
1196
596k
  break;
1197
597k
    } while (1);
1198
1199
596k
  return info->bytes_per_chunk;
1200
689k
}