2 * Copyright(c) 2019-2021 Qualcomm Innovation Center, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
18 #ifndef HEXAGON_CPU_BITS_H
19 #define HEXAGON_CPU_BITS_H
21 #include "qemu/bitops.h"
23 #define HEX_EXCP_FETCH_NO_UPAGE 0x012
24 #define HEX_EXCP_INVALID_PACKET 0x015
25 #define HEX_EXCP_INVALID_OPCODE 0x015
26 #define HEX_EXCP_PRIV_NO_UREAD 0x024
27 #define HEX_EXCP_PRIV_NO_UWRITE 0x025
29 #define HEX_EXCP_TRAP0 0x172
31 #define PACKET_WORDS_MAX 4
33 static inline uint32_t parse_bits(uint32_t encoding
)
35 /* The parse bits are [15:14] */
36 return extract32(encoding
, 14, 2);
39 static inline uint32_t iclass_bits(uint32_t encoding
)
41 /* The instruction class is encoded in bits [31:28] */
42 uint32_t iclass
= extract32(encoding
, 28, 4);
43 /* If parse bits are zero, this is a duplex */
44 if (parse_bits(encoding
) == 0) {
50 static inline int is_packet_end(uint32_t endocing
)
52 uint32_t bits
= parse_bits(endocing
);
53 return ((bits
== 0x3) || (bits
== 0x0));
56 int disassemble_hexagon(uint32_t *words
, int nwords
, bfd_vma pc
, GString
*buf
);