| 1 | /* Print instructions for the Texas TMS320C[34]X, for GDB and GNU Binutils.
|
|---|
| 2 |
|
|---|
| 3 | Copyright 2002, 2003 Free Software Foundation, Inc.
|
|---|
| 4 |
|
|---|
| 5 | Contributed by Michael P. Hayes ([email protected])
|
|---|
| 6 |
|
|---|
| 7 | This program 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 2 of the License, or
|
|---|
| 10 | (at your option) any later version.
|
|---|
| 11 |
|
|---|
| 12 | This program is distributed in the hope that it will be useful,
|
|---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 15 | GNU General Public 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|---|
| 20 |
|
|---|
| 21 | #include <math.h>
|
|---|
| 22 | #include "libiberty.h"
|
|---|
| 23 | #include "dis-asm.h"
|
|---|
| 24 | #include "opcode/tic4x.h"
|
|---|
| 25 |
|
|---|
| 26 | #define TIC4X_DEBUG 0
|
|---|
| 27 |
|
|---|
| 28 | #define TIC4X_HASH_SIZE 11 /* 11 (bits) and above should give unique entries. */
|
|---|
| 29 | #define TIC4X_SPESOP_SIZE 8 /* Max 8. ops for special instructions */
|
|---|
| 30 |
|
|---|
| 31 | typedef enum
|
|---|
| 32 | {
|
|---|
| 33 | IMMED_SINT,
|
|---|
| 34 | IMMED_SUINT,
|
|---|
| 35 | IMMED_SFLOAT,
|
|---|
| 36 | IMMED_INT,
|
|---|
| 37 | IMMED_UINT,
|
|---|
| 38 | IMMED_FLOAT
|
|---|
| 39 | }
|
|---|
| 40 | immed_t;
|
|---|
| 41 |
|
|---|
| 42 | typedef enum
|
|---|
| 43 | {
|
|---|
| 44 | INDIRECT_SHORT,
|
|---|
| 45 | INDIRECT_LONG,
|
|---|
| 46 | INDIRECT_TIC4X
|
|---|
| 47 | }
|
|---|
| 48 | indirect_t;
|
|---|
| 49 |
|
|---|
| 50 | static int tic4x_version = 0;
|
|---|
| 51 | static int tic4x_dp = 0;
|
|---|
| 52 |
|
|---|
| 53 | static int tic4x_pc_offset
|
|---|
| 54 | PARAMS ((unsigned int));
|
|---|
| 55 | static int tic4x_print_char
|
|---|
| 56 | PARAMS ((struct disassemble_info *, char));
|
|---|
| 57 | static int tic4x_print_str
|
|---|
| 58 | PARAMS ((struct disassemble_info *, char *));
|
|---|
| 59 | static int tic4x_print_register
|
|---|
| 60 | PARAMS ((struct disassemble_info *, unsigned long));
|
|---|
| 61 | static int tic4x_print_addr
|
|---|
| 62 | PARAMS ((struct disassemble_info *, unsigned long));
|
|---|
| 63 | static int tic4x_print_relative
|
|---|
| 64 | PARAMS ((struct disassemble_info *, unsigned long, long, unsigned long));
|
|---|
| 65 | void tic4x_print_ftoa
|
|---|
| 66 | PARAMS ((unsigned int, FILE *, fprintf_ftype));
|
|---|
| 67 | static int tic4x_print_direct
|
|---|
| 68 | PARAMS ((struct disassemble_info *, unsigned long));
|
|---|
| 69 | static int tic4x_print_immed
|
|---|
| 70 | PARAMS ((struct disassemble_info *, immed_t, unsigned long));
|
|---|
| 71 | static int tic4x_print_cond
|
|---|
| 72 | PARAMS ((struct disassemble_info *, unsigned int));
|
|---|
| 73 | static int tic4x_print_indirect
|
|---|
| 74 | PARAMS ((struct disassemble_info *, indirect_t, unsigned long));
|
|---|
|
|---|