Rizin
unix-like reverse engineering framework and cli tools
xtensa-isa-internal.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2003-2015 Free Software Foundation, Inc.
2 // SPDX-License-Identifier: GPL-3.0-or-later
3 
4 /* Internal definitions for configurable Xtensa ISA support.
5  Copyright (C) 2003-2015 Free Software Foundation, Inc.
6 
7  This file is part of BFD, the Binary File Descriptor library.
8 
9  This program is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 3 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
22  USA. */
23 
24 #ifndef XTENSA_ISA_INTERNAL_H
25 #define XTENSA_ISA_INTERNAL_H
26 
27 /* Flags. */
28 
29 #define XTENSA_OPERAND_IS_REGISTER 0x00000001
30 #define XTENSA_OPERAND_IS_PCRELATIVE 0x00000002
31 #define XTENSA_OPERAND_IS_INVISIBLE 0x00000004
32 #define XTENSA_OPERAND_IS_UNKNOWN 0x00000008
33 
34 #define XTENSA_OPCODE_IS_BRANCH 0x00000001
35 #define XTENSA_OPCODE_IS_JUMP 0x00000002
36 #define XTENSA_OPCODE_IS_LOOP 0x00000004
37 #define XTENSA_OPCODE_IS_CALL 0x00000008
38 
39 #define XTENSA_STATE_IS_EXPORTED 0x00000001
40 #define XTENSA_STATE_IS_SHARED_OR 0x00000002
41 
42 #define XTENSA_INTERFACE_HAS_SIDE_EFFECT 0x00000001
43 
44 /* Function pointer typedefs */
57 typedef int (*xtensa_length_decode_fn)(const unsigned char *);
58 
60  const char *name; /* Instruction format name. */
61  int length; /* Instruction length in bytes. */
63  int num_slots;
64  int *slot_id; /* Array[num_slots] of slot IDs. */
66 
68  const char *name; /* Not necessarily unique. */
69  const char *format;
70  int position;
73  xtensa_get_field_fn *get_field_fns; /* Array[field_id]. */
74  xtensa_set_field_fn *set_field_fns; /* Array[field_id]. */
76  const char *nop_name;
78 
80  const char *name;
81  int field_id;
82  xtensa_regfile regfile; /* Register file. */
83  int num_regs; /* Usually 1; 2 for reg pairs, etc. */
84  uint32 flags; /* See XTENSA_OPERAND_* flags. */
85  xtensa_immed_encode_fn encode; /* Encode the operand value. */
86  xtensa_immed_decode_fn decode; /* Decode the value from the field. */
87  xtensa_do_reloc_fn do_reloc; /* Perform a PC-relative reloc. */
88  xtensa_undo_reloc_fn undo_reloc; /* Undo a PC-relative relocation. */
90 
92  union {
93  int operand_id; /* For normal operands. */
94  xtensa_state state; /* For stateOperands. */
95  } u;
96  char inout; /* Direction: 'i', 'o', or 'm'. */
98 
100  int num_operands; /* Size of "operands" array. */
101  xtensa_arg_internal *operands; /* Array[num_operands]. */
102 
103  int num_stateOperands; /* Size of "stateOperands" array. */
104  xtensa_arg_internal *stateOperands; /* Array[num_stateOperands]. */
105 
106  int num_interfaceOperands; /* Size of "interfaceOperands". */
107  xtensa_interface *interfaceOperands; /* Array[num_interfaceOperands]. */
109 
111  const char *name; /* Opcode mnemonic. */
112  int iclass_id; /* Iclass for this opcode. */
113  uint32 flags; /* See XTENSA_OPCODE_* flags. */
114  xtensa_opcode_encode_fn *encode_fns; /* Array[slot_id]. */
115  int num_funcUnit_uses; /* Number of funcUnit_use entries. */
116  xtensa_funcUnit_use *funcUnit_uses; /* Array[num_funcUnit_uses]. */
118 
120  const char *name; /* Full name of the regfile. */
121  const char *shortname; /* Abbreviated name. */
122  xtensa_regfile parent; /* View parent (or identity). */
123  int num_bits; /* Width of the registers. */
124  int num_entries; /* Number of registers. */
126 
128  const char *name; /* Interface name. */
129  int num_bits; /* Width of the interface. */
130  uint32 flags; /* See XTENSA_INTERFACE_* flags. */
131  int class_id; /* Class of related interfaces. */
132  char inout; /* "i" or "o". */
134 
136  const char *name; /* Functional unit name. */
137  int num_copies; /* Number of instances. */
139 
141  const char *name; /* State name. */
142  int num_bits; /* Number of state bits. */
143  uint32 flags; /* See XTENSA_STATE_* flags. */
145 
147  const char *name; /* Register name. */
148  int number; /* Register number. */
149  int is_user; /* Non-zero if a "user register". */
151 
153  const char *key;
154  union {
155  xtensa_opcode opcode; /* Internal opcode number. */
156  xtensa_sysreg sysreg; /* Internal sysreg number. */
157  xtensa_state state; /* Internal state number. */
158  xtensa_interface intf; /* Internal interface number. */
159  xtensa_funcUnit fun; /* Internal funcUnit number. */
160  } u;
162 
164  int is_big_endian; /* Endianness. */
165  int insn_size; /* Maximum length in bytes. */
166  int insnbuf_size; /* Number of insnbuf_words. */
167 
172 
175 
177 
180 
183 
187 
190 
194 
198 
199  /* The current Xtensa ISA only supports 256 of each kind of sysreg so
200  we can get away with implementing lookups with tables indexed by
201  the register numbers. If we ever allow larger sysreg numbers, this
202  may have to be reimplemented. The first entry in the following
203  arrays corresponds to "special" registers and the second to "user"
204  registers. */
207 
211 
215 
217 
218 extern int xtensa_isa_name_compare(const void *, const void *);
219 
221 extern char xtisa_error_msg[];
222 
223 #endif /* !XTENSA_ISA_INTERNAL_H */
static int
Definition: sfsocketcall.h:114
union xtensa_arg_internal_struct::@102 u
xtensa_format_encode_fn encode_fn
xtensa_arg_internal * stateOperands
xtensa_format_decode_fn format_decode_fn
xtensa_operand_internal * operands
xtensa_lookup_entry * sysreg_lookup_table
xtensa_state_internal * states
xtensa_lookup_entry * state_lookup_table
xtensa_regfile_internal * regfiles
xtensa_opcode_internal * opcodes
xtensa_iclass_internal * iclasses
xtensa_lookup_entry * funcUnit_lookup_table
xtensa_interface_internal * interfaces
xtensa_funcUnit_internal * funcUnits
xtensa_sysreg_internal * sysregs
xtensa_lookup_entry * opname_lookup_table
xtensa_length_decode_fn length_decode_fn
xtensa_format_internal * formats
xtensa_slot_internal * slots
xtensa_lookup_entry * interface_lookup_table
xtensa_funcUnit fun
xtensa_opcode opcode
xtensa_state state
xtensa_interface intf
xtensa_sysreg sysreg
const char * key
union xtensa_lookup_entry_struct::@103 u
xtensa_opcode_encode_fn * encode_fns
xtensa_funcUnit_use * funcUnit_uses
xtensa_set_field_fn * set_field_fns
xtensa_opcode_decode_fn opcode_decode_fn
xtensa_get_field_fn * get_field_fns
int(* xtensa_immed_encode_fn)(uint32 *)
struct xtensa_state_internal_struct xtensa_state_internal
void(* xtensa_set_field_fn)(xtensa_insnbuf, uint32)
struct xtensa_iclass_internal_struct xtensa_iclass_internal
struct xtensa_operand_internal_struct xtensa_operand_internal
struct xtensa_opcode_internal_struct xtensa_opcode_internal
int(* xtensa_undo_reloc_fn)(uint32 *, uint32)
struct xtensa_arg_internal_struct xtensa_arg_internal
struct xtensa_lookup_entry_struct xtensa_lookup_entry
int(* xtensa_format_decode_fn)(const xtensa_insnbuf)
void(* xtensa_set_slot_fn)(xtensa_insnbuf, const xtensa_insnbuf)
struct xtensa_format_internal_struct xtensa_format_internal
int(* xtensa_immed_decode_fn)(uint32 *)
struct xtensa_sysreg_internal_struct xtensa_sysreg_internal
uint32(* xtensa_get_field_fn)(const xtensa_insnbuf)
struct xtensa_regfile_internal_struct xtensa_regfile_internal
char xtisa_error_msg[]
Definition: xtensa-isa.c:36
void(* xtensa_opcode_encode_fn)(xtensa_insnbuf)
struct xtensa_interface_internal_struct xtensa_interface_internal
int xtensa_isa_name_compare(const void *, const void *)
Definition: xtensa-isa.c:395
struct xtensa_isa_internal_struct xtensa_isa_internal
void(* xtensa_get_slot_fn)(const xtensa_insnbuf, xtensa_insnbuf)
int(* xtensa_opcode_decode_fn)(const xtensa_insnbuf)
xtensa_isa_status xtisa_errno
Definition: xtensa-isa.c:35
struct xtensa_funcUnit_internal_struct xtensa_funcUnit_internal
void(* xtensa_format_encode_fn)(xtensa_insnbuf)
int(* xtensa_length_decode_fn)(const unsigned char *)
int(* xtensa_do_reloc_fn)(uint32 *, uint32)
struct xtensa_slot_internal_struct xtensa_slot_internal
enum xtensa_isa_status_enum xtensa_isa_status
int xtensa_opcode
Definition: xtensa-isa.h:83
int xtensa_regfile
Definition: xtensa-isa.h:85
xtensa_insnbuf_word * xtensa_insnbuf
Definition: xtensa-isa.h:179
int xtensa_sysreg
Definition: xtensa-isa.h:87
#define uint32
Definition: xtensa-isa.h:39
int xtensa_interface
Definition: xtensa-isa.h:88
int xtensa_state
Definition: xtensa-isa.h:86
int xtensa_funcUnit
Definition: xtensa-isa.h:89