18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * arch/arm/probes/decode-thumb.c
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2011 Jon Medhurst <tixy@yxit.co.uk>.
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#include <linux/stddef.h>
98c2ecf20Sopenharmony_ci#include <linux/kernel.h>
108c2ecf20Sopenharmony_ci#include <linux/module.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include "decode.h"
138c2ecf20Sopenharmony_ci#include "decode-thumb.h"
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_cistatic const union decode_item t32_table_1110_100x_x0xx[] = {
178c2ecf20Sopenharmony_ci	/* Load/store multiple instructions */
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci	/* Rn is PC		1110 100x x0xx 1111 xxxx xxxx xxxx xxxx */
208c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xfe4f0000, 0xe80f0000),
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci	/* SRS			1110 1000 00x0 xxxx xxxx xxxx xxxx xxxx */
238c2ecf20Sopenharmony_ci	/* RFE			1110 1000 00x1 xxxx xxxx xxxx xxxx xxxx */
248c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xffc00000, 0xe8000000),
258c2ecf20Sopenharmony_ci	/* SRS			1110 1001 10x0 xxxx xxxx xxxx xxxx xxxx */
268c2ecf20Sopenharmony_ci	/* RFE			1110 1001 10x1 xxxx xxxx xxxx xxxx xxxx */
278c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xffc00000, 0xe9800000),
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci	/* STM Rn, {...pc}	1110 100x x0x0 xxxx 1xxx xxxx xxxx xxxx */
308c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xfe508000, 0xe8008000),
318c2ecf20Sopenharmony_ci	/* LDM Rn, {...lr,pc}	1110 100x x0x1 xxxx 11xx xxxx xxxx xxxx */
328c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xfe50c000, 0xe810c000),
338c2ecf20Sopenharmony_ci	/* LDM/STM Rn, {...sp}	1110 100x x0xx xxxx xx1x xxxx xxxx xxxx */
348c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xfe402000, 0xe8002000),
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci	/* STMIA		1110 1000 10x0 xxxx xxxx xxxx xxxx xxxx */
378c2ecf20Sopenharmony_ci	/* LDMIA		1110 1000 10x1 xxxx xxxx xxxx xxxx xxxx */
388c2ecf20Sopenharmony_ci	/* STMDB		1110 1001 00x0 xxxx xxxx xxxx xxxx xxxx */
398c2ecf20Sopenharmony_ci	/* LDMDB		1110 1001 00x1 xxxx xxxx xxxx xxxx xxxx */
408c2ecf20Sopenharmony_ci	DECODE_CUSTOM	(0xfe400000, 0xe8000000, PROBES_T32_LDMSTM),
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci	DECODE_END
438c2ecf20Sopenharmony_ci};
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_cistatic const union decode_item t32_table_1110_100x_x1xx[] = {
468c2ecf20Sopenharmony_ci	/* Load/store dual, load/store exclusive, table branch */
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci	/* STRD (immediate)	1110 1000 x110 xxxx xxxx xxxx xxxx xxxx */
498c2ecf20Sopenharmony_ci	/* LDRD (immediate)	1110 1000 x111 xxxx xxxx xxxx xxxx xxxx */
508c2ecf20Sopenharmony_ci	DECODE_OR	(0xff600000, 0xe8600000),
518c2ecf20Sopenharmony_ci	/* STRD (immediate)	1110 1001 x1x0 xxxx xxxx xxxx xxxx xxxx */
528c2ecf20Sopenharmony_ci	/* LDRD (immediate)	1110 1001 x1x1 xxxx xxxx xxxx xxxx xxxx */
538c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xff400000, 0xe9400000, PROBES_T32_LDRDSTRD,
548c2ecf20Sopenharmony_ci						 REGS(NOPCWB, NOSPPC, NOSPPC, 0, 0)),
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci	/* TBB			1110 1000 1101 xxxx xxxx xxxx 0000 xxxx */
578c2ecf20Sopenharmony_ci	/* TBH			1110 1000 1101 xxxx xxxx xxxx 0001 xxxx */
588c2ecf20Sopenharmony_ci	DECODE_SIMULATEX(0xfff000e0, 0xe8d00000, PROBES_T32_TABLE_BRANCH,
598c2ecf20Sopenharmony_ci						 REGS(NOSP, 0, 0, 0, NOSPPC)),
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci	/* STREX		1110 1000 0100 xxxx xxxx xxxx xxxx xxxx */
628c2ecf20Sopenharmony_ci	/* LDREX		1110 1000 0101 xxxx xxxx xxxx xxxx xxxx */
638c2ecf20Sopenharmony_ci	/* STREXB		1110 1000 1100 xxxx xxxx xxxx 0100 xxxx */
648c2ecf20Sopenharmony_ci	/* STREXH		1110 1000 1100 xxxx xxxx xxxx 0101 xxxx */
658c2ecf20Sopenharmony_ci	/* STREXD		1110 1000 1100 xxxx xxxx xxxx 0111 xxxx */
668c2ecf20Sopenharmony_ci	/* LDREXB		1110 1000 1101 xxxx xxxx xxxx 0100 xxxx */
678c2ecf20Sopenharmony_ci	/* LDREXH		1110 1000 1101 xxxx xxxx xxxx 0101 xxxx */
688c2ecf20Sopenharmony_ci	/* LDREXD		1110 1000 1101 xxxx xxxx xxxx 0111 xxxx */
698c2ecf20Sopenharmony_ci	/* And unallocated instructions...				*/
708c2ecf20Sopenharmony_ci	DECODE_END
718c2ecf20Sopenharmony_ci};
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_cistatic const union decode_item t32_table_1110_101x[] = {
748c2ecf20Sopenharmony_ci	/* Data-processing (shifted register)				*/
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci	/* TST			1110 1010 0001 xxxx xxxx 1111 xxxx xxxx */
778c2ecf20Sopenharmony_ci	/* TEQ			1110 1010 1001 xxxx xxxx 1111 xxxx xxxx */
788c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xff700f00, 0xea100f00, PROBES_T32_TST,
798c2ecf20Sopenharmony_ci						 REGS(NOSPPC, 0, 0, 0, NOSPPC)),
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci	/* CMN			1110 1011 0001 xxxx xxxx 1111 xxxx xxxx */
828c2ecf20Sopenharmony_ci	DECODE_OR	(0xfff00f00, 0xeb100f00),
838c2ecf20Sopenharmony_ci	/* CMP			1110 1011 1011 xxxx xxxx 1111 xxxx xxxx */
848c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xfff00f00, 0xebb00f00, PROBES_T32_TST,
858c2ecf20Sopenharmony_ci						 REGS(NOPC, 0, 0, 0, NOSPPC)),
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci	/* MOV			1110 1010 010x 1111 xxxx xxxx xxxx xxxx */
888c2ecf20Sopenharmony_ci	/* MVN			1110 1010 011x 1111 xxxx xxxx xxxx xxxx */
898c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xffcf0000, 0xea4f0000, PROBES_T32_MOV,
908c2ecf20Sopenharmony_ci						 REGS(0, 0, NOSPPC, 0, NOSPPC)),
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci	/* ???			1110 1010 101x xxxx xxxx xxxx xxxx xxxx */
938c2ecf20Sopenharmony_ci	/* ???			1110 1010 111x xxxx xxxx xxxx xxxx xxxx */
948c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xffa00000, 0xeaa00000),
958c2ecf20Sopenharmony_ci	/* ???			1110 1011 001x xxxx xxxx xxxx xxxx xxxx */
968c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xffe00000, 0xeb200000),
978c2ecf20Sopenharmony_ci	/* ???			1110 1011 100x xxxx xxxx xxxx xxxx xxxx */
988c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xffe00000, 0xeb800000),
998c2ecf20Sopenharmony_ci	/* ???			1110 1011 111x xxxx xxxx xxxx xxxx xxxx */
1008c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xffe00000, 0xebe00000),
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci	/* ADD/SUB SP, SP, Rm, LSL #0..3				*/
1038c2ecf20Sopenharmony_ci	/*			1110 1011 x0xx 1101 x000 1101 xx00 xxxx */
1048c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xff4f7f30, 0xeb0d0d00, PROBES_T32_ADDSUB,
1058c2ecf20Sopenharmony_ci						 REGS(SP, 0, SP, 0, NOSPPC)),
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci	/* ADD/SUB SP, SP, Rm, shift					*/
1088c2ecf20Sopenharmony_ci	/*			1110 1011 x0xx 1101 xxxx 1101 xxxx xxxx */
1098c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xff4f0f00, 0xeb0d0d00),
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci	/* ADD/SUB Rd, SP, Rm, shift					*/
1128c2ecf20Sopenharmony_ci	/*			1110 1011 x0xx 1101 xxxx xxxx xxxx xxxx */
1138c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xff4f0000, 0xeb0d0000, PROBES_T32_ADDSUB,
1148c2ecf20Sopenharmony_ci						 REGS(SP, 0, NOPC, 0, NOSPPC)),
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci	/* AND			1110 1010 000x xxxx xxxx xxxx xxxx xxxx */
1178c2ecf20Sopenharmony_ci	/* BIC			1110 1010 001x xxxx xxxx xxxx xxxx xxxx */
1188c2ecf20Sopenharmony_ci	/* ORR			1110 1010 010x xxxx xxxx xxxx xxxx xxxx */
1198c2ecf20Sopenharmony_ci	/* ORN			1110 1010 011x xxxx xxxx xxxx xxxx xxxx */
1208c2ecf20Sopenharmony_ci	/* EOR			1110 1010 100x xxxx xxxx xxxx xxxx xxxx */
1218c2ecf20Sopenharmony_ci	/* PKH			1110 1010 110x xxxx xxxx xxxx xxxx xxxx */
1228c2ecf20Sopenharmony_ci	/* ADD			1110 1011 000x xxxx xxxx xxxx xxxx xxxx */
1238c2ecf20Sopenharmony_ci	/* ADC			1110 1011 010x xxxx xxxx xxxx xxxx xxxx */
1248c2ecf20Sopenharmony_ci	/* SBC			1110 1011 011x xxxx xxxx xxxx xxxx xxxx */
1258c2ecf20Sopenharmony_ci	/* SUB			1110 1011 101x xxxx xxxx xxxx xxxx xxxx */
1268c2ecf20Sopenharmony_ci	/* RSB			1110 1011 110x xxxx xxxx xxxx xxxx xxxx */
1278c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xfe000000, 0xea000000, PROBES_T32_LOGICAL,
1288c2ecf20Sopenharmony_ci						 REGS(NOSPPC, 0, NOSPPC, 0, NOSPPC)),
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci	DECODE_END
1318c2ecf20Sopenharmony_ci};
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_cistatic const union decode_item t32_table_1111_0x0x___0[] = {
1348c2ecf20Sopenharmony_ci	/* Data-processing (modified immediate)				*/
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci	/* TST			1111 0x00 0001 xxxx 0xxx 1111 xxxx xxxx */
1378c2ecf20Sopenharmony_ci	/* TEQ			1111 0x00 1001 xxxx 0xxx 1111 xxxx xxxx */
1388c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xfb708f00, 0xf0100f00, PROBES_T32_TST,
1398c2ecf20Sopenharmony_ci						 REGS(NOSPPC, 0, 0, 0, 0)),
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci	/* CMN			1111 0x01 0001 xxxx 0xxx 1111 xxxx xxxx */
1428c2ecf20Sopenharmony_ci	DECODE_OR	(0xfbf08f00, 0xf1100f00),
1438c2ecf20Sopenharmony_ci	/* CMP			1111 0x01 1011 xxxx 0xxx 1111 xxxx xxxx */
1448c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xfbf08f00, 0xf1b00f00, PROBES_T32_CMP,
1458c2ecf20Sopenharmony_ci						 REGS(NOPC, 0, 0, 0, 0)),
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci	/* MOV			1111 0x00 010x 1111 0xxx xxxx xxxx xxxx */
1488c2ecf20Sopenharmony_ci	/* MVN			1111 0x00 011x 1111 0xxx xxxx xxxx xxxx */
1498c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xfbcf8000, 0xf04f0000, PROBES_T32_MOV,
1508c2ecf20Sopenharmony_ci						 REGS(0, 0, NOSPPC, 0, 0)),
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci	/* ???			1111 0x00 101x xxxx 0xxx xxxx xxxx xxxx */
1538c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xfbe08000, 0xf0a00000),
1548c2ecf20Sopenharmony_ci	/* ???			1111 0x00 110x xxxx 0xxx xxxx xxxx xxxx */
1558c2ecf20Sopenharmony_ci	/* ???			1111 0x00 111x xxxx 0xxx xxxx xxxx xxxx */
1568c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xfbc08000, 0xf0c00000),
1578c2ecf20Sopenharmony_ci	/* ???			1111 0x01 001x xxxx 0xxx xxxx xxxx xxxx */
1588c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xfbe08000, 0xf1200000),
1598c2ecf20Sopenharmony_ci	/* ???			1111 0x01 100x xxxx 0xxx xxxx xxxx xxxx */
1608c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xfbe08000, 0xf1800000),
1618c2ecf20Sopenharmony_ci	/* ???			1111 0x01 111x xxxx 0xxx xxxx xxxx xxxx */
1628c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xfbe08000, 0xf1e00000),
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci	/* ADD Rd, SP, #imm	1111 0x01 000x 1101 0xxx xxxx xxxx xxxx */
1658c2ecf20Sopenharmony_ci	/* SUB Rd, SP, #imm	1111 0x01 101x 1101 0xxx xxxx xxxx xxxx */
1668c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xfb4f8000, 0xf10d0000, PROBES_T32_ADDSUB,
1678c2ecf20Sopenharmony_ci						 REGS(SP, 0, NOPC, 0, 0)),
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci	/* AND			1111 0x00 000x xxxx 0xxx xxxx xxxx xxxx */
1708c2ecf20Sopenharmony_ci	/* BIC			1111 0x00 001x xxxx 0xxx xxxx xxxx xxxx */
1718c2ecf20Sopenharmony_ci	/* ORR			1111 0x00 010x xxxx 0xxx xxxx xxxx xxxx */
1728c2ecf20Sopenharmony_ci	/* ORN			1111 0x00 011x xxxx 0xxx xxxx xxxx xxxx */
1738c2ecf20Sopenharmony_ci	/* EOR			1111 0x00 100x xxxx 0xxx xxxx xxxx xxxx */
1748c2ecf20Sopenharmony_ci	/* ADD			1111 0x01 000x xxxx 0xxx xxxx xxxx xxxx */
1758c2ecf20Sopenharmony_ci	/* ADC			1111 0x01 010x xxxx 0xxx xxxx xxxx xxxx */
1768c2ecf20Sopenharmony_ci	/* SBC			1111 0x01 011x xxxx 0xxx xxxx xxxx xxxx */
1778c2ecf20Sopenharmony_ci	/* SUB			1111 0x01 101x xxxx 0xxx xxxx xxxx xxxx */
1788c2ecf20Sopenharmony_ci	/* RSB			1111 0x01 110x xxxx 0xxx xxxx xxxx xxxx */
1798c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xfa008000, 0xf0000000, PROBES_T32_LOGICAL,
1808c2ecf20Sopenharmony_ci						 REGS(NOSPPC, 0, NOSPPC, 0, 0)),
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci	DECODE_END
1838c2ecf20Sopenharmony_ci};
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_cistatic const union decode_item t32_table_1111_0x1x___0[] = {
1868c2ecf20Sopenharmony_ci	/* Data-processing (plain binary immediate)			*/
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_ci	/* ADDW Rd, PC, #imm	1111 0x10 0000 1111 0xxx xxxx xxxx xxxx */
1898c2ecf20Sopenharmony_ci	DECODE_OR	(0xfbff8000, 0xf20f0000),
1908c2ecf20Sopenharmony_ci	/* SUBW	Rd, PC, #imm	1111 0x10 1010 1111 0xxx xxxx xxxx xxxx */
1918c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xfbff8000, 0xf2af0000, PROBES_T32_ADDWSUBW_PC,
1928c2ecf20Sopenharmony_ci						 REGS(PC, 0, NOSPPC, 0, 0)),
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_ci	/* ADDW SP, SP, #imm	1111 0x10 0000 1101 0xxx 1101 xxxx xxxx */
1958c2ecf20Sopenharmony_ci	DECODE_OR	(0xfbff8f00, 0xf20d0d00),
1968c2ecf20Sopenharmony_ci	/* SUBW	SP, SP, #imm	1111 0x10 1010 1101 0xxx 1101 xxxx xxxx */
1978c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xfbff8f00, 0xf2ad0d00, PROBES_T32_ADDWSUBW,
1988c2ecf20Sopenharmony_ci						 REGS(SP, 0, SP, 0, 0)),
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ci	/* ADDW			1111 0x10 0000 xxxx 0xxx xxxx xxxx xxxx */
2018c2ecf20Sopenharmony_ci	DECODE_OR	(0xfbf08000, 0xf2000000),
2028c2ecf20Sopenharmony_ci	/* SUBW			1111 0x10 1010 xxxx 0xxx xxxx xxxx xxxx */
2038c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xfbf08000, 0xf2a00000, PROBES_T32_ADDWSUBW,
2048c2ecf20Sopenharmony_ci						 REGS(NOPCX, 0, NOSPPC, 0, 0)),
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ci	/* MOVW			1111 0x10 0100 xxxx 0xxx xxxx xxxx xxxx */
2078c2ecf20Sopenharmony_ci	/* MOVT			1111 0x10 1100 xxxx 0xxx xxxx xxxx xxxx */
2088c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xfb708000, 0xf2400000, PROBES_T32_MOVW,
2098c2ecf20Sopenharmony_ci						 REGS(0, 0, NOSPPC, 0, 0)),
2108c2ecf20Sopenharmony_ci
2118c2ecf20Sopenharmony_ci	/* SSAT16		1111 0x11 0010 xxxx 0000 xxxx 00xx xxxx */
2128c2ecf20Sopenharmony_ci	/* SSAT			1111 0x11 00x0 xxxx 0xxx xxxx xxxx xxxx */
2138c2ecf20Sopenharmony_ci	/* USAT16		1111 0x11 1010 xxxx 0000 xxxx 00xx xxxx */
2148c2ecf20Sopenharmony_ci	/* USAT			1111 0x11 10x0 xxxx 0xxx xxxx xxxx xxxx */
2158c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xfb508000, 0xf3000000, PROBES_T32_SAT,
2168c2ecf20Sopenharmony_ci						 REGS(NOSPPC, 0, NOSPPC, 0, 0)),
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci	/* SFBX			1111 0x11 0100 xxxx 0xxx xxxx xxxx xxxx */
2198c2ecf20Sopenharmony_ci	/* UFBX			1111 0x11 1100 xxxx 0xxx xxxx xxxx xxxx */
2208c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xfb708000, 0xf3400000, PROBES_T32_BITFIELD,
2218c2ecf20Sopenharmony_ci						 REGS(NOSPPC, 0, NOSPPC, 0, 0)),
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_ci	/* BFC			1111 0x11 0110 1111 0xxx xxxx xxxx xxxx */
2248c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xfbff8000, 0xf36f0000, PROBES_T32_BITFIELD,
2258c2ecf20Sopenharmony_ci						 REGS(0, 0, NOSPPC, 0, 0)),
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci	/* BFI			1111 0x11 0110 xxxx 0xxx xxxx xxxx xxxx */
2288c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xfbf08000, 0xf3600000, PROBES_T32_BITFIELD,
2298c2ecf20Sopenharmony_ci						 REGS(NOSPPCX, 0, NOSPPC, 0, 0)),
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_ci	DECODE_END
2328c2ecf20Sopenharmony_ci};
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_cistatic const union decode_item t32_table_1111_0xxx___1[] = {
2358c2ecf20Sopenharmony_ci	/* Branches and miscellaneous control				*/
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_ci	/* YIELD		1111 0011 1010 xxxx 10x0 x000 0000 0001 */
2388c2ecf20Sopenharmony_ci	DECODE_OR	(0xfff0d7ff, 0xf3a08001),
2398c2ecf20Sopenharmony_ci	/* SEV			1111 0011 1010 xxxx 10x0 x000 0000 0100 */
2408c2ecf20Sopenharmony_ci	DECODE_EMULATE	(0xfff0d7ff, 0xf3a08004, PROBES_T32_SEV),
2418c2ecf20Sopenharmony_ci	/* NOP			1111 0011 1010 xxxx 10x0 x000 0000 0000 */
2428c2ecf20Sopenharmony_ci	/* WFE			1111 0011 1010 xxxx 10x0 x000 0000 0010 */
2438c2ecf20Sopenharmony_ci	/* WFI			1111 0011 1010 xxxx 10x0 x000 0000 0011 */
2448c2ecf20Sopenharmony_ci	DECODE_SIMULATE	(0xfff0d7fc, 0xf3a08000, PROBES_T32_WFE),
2458c2ecf20Sopenharmony_ci
2468c2ecf20Sopenharmony_ci	/* MRS Rd, CPSR		1111 0011 1110 xxxx 10x0 xxxx xxxx xxxx */
2478c2ecf20Sopenharmony_ci	DECODE_SIMULATEX(0xfff0d000, 0xf3e08000, PROBES_T32_MRS,
2488c2ecf20Sopenharmony_ci						 REGS(0, 0, NOSPPC, 0, 0)),
2498c2ecf20Sopenharmony_ci
2508c2ecf20Sopenharmony_ci	/*
2518c2ecf20Sopenharmony_ci	 * Unsupported instructions
2528c2ecf20Sopenharmony_ci	 *			1111 0x11 1xxx xxxx 10x0 xxxx xxxx xxxx
2538c2ecf20Sopenharmony_ci	 *
2548c2ecf20Sopenharmony_ci	 * MSR			1111 0011 100x xxxx 10x0 xxxx xxxx xxxx
2558c2ecf20Sopenharmony_ci	 * DBG hint		1111 0011 1010 xxxx 10x0 x000 1111 xxxx
2568c2ecf20Sopenharmony_ci	 * Unallocated hints	1111 0011 1010 xxxx 10x0 x000 xxxx xxxx
2578c2ecf20Sopenharmony_ci	 * CPS			1111 0011 1010 xxxx 10x0 xxxx xxxx xxxx
2588c2ecf20Sopenharmony_ci	 * CLREX/DSB/DMB/ISB	1111 0011 1011 xxxx 10x0 xxxx xxxx xxxx
2598c2ecf20Sopenharmony_ci	 * BXJ			1111 0011 1100 xxxx 10x0 xxxx xxxx xxxx
2608c2ecf20Sopenharmony_ci	 * SUBS PC,LR,#<imm8>	1111 0011 1101 xxxx 10x0 xxxx xxxx xxxx
2618c2ecf20Sopenharmony_ci	 * MRS Rd, SPSR		1111 0011 1111 xxxx 10x0 xxxx xxxx xxxx
2628c2ecf20Sopenharmony_ci	 * SMC			1111 0111 1111 xxxx 1000 xxxx xxxx xxxx
2638c2ecf20Sopenharmony_ci	 * UNDEFINED		1111 0111 1111 xxxx 1010 xxxx xxxx xxxx
2648c2ecf20Sopenharmony_ci	 * ???			1111 0111 1xxx xxxx 1010 xxxx xxxx xxxx
2658c2ecf20Sopenharmony_ci	 */
2668c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xfb80d000, 0xf3808000),
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_ci	/* Bcc			1111 0xxx xxxx xxxx 10x0 xxxx xxxx xxxx */
2698c2ecf20Sopenharmony_ci	DECODE_CUSTOM	(0xf800d000, 0xf0008000, PROBES_T32_BRANCH_COND),
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci	/* BLX			1111 0xxx xxxx xxxx 11x0 xxxx xxxx xxx0 */
2728c2ecf20Sopenharmony_ci	DECODE_OR	(0xf800d001, 0xf000c000),
2738c2ecf20Sopenharmony_ci	/* B			1111 0xxx xxxx xxxx 10x1 xxxx xxxx xxxx */
2748c2ecf20Sopenharmony_ci	/* BL			1111 0xxx xxxx xxxx 11x1 xxxx xxxx xxxx */
2758c2ecf20Sopenharmony_ci	DECODE_SIMULATE	(0xf8009000, 0xf0009000, PROBES_T32_BRANCH),
2768c2ecf20Sopenharmony_ci
2778c2ecf20Sopenharmony_ci	DECODE_END
2788c2ecf20Sopenharmony_ci};
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_cistatic const union decode_item t32_table_1111_100x_x0x1__1111[] = {
2818c2ecf20Sopenharmony_ci	/* Memory hints							*/
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_ci	/* PLD (literal)	1111 1000 x001 1111 1111 xxxx xxxx xxxx */
2848c2ecf20Sopenharmony_ci	/* PLI (literal)	1111 1001 x001 1111 1111 xxxx xxxx xxxx */
2858c2ecf20Sopenharmony_ci	DECODE_SIMULATE	(0xfe7ff000, 0xf81ff000, PROBES_T32_PLDI),
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_ci	/* PLD{W} (immediate)	1111 1000 10x1 xxxx 1111 xxxx xxxx xxxx */
2888c2ecf20Sopenharmony_ci	DECODE_OR	(0xffd0f000, 0xf890f000),
2898c2ecf20Sopenharmony_ci	/* PLD{W} (immediate)	1111 1000 00x1 xxxx 1111 1100 xxxx xxxx */
2908c2ecf20Sopenharmony_ci	DECODE_OR	(0xffd0ff00, 0xf810fc00),
2918c2ecf20Sopenharmony_ci	/* PLI (immediate)	1111 1001 1001 xxxx 1111 xxxx xxxx xxxx */
2928c2ecf20Sopenharmony_ci	DECODE_OR	(0xfff0f000, 0xf990f000),
2938c2ecf20Sopenharmony_ci	/* PLI (immediate)	1111 1001 0001 xxxx 1111 1100 xxxx xxxx */
2948c2ecf20Sopenharmony_ci	DECODE_SIMULATEX(0xfff0ff00, 0xf910fc00, PROBES_T32_PLDI,
2958c2ecf20Sopenharmony_ci						 REGS(NOPCX, 0, 0, 0, 0)),
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ci	/* PLD{W} (register)	1111 1000 00x1 xxxx 1111 0000 00xx xxxx */
2988c2ecf20Sopenharmony_ci	DECODE_OR	(0xffd0ffc0, 0xf810f000),
2998c2ecf20Sopenharmony_ci	/* PLI (register)	1111 1001 0001 xxxx 1111 0000 00xx xxxx */
3008c2ecf20Sopenharmony_ci	DECODE_SIMULATEX(0xfff0ffc0, 0xf910f000, PROBES_T32_PLDI,
3018c2ecf20Sopenharmony_ci						 REGS(NOPCX, 0, 0, 0, NOSPPC)),
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_ci	/* Other unallocated instructions...				*/
3048c2ecf20Sopenharmony_ci	DECODE_END
3058c2ecf20Sopenharmony_ci};
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_cistatic const union decode_item t32_table_1111_100x[] = {
3088c2ecf20Sopenharmony_ci	/* Store/Load single data item					*/
3098c2ecf20Sopenharmony_ci
3108c2ecf20Sopenharmony_ci	/* ???			1111 100x x11x xxxx xxxx xxxx xxxx xxxx */
3118c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xfe600000, 0xf8600000),
3128c2ecf20Sopenharmony_ci
3138c2ecf20Sopenharmony_ci	/* ???			1111 1001 0101 xxxx xxxx xxxx xxxx xxxx */
3148c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xfff00000, 0xf9500000),
3158c2ecf20Sopenharmony_ci
3168c2ecf20Sopenharmony_ci	/* ???			1111 100x 0xxx xxxx xxxx 10x0 xxxx xxxx */
3178c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xfe800d00, 0xf8000800),
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci	/* STRBT		1111 1000 0000 xxxx xxxx 1110 xxxx xxxx */
3208c2ecf20Sopenharmony_ci	/* STRHT		1111 1000 0010 xxxx xxxx 1110 xxxx xxxx */
3218c2ecf20Sopenharmony_ci	/* STRT			1111 1000 0100 xxxx xxxx 1110 xxxx xxxx */
3228c2ecf20Sopenharmony_ci	/* LDRBT		1111 1000 0001 xxxx xxxx 1110 xxxx xxxx */
3238c2ecf20Sopenharmony_ci	/* LDRSBT		1111 1001 0001 xxxx xxxx 1110 xxxx xxxx */
3248c2ecf20Sopenharmony_ci	/* LDRHT		1111 1000 0011 xxxx xxxx 1110 xxxx xxxx */
3258c2ecf20Sopenharmony_ci	/* LDRSHT		1111 1001 0011 xxxx xxxx 1110 xxxx xxxx */
3268c2ecf20Sopenharmony_ci	/* LDRT			1111 1000 0101 xxxx xxxx 1110 xxxx xxxx */
3278c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xfe800f00, 0xf8000e00),
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci	/* STR{,B,H} Rn,[PC...]	1111 1000 xxx0 1111 xxxx xxxx xxxx xxxx */
3308c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xff1f0000, 0xf80f0000),
3318c2ecf20Sopenharmony_ci
3328c2ecf20Sopenharmony_ci	/* STR{,B,H} PC,[Rn...]	1111 1000 xxx0 xxxx 1111 xxxx xxxx xxxx */
3338c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xff10f000, 0xf800f000),
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci	/* LDR (literal)	1111 1000 x101 1111 xxxx xxxx xxxx xxxx */
3368c2ecf20Sopenharmony_ci	DECODE_SIMULATEX(0xff7f0000, 0xf85f0000, PROBES_T32_LDR_LIT,
3378c2ecf20Sopenharmony_ci						 REGS(PC, ANY, 0, 0, 0)),
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci	/* STR (immediate)	1111 1000 0100 xxxx xxxx 1xxx xxxx xxxx */
3408c2ecf20Sopenharmony_ci	/* LDR (immediate)	1111 1000 0101 xxxx xxxx 1xxx xxxx xxxx */
3418c2ecf20Sopenharmony_ci	DECODE_OR	(0xffe00800, 0xf8400800),
3428c2ecf20Sopenharmony_ci	/* STR (immediate)	1111 1000 1100 xxxx xxxx xxxx xxxx xxxx */
3438c2ecf20Sopenharmony_ci	/* LDR (immediate)	1111 1000 1101 xxxx xxxx xxxx xxxx xxxx */
3448c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xffe00000, 0xf8c00000, PROBES_T32_LDRSTR,
3458c2ecf20Sopenharmony_ci						 REGS(NOPCX, ANY, 0, 0, 0)),
3468c2ecf20Sopenharmony_ci
3478c2ecf20Sopenharmony_ci	/* STR (register)	1111 1000 0100 xxxx xxxx 0000 00xx xxxx */
3488c2ecf20Sopenharmony_ci	/* LDR (register)	1111 1000 0101 xxxx xxxx 0000 00xx xxxx */
3498c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xffe00fc0, 0xf8400000, PROBES_T32_LDRSTR,
3508c2ecf20Sopenharmony_ci						 REGS(NOPCX, ANY, 0, 0, NOSPPC)),
3518c2ecf20Sopenharmony_ci
3528c2ecf20Sopenharmony_ci	/* LDRB (literal)	1111 1000 x001 1111 xxxx xxxx xxxx xxxx */
3538c2ecf20Sopenharmony_ci	/* LDRSB (literal)	1111 1001 x001 1111 xxxx xxxx xxxx xxxx */
3548c2ecf20Sopenharmony_ci	/* LDRH (literal)	1111 1000 x011 1111 xxxx xxxx xxxx xxxx */
3558c2ecf20Sopenharmony_ci	/* LDRSH (literal)	1111 1001 x011 1111 xxxx xxxx xxxx xxxx */
3568c2ecf20Sopenharmony_ci	DECODE_SIMULATEX(0xfe5f0000, 0xf81f0000, PROBES_T32_LDR_LIT,
3578c2ecf20Sopenharmony_ci						 REGS(PC, NOSPPCX, 0, 0, 0)),
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_ci	/* STRB (immediate)	1111 1000 0000 xxxx xxxx 1xxx xxxx xxxx */
3608c2ecf20Sopenharmony_ci	/* STRH (immediate)	1111 1000 0010 xxxx xxxx 1xxx xxxx xxxx */
3618c2ecf20Sopenharmony_ci	/* LDRB (immediate)	1111 1000 0001 xxxx xxxx 1xxx xxxx xxxx */
3628c2ecf20Sopenharmony_ci	/* LDRSB (immediate)	1111 1001 0001 xxxx xxxx 1xxx xxxx xxxx */
3638c2ecf20Sopenharmony_ci	/* LDRH (immediate)	1111 1000 0011 xxxx xxxx 1xxx xxxx xxxx */
3648c2ecf20Sopenharmony_ci	/* LDRSH (immediate)	1111 1001 0011 xxxx xxxx 1xxx xxxx xxxx */
3658c2ecf20Sopenharmony_ci	DECODE_OR	(0xfec00800, 0xf8000800),
3668c2ecf20Sopenharmony_ci	/* STRB (immediate)	1111 1000 1000 xxxx xxxx xxxx xxxx xxxx */
3678c2ecf20Sopenharmony_ci	/* STRH (immediate)	1111 1000 1010 xxxx xxxx xxxx xxxx xxxx */
3688c2ecf20Sopenharmony_ci	/* LDRB (immediate)	1111 1000 1001 xxxx xxxx xxxx xxxx xxxx */
3698c2ecf20Sopenharmony_ci	/* LDRSB (immediate)	1111 1001 1001 xxxx xxxx xxxx xxxx xxxx */
3708c2ecf20Sopenharmony_ci	/* LDRH (immediate)	1111 1000 1011 xxxx xxxx xxxx xxxx xxxx */
3718c2ecf20Sopenharmony_ci	/* LDRSH (immediate)	1111 1001 1011 xxxx xxxx xxxx xxxx xxxx */
3728c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xfec00000, 0xf8800000, PROBES_T32_LDRSTR,
3738c2ecf20Sopenharmony_ci						 REGS(NOPCX, NOSPPCX, 0, 0, 0)),
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_ci	/* STRB (register)	1111 1000 0000 xxxx xxxx 0000 00xx xxxx */
3768c2ecf20Sopenharmony_ci	/* STRH (register)	1111 1000 0010 xxxx xxxx 0000 00xx xxxx */
3778c2ecf20Sopenharmony_ci	/* LDRB (register)	1111 1000 0001 xxxx xxxx 0000 00xx xxxx */
3788c2ecf20Sopenharmony_ci	/* LDRSB (register)	1111 1001 0001 xxxx xxxx 0000 00xx xxxx */
3798c2ecf20Sopenharmony_ci	/* LDRH (register)	1111 1000 0011 xxxx xxxx 0000 00xx xxxx */
3808c2ecf20Sopenharmony_ci	/* LDRSH (register)	1111 1001 0011 xxxx xxxx 0000 00xx xxxx */
3818c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xfe800fc0, 0xf8000000, PROBES_T32_LDRSTR,
3828c2ecf20Sopenharmony_ci						 REGS(NOPCX, NOSPPCX, 0, 0, NOSPPC)),
3838c2ecf20Sopenharmony_ci
3848c2ecf20Sopenharmony_ci	/* Other unallocated instructions...				*/
3858c2ecf20Sopenharmony_ci	DECODE_END
3868c2ecf20Sopenharmony_ci};
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_cistatic const union decode_item t32_table_1111_1010___1111[] = {
3898c2ecf20Sopenharmony_ci	/* Data-processing (register)					*/
3908c2ecf20Sopenharmony_ci
3918c2ecf20Sopenharmony_ci	/* ???			1111 1010 011x xxxx 1111 xxxx 1xxx xxxx */
3928c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xffe0f080, 0xfa60f080),
3938c2ecf20Sopenharmony_ci
3948c2ecf20Sopenharmony_ci	/* SXTH			1111 1010 0000 1111 1111 xxxx 1xxx xxxx */
3958c2ecf20Sopenharmony_ci	/* UXTH			1111 1010 0001 1111 1111 xxxx 1xxx xxxx */
3968c2ecf20Sopenharmony_ci	/* SXTB16		1111 1010 0010 1111 1111 xxxx 1xxx xxxx */
3978c2ecf20Sopenharmony_ci	/* UXTB16		1111 1010 0011 1111 1111 xxxx 1xxx xxxx */
3988c2ecf20Sopenharmony_ci	/* SXTB			1111 1010 0100 1111 1111 xxxx 1xxx xxxx */
3998c2ecf20Sopenharmony_ci	/* UXTB			1111 1010 0101 1111 1111 xxxx 1xxx xxxx */
4008c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xff8ff080, 0xfa0ff080, PROBES_T32_SIGN_EXTEND,
4018c2ecf20Sopenharmony_ci						 REGS(0, 0, NOSPPC, 0, NOSPPC)),
4028c2ecf20Sopenharmony_ci
4038c2ecf20Sopenharmony_ci
4048c2ecf20Sopenharmony_ci	/* ???			1111 1010 1xxx xxxx 1111 xxxx 0x11 xxxx */
4058c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xff80f0b0, 0xfa80f030),
4068c2ecf20Sopenharmony_ci	/* ???			1111 1010 1x11 xxxx 1111 xxxx 0xxx xxxx */
4078c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xffb0f080, 0xfab0f000),
4088c2ecf20Sopenharmony_ci
4098c2ecf20Sopenharmony_ci	/* SADD16		1111 1010 1001 xxxx 1111 xxxx 0000 xxxx */
4108c2ecf20Sopenharmony_ci	/* SASX			1111 1010 1010 xxxx 1111 xxxx 0000 xxxx */
4118c2ecf20Sopenharmony_ci	/* SSAX			1111 1010 1110 xxxx 1111 xxxx 0000 xxxx */
4128c2ecf20Sopenharmony_ci	/* SSUB16		1111 1010 1101 xxxx 1111 xxxx 0000 xxxx */
4138c2ecf20Sopenharmony_ci	/* SADD8		1111 1010 1000 xxxx 1111 xxxx 0000 xxxx */
4148c2ecf20Sopenharmony_ci	/* SSUB8		1111 1010 1100 xxxx 1111 xxxx 0000 xxxx */
4158c2ecf20Sopenharmony_ci
4168c2ecf20Sopenharmony_ci	/* QADD16		1111 1010 1001 xxxx 1111 xxxx 0001 xxxx */
4178c2ecf20Sopenharmony_ci	/* QASX			1111 1010 1010 xxxx 1111 xxxx 0001 xxxx */
4188c2ecf20Sopenharmony_ci	/* QSAX			1111 1010 1110 xxxx 1111 xxxx 0001 xxxx */
4198c2ecf20Sopenharmony_ci	/* QSUB16		1111 1010 1101 xxxx 1111 xxxx 0001 xxxx */
4208c2ecf20Sopenharmony_ci	/* QADD8		1111 1010 1000 xxxx 1111 xxxx 0001 xxxx */
4218c2ecf20Sopenharmony_ci	/* QSUB8		1111 1010 1100 xxxx 1111 xxxx 0001 xxxx */
4228c2ecf20Sopenharmony_ci
4238c2ecf20Sopenharmony_ci	/* SHADD16		1111 1010 1001 xxxx 1111 xxxx 0010 xxxx */
4248c2ecf20Sopenharmony_ci	/* SHASX		1111 1010 1010 xxxx 1111 xxxx 0010 xxxx */
4258c2ecf20Sopenharmony_ci	/* SHSAX		1111 1010 1110 xxxx 1111 xxxx 0010 xxxx */
4268c2ecf20Sopenharmony_ci	/* SHSUB16		1111 1010 1101 xxxx 1111 xxxx 0010 xxxx */
4278c2ecf20Sopenharmony_ci	/* SHADD8		1111 1010 1000 xxxx 1111 xxxx 0010 xxxx */
4288c2ecf20Sopenharmony_ci	/* SHSUB8		1111 1010 1100 xxxx 1111 xxxx 0010 xxxx */
4298c2ecf20Sopenharmony_ci
4308c2ecf20Sopenharmony_ci	/* UADD16		1111 1010 1001 xxxx 1111 xxxx 0100 xxxx */
4318c2ecf20Sopenharmony_ci	/* UASX			1111 1010 1010 xxxx 1111 xxxx 0100 xxxx */
4328c2ecf20Sopenharmony_ci	/* USAX			1111 1010 1110 xxxx 1111 xxxx 0100 xxxx */
4338c2ecf20Sopenharmony_ci	/* USUB16		1111 1010 1101 xxxx 1111 xxxx 0100 xxxx */
4348c2ecf20Sopenharmony_ci	/* UADD8		1111 1010 1000 xxxx 1111 xxxx 0100 xxxx */
4358c2ecf20Sopenharmony_ci	/* USUB8		1111 1010 1100 xxxx 1111 xxxx 0100 xxxx */
4368c2ecf20Sopenharmony_ci
4378c2ecf20Sopenharmony_ci	/* UQADD16		1111 1010 1001 xxxx 1111 xxxx 0101 xxxx */
4388c2ecf20Sopenharmony_ci	/* UQASX		1111 1010 1010 xxxx 1111 xxxx 0101 xxxx */
4398c2ecf20Sopenharmony_ci	/* UQSAX		1111 1010 1110 xxxx 1111 xxxx 0101 xxxx */
4408c2ecf20Sopenharmony_ci	/* UQSUB16		1111 1010 1101 xxxx 1111 xxxx 0101 xxxx */
4418c2ecf20Sopenharmony_ci	/* UQADD8		1111 1010 1000 xxxx 1111 xxxx 0101 xxxx */
4428c2ecf20Sopenharmony_ci	/* UQSUB8		1111 1010 1100 xxxx 1111 xxxx 0101 xxxx */
4438c2ecf20Sopenharmony_ci
4448c2ecf20Sopenharmony_ci	/* UHADD16		1111 1010 1001 xxxx 1111 xxxx 0110 xxxx */
4458c2ecf20Sopenharmony_ci	/* UHASX		1111 1010 1010 xxxx 1111 xxxx 0110 xxxx */
4468c2ecf20Sopenharmony_ci	/* UHSAX		1111 1010 1110 xxxx 1111 xxxx 0110 xxxx */
4478c2ecf20Sopenharmony_ci	/* UHSUB16		1111 1010 1101 xxxx 1111 xxxx 0110 xxxx */
4488c2ecf20Sopenharmony_ci	/* UHADD8		1111 1010 1000 xxxx 1111 xxxx 0110 xxxx */
4498c2ecf20Sopenharmony_ci	/* UHSUB8		1111 1010 1100 xxxx 1111 xxxx 0110 xxxx */
4508c2ecf20Sopenharmony_ci	DECODE_OR	(0xff80f080, 0xfa80f000),
4518c2ecf20Sopenharmony_ci
4528c2ecf20Sopenharmony_ci	/* SXTAH		1111 1010 0000 xxxx 1111 xxxx 1xxx xxxx */
4538c2ecf20Sopenharmony_ci	/* UXTAH		1111 1010 0001 xxxx 1111 xxxx 1xxx xxxx */
4548c2ecf20Sopenharmony_ci	/* SXTAB16		1111 1010 0010 xxxx 1111 xxxx 1xxx xxxx */
4558c2ecf20Sopenharmony_ci	/* UXTAB16		1111 1010 0011 xxxx 1111 xxxx 1xxx xxxx */
4568c2ecf20Sopenharmony_ci	/* SXTAB		1111 1010 0100 xxxx 1111 xxxx 1xxx xxxx */
4578c2ecf20Sopenharmony_ci	/* UXTAB		1111 1010 0101 xxxx 1111 xxxx 1xxx xxxx */
4588c2ecf20Sopenharmony_ci	DECODE_OR	(0xff80f080, 0xfa00f080),
4598c2ecf20Sopenharmony_ci
4608c2ecf20Sopenharmony_ci	/* QADD			1111 1010 1000 xxxx 1111 xxxx 1000 xxxx */
4618c2ecf20Sopenharmony_ci	/* QDADD		1111 1010 1000 xxxx 1111 xxxx 1001 xxxx */
4628c2ecf20Sopenharmony_ci	/* QSUB			1111 1010 1000 xxxx 1111 xxxx 1010 xxxx */
4638c2ecf20Sopenharmony_ci	/* QDSUB		1111 1010 1000 xxxx 1111 xxxx 1011 xxxx */
4648c2ecf20Sopenharmony_ci	DECODE_OR	(0xfff0f0c0, 0xfa80f080),
4658c2ecf20Sopenharmony_ci
4668c2ecf20Sopenharmony_ci	/* SEL			1111 1010 1010 xxxx 1111 xxxx 1000 xxxx */
4678c2ecf20Sopenharmony_ci	DECODE_OR	(0xfff0f0f0, 0xfaa0f080),
4688c2ecf20Sopenharmony_ci
4698c2ecf20Sopenharmony_ci	/* LSL			1111 1010 000x xxxx 1111 xxxx 0000 xxxx */
4708c2ecf20Sopenharmony_ci	/* LSR			1111 1010 001x xxxx 1111 xxxx 0000 xxxx */
4718c2ecf20Sopenharmony_ci	/* ASR			1111 1010 010x xxxx 1111 xxxx 0000 xxxx */
4728c2ecf20Sopenharmony_ci	/* ROR			1111 1010 011x xxxx 1111 xxxx 0000 xxxx */
4738c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xff80f0f0, 0xfa00f000, PROBES_T32_MEDIA,
4748c2ecf20Sopenharmony_ci						 REGS(NOSPPC, 0, NOSPPC, 0, NOSPPC)),
4758c2ecf20Sopenharmony_ci
4768c2ecf20Sopenharmony_ci	/* CLZ			1111 1010 1010 xxxx 1111 xxxx 1000 xxxx */
4778c2ecf20Sopenharmony_ci	DECODE_OR	(0xfff0f0f0, 0xfab0f080),
4788c2ecf20Sopenharmony_ci
4798c2ecf20Sopenharmony_ci	/* REV			1111 1010 1001 xxxx 1111 xxxx 1000 xxxx */
4808c2ecf20Sopenharmony_ci	/* REV16		1111 1010 1001 xxxx 1111 xxxx 1001 xxxx */
4818c2ecf20Sopenharmony_ci	/* RBIT			1111 1010 1001 xxxx 1111 xxxx 1010 xxxx */
4828c2ecf20Sopenharmony_ci	/* REVSH		1111 1010 1001 xxxx 1111 xxxx 1011 xxxx */
4838c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xfff0f0c0, 0xfa90f080, PROBES_T32_REVERSE,
4848c2ecf20Sopenharmony_ci						 REGS(NOSPPC, 0, NOSPPC, 0, SAMEAS16)),
4858c2ecf20Sopenharmony_ci
4868c2ecf20Sopenharmony_ci	/* Other unallocated instructions...				*/
4878c2ecf20Sopenharmony_ci	DECODE_END
4888c2ecf20Sopenharmony_ci};
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_cistatic const union decode_item t32_table_1111_1011_0[] = {
4918c2ecf20Sopenharmony_ci	/* Multiply, multiply accumulate, and absolute difference	*/
4928c2ecf20Sopenharmony_ci
4938c2ecf20Sopenharmony_ci	/* ???			1111 1011 0000 xxxx 1111 xxxx 0001 xxxx */
4948c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xfff0f0f0, 0xfb00f010),
4958c2ecf20Sopenharmony_ci	/* ???			1111 1011 0111 xxxx 1111 xxxx 0001 xxxx */
4968c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xfff0f0f0, 0xfb70f010),
4978c2ecf20Sopenharmony_ci
4988c2ecf20Sopenharmony_ci	/* SMULxy		1111 1011 0001 xxxx 1111 xxxx 00xx xxxx */
4998c2ecf20Sopenharmony_ci	DECODE_OR	(0xfff0f0c0, 0xfb10f000),
5008c2ecf20Sopenharmony_ci	/* MUL			1111 1011 0000 xxxx 1111 xxxx 0000 xxxx */
5018c2ecf20Sopenharmony_ci	/* SMUAD{X}		1111 1011 0010 xxxx 1111 xxxx 000x xxxx */
5028c2ecf20Sopenharmony_ci	/* SMULWy		1111 1011 0011 xxxx 1111 xxxx 000x xxxx */
5038c2ecf20Sopenharmony_ci	/* SMUSD{X}		1111 1011 0100 xxxx 1111 xxxx 000x xxxx */
5048c2ecf20Sopenharmony_ci	/* SMMUL{R}		1111 1011 0101 xxxx 1111 xxxx 000x xxxx */
5058c2ecf20Sopenharmony_ci	/* USAD8		1111 1011 0111 xxxx 1111 xxxx 0000 xxxx */
5068c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xff80f0e0, 0xfb00f000, PROBES_T32_MUL_ADD,
5078c2ecf20Sopenharmony_ci						 REGS(NOSPPC, 0, NOSPPC, 0, NOSPPC)),
5088c2ecf20Sopenharmony_ci
5098c2ecf20Sopenharmony_ci	/* ???			1111 1011 0111 xxxx xxxx xxxx 0001 xxxx */
5108c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xfff000f0, 0xfb700010),
5118c2ecf20Sopenharmony_ci
5128c2ecf20Sopenharmony_ci	/* SMLAxy		1111 1011 0001 xxxx xxxx xxxx 00xx xxxx */
5138c2ecf20Sopenharmony_ci	DECODE_OR	(0xfff000c0, 0xfb100000),
5148c2ecf20Sopenharmony_ci	/* MLA			1111 1011 0000 xxxx xxxx xxxx 0000 xxxx */
5158c2ecf20Sopenharmony_ci	/* MLS			1111 1011 0000 xxxx xxxx xxxx 0001 xxxx */
5168c2ecf20Sopenharmony_ci	/* SMLAD{X}		1111 1011 0010 xxxx xxxx xxxx 000x xxxx */
5178c2ecf20Sopenharmony_ci	/* SMLAWy		1111 1011 0011 xxxx xxxx xxxx 000x xxxx */
5188c2ecf20Sopenharmony_ci	/* SMLSD{X}		1111 1011 0100 xxxx xxxx xxxx 000x xxxx */
5198c2ecf20Sopenharmony_ci	/* SMMLA{R}		1111 1011 0101 xxxx xxxx xxxx 000x xxxx */
5208c2ecf20Sopenharmony_ci	/* SMMLS{R}		1111 1011 0110 xxxx xxxx xxxx 000x xxxx */
5218c2ecf20Sopenharmony_ci	/* USADA8		1111 1011 0111 xxxx xxxx xxxx 0000 xxxx */
5228c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xff8000c0, 0xfb000000,  PROBES_T32_MUL_ADD2,
5238c2ecf20Sopenharmony_ci						 REGS(NOSPPC, NOSPPCX, NOSPPC, 0, NOSPPC)),
5248c2ecf20Sopenharmony_ci
5258c2ecf20Sopenharmony_ci	/* Other unallocated instructions...				*/
5268c2ecf20Sopenharmony_ci	DECODE_END
5278c2ecf20Sopenharmony_ci};
5288c2ecf20Sopenharmony_ci
5298c2ecf20Sopenharmony_cistatic const union decode_item t32_table_1111_1011_1[] = {
5308c2ecf20Sopenharmony_ci	/* Long multiply, long multiply accumulate, and divide		*/
5318c2ecf20Sopenharmony_ci
5328c2ecf20Sopenharmony_ci	/* UMAAL		1111 1011 1110 xxxx xxxx xxxx 0110 xxxx */
5338c2ecf20Sopenharmony_ci	DECODE_OR	(0xfff000f0, 0xfbe00060),
5348c2ecf20Sopenharmony_ci	/* SMLALxy		1111 1011 1100 xxxx xxxx xxxx 10xx xxxx */
5358c2ecf20Sopenharmony_ci	DECODE_OR	(0xfff000c0, 0xfbc00080),
5368c2ecf20Sopenharmony_ci	/* SMLALD{X}		1111 1011 1100 xxxx xxxx xxxx 110x xxxx */
5378c2ecf20Sopenharmony_ci	/* SMLSLD{X}		1111 1011 1101 xxxx xxxx xxxx 110x xxxx */
5388c2ecf20Sopenharmony_ci	DECODE_OR	(0xffe000e0, 0xfbc000c0),
5398c2ecf20Sopenharmony_ci	/* SMULL		1111 1011 1000 xxxx xxxx xxxx 0000 xxxx */
5408c2ecf20Sopenharmony_ci	/* UMULL		1111 1011 1010 xxxx xxxx xxxx 0000 xxxx */
5418c2ecf20Sopenharmony_ci	/* SMLAL		1111 1011 1100 xxxx xxxx xxxx 0000 xxxx */
5428c2ecf20Sopenharmony_ci	/* UMLAL		1111 1011 1110 xxxx xxxx xxxx 0000 xxxx */
5438c2ecf20Sopenharmony_ci	DECODE_EMULATEX	(0xff9000f0, 0xfb800000, PROBES_T32_MUL_ADD_LONG,
5448c2ecf20Sopenharmony_ci						 REGS(NOSPPC, NOSPPC, NOSPPC, 0, NOSPPC)),
5458c2ecf20Sopenharmony_ci
5468c2ecf20Sopenharmony_ci	/* SDIV			1111 1011 1001 xxxx xxxx xxxx 1111 xxxx */
5478c2ecf20Sopenharmony_ci	/* UDIV			1111 1011 1011 xxxx xxxx xxxx 1111 xxxx */
5488c2ecf20Sopenharmony_ci	/* Other unallocated instructions...				*/
5498c2ecf20Sopenharmony_ci	DECODE_END
5508c2ecf20Sopenharmony_ci};
5518c2ecf20Sopenharmony_ci
5528c2ecf20Sopenharmony_ciconst union decode_item probes_decode_thumb32_table[] = {
5538c2ecf20Sopenharmony_ci
5548c2ecf20Sopenharmony_ci	/*
5558c2ecf20Sopenharmony_ci	 * Load/store multiple instructions
5568c2ecf20Sopenharmony_ci	 *			1110 100x x0xx xxxx xxxx xxxx xxxx xxxx
5578c2ecf20Sopenharmony_ci	 */
5588c2ecf20Sopenharmony_ci	DECODE_TABLE	(0xfe400000, 0xe8000000, t32_table_1110_100x_x0xx),
5598c2ecf20Sopenharmony_ci
5608c2ecf20Sopenharmony_ci	/*
5618c2ecf20Sopenharmony_ci	 * Load/store dual, load/store exclusive, table branch
5628c2ecf20Sopenharmony_ci	 *			1110 100x x1xx xxxx xxxx xxxx xxxx xxxx
5638c2ecf20Sopenharmony_ci	 */
5648c2ecf20Sopenharmony_ci	DECODE_TABLE	(0xfe400000, 0xe8400000, t32_table_1110_100x_x1xx),
5658c2ecf20Sopenharmony_ci
5668c2ecf20Sopenharmony_ci	/*
5678c2ecf20Sopenharmony_ci	 * Data-processing (shifted register)
5688c2ecf20Sopenharmony_ci	 *			1110 101x xxxx xxxx xxxx xxxx xxxx xxxx
5698c2ecf20Sopenharmony_ci	 */
5708c2ecf20Sopenharmony_ci	DECODE_TABLE	(0xfe000000, 0xea000000, t32_table_1110_101x),
5718c2ecf20Sopenharmony_ci
5728c2ecf20Sopenharmony_ci	/*
5738c2ecf20Sopenharmony_ci	 * Coprocessor instructions
5748c2ecf20Sopenharmony_ci	 *			1110 11xx xxxx xxxx xxxx xxxx xxxx xxxx
5758c2ecf20Sopenharmony_ci	 */
5768c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xfc000000, 0xec000000),
5778c2ecf20Sopenharmony_ci
5788c2ecf20Sopenharmony_ci	/*
5798c2ecf20Sopenharmony_ci	 * Data-processing (modified immediate)
5808c2ecf20Sopenharmony_ci	 *			1111 0x0x xxxx xxxx 0xxx xxxx xxxx xxxx
5818c2ecf20Sopenharmony_ci	 */
5828c2ecf20Sopenharmony_ci	DECODE_TABLE	(0xfa008000, 0xf0000000, t32_table_1111_0x0x___0),
5838c2ecf20Sopenharmony_ci
5848c2ecf20Sopenharmony_ci	/*
5858c2ecf20Sopenharmony_ci	 * Data-processing (plain binary immediate)
5868c2ecf20Sopenharmony_ci	 *			1111 0x1x xxxx xxxx 0xxx xxxx xxxx xxxx
5878c2ecf20Sopenharmony_ci	 */
5888c2ecf20Sopenharmony_ci	DECODE_TABLE	(0xfa008000, 0xf2000000, t32_table_1111_0x1x___0),
5898c2ecf20Sopenharmony_ci
5908c2ecf20Sopenharmony_ci	/*
5918c2ecf20Sopenharmony_ci	 * Branches and miscellaneous control
5928c2ecf20Sopenharmony_ci	 *			1111 0xxx xxxx xxxx 1xxx xxxx xxxx xxxx
5938c2ecf20Sopenharmony_ci	 */
5948c2ecf20Sopenharmony_ci	DECODE_TABLE	(0xf8008000, 0xf0008000, t32_table_1111_0xxx___1),
5958c2ecf20Sopenharmony_ci
5968c2ecf20Sopenharmony_ci	/*
5978c2ecf20Sopenharmony_ci	 * Advanced SIMD element or structure load/store instructions
5988c2ecf20Sopenharmony_ci	 *			1111 1001 xxx0 xxxx xxxx xxxx xxxx xxxx
5998c2ecf20Sopenharmony_ci	 */
6008c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xff100000, 0xf9000000),
6018c2ecf20Sopenharmony_ci
6028c2ecf20Sopenharmony_ci	/*
6038c2ecf20Sopenharmony_ci	 * Memory hints
6048c2ecf20Sopenharmony_ci	 *			1111 100x x0x1 xxxx 1111 xxxx xxxx xxxx
6058c2ecf20Sopenharmony_ci	 */
6068c2ecf20Sopenharmony_ci	DECODE_TABLE	(0xfe50f000, 0xf810f000, t32_table_1111_100x_x0x1__1111),
6078c2ecf20Sopenharmony_ci
6088c2ecf20Sopenharmony_ci	/*
6098c2ecf20Sopenharmony_ci	 * Store single data item
6108c2ecf20Sopenharmony_ci	 *			1111 1000 xxx0 xxxx xxxx xxxx xxxx xxxx
6118c2ecf20Sopenharmony_ci	 * Load single data items
6128c2ecf20Sopenharmony_ci	 *			1111 100x xxx1 xxxx xxxx xxxx xxxx xxxx
6138c2ecf20Sopenharmony_ci	 */
6148c2ecf20Sopenharmony_ci	DECODE_TABLE	(0xfe000000, 0xf8000000, t32_table_1111_100x),
6158c2ecf20Sopenharmony_ci
6168c2ecf20Sopenharmony_ci	/*
6178c2ecf20Sopenharmony_ci	 * Data-processing (register)
6188c2ecf20Sopenharmony_ci	 *			1111 1010 xxxx xxxx 1111 xxxx xxxx xxxx
6198c2ecf20Sopenharmony_ci	 */
6208c2ecf20Sopenharmony_ci	DECODE_TABLE	(0xff00f000, 0xfa00f000, t32_table_1111_1010___1111),
6218c2ecf20Sopenharmony_ci
6228c2ecf20Sopenharmony_ci	/*
6238c2ecf20Sopenharmony_ci	 * Multiply, multiply accumulate, and absolute difference
6248c2ecf20Sopenharmony_ci	 *			1111 1011 0xxx xxxx xxxx xxxx xxxx xxxx
6258c2ecf20Sopenharmony_ci	 */
6268c2ecf20Sopenharmony_ci	DECODE_TABLE	(0xff800000, 0xfb000000, t32_table_1111_1011_0),
6278c2ecf20Sopenharmony_ci
6288c2ecf20Sopenharmony_ci	/*
6298c2ecf20Sopenharmony_ci	 * Long multiply, long multiply accumulate, and divide
6308c2ecf20Sopenharmony_ci	 *			1111 1011 1xxx xxxx xxxx xxxx xxxx xxxx
6318c2ecf20Sopenharmony_ci	 */
6328c2ecf20Sopenharmony_ci	DECODE_TABLE	(0xff800000, 0xfb800000, t32_table_1111_1011_1),
6338c2ecf20Sopenharmony_ci
6348c2ecf20Sopenharmony_ci	/*
6358c2ecf20Sopenharmony_ci	 * Coprocessor instructions
6368c2ecf20Sopenharmony_ci	 *			1111 11xx xxxx xxxx xxxx xxxx xxxx xxxx
6378c2ecf20Sopenharmony_ci	 */
6388c2ecf20Sopenharmony_ci	DECODE_END
6398c2ecf20Sopenharmony_ci};
6408c2ecf20Sopenharmony_ci#ifdef CONFIG_ARM_KPROBES_TEST_MODULE
6418c2ecf20Sopenharmony_ciEXPORT_SYMBOL_GPL(probes_decode_thumb32_table);
6428c2ecf20Sopenharmony_ci#endif
6438c2ecf20Sopenharmony_ci
6448c2ecf20Sopenharmony_cistatic const union decode_item t16_table_1011[] = {
6458c2ecf20Sopenharmony_ci	/* Miscellaneous 16-bit instructions		    */
6468c2ecf20Sopenharmony_ci
6478c2ecf20Sopenharmony_ci	/* ADD (SP plus immediate)	1011 0000 0xxx xxxx */
6488c2ecf20Sopenharmony_ci	/* SUB (SP minus immediate)	1011 0000 1xxx xxxx */
6498c2ecf20Sopenharmony_ci	DECODE_SIMULATE	(0xff00, 0xb000, PROBES_T16_ADD_SP),
6508c2ecf20Sopenharmony_ci
6518c2ecf20Sopenharmony_ci	/* CBZ				1011 00x1 xxxx xxxx */
6528c2ecf20Sopenharmony_ci	/* CBNZ				1011 10x1 xxxx xxxx */
6538c2ecf20Sopenharmony_ci	DECODE_SIMULATE	(0xf500, 0xb100, PROBES_T16_CBZ),
6548c2ecf20Sopenharmony_ci
6558c2ecf20Sopenharmony_ci	/* SXTH				1011 0010 00xx xxxx */
6568c2ecf20Sopenharmony_ci	/* SXTB				1011 0010 01xx xxxx */
6578c2ecf20Sopenharmony_ci	/* UXTH				1011 0010 10xx xxxx */
6588c2ecf20Sopenharmony_ci	/* UXTB				1011 0010 11xx xxxx */
6598c2ecf20Sopenharmony_ci	/* REV				1011 1010 00xx xxxx */
6608c2ecf20Sopenharmony_ci	/* REV16			1011 1010 01xx xxxx */
6618c2ecf20Sopenharmony_ci	/* ???				1011 1010 10xx xxxx */
6628c2ecf20Sopenharmony_ci	/* REVSH			1011 1010 11xx xxxx */
6638c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xffc0, 0xba80),
6648c2ecf20Sopenharmony_ci	DECODE_EMULATE	(0xf500, 0xb000, PROBES_T16_SIGN_EXTEND),
6658c2ecf20Sopenharmony_ci
6668c2ecf20Sopenharmony_ci	/* PUSH				1011 010x xxxx xxxx */
6678c2ecf20Sopenharmony_ci	DECODE_CUSTOM	(0xfe00, 0xb400, PROBES_T16_PUSH),
6688c2ecf20Sopenharmony_ci	/* POP				1011 110x xxxx xxxx */
6698c2ecf20Sopenharmony_ci	DECODE_CUSTOM	(0xfe00, 0xbc00, PROBES_T16_POP),
6708c2ecf20Sopenharmony_ci
6718c2ecf20Sopenharmony_ci	/*
6728c2ecf20Sopenharmony_ci	 * If-Then, and hints
6738c2ecf20Sopenharmony_ci	 *				1011 1111 xxxx xxxx
6748c2ecf20Sopenharmony_ci	 */
6758c2ecf20Sopenharmony_ci
6768c2ecf20Sopenharmony_ci	/* YIELD			1011 1111 0001 0000 */
6778c2ecf20Sopenharmony_ci	DECODE_OR	(0xffff, 0xbf10),
6788c2ecf20Sopenharmony_ci	/* SEV				1011 1111 0100 0000 */
6798c2ecf20Sopenharmony_ci	DECODE_EMULATE	(0xffff, 0xbf40, PROBES_T16_SEV),
6808c2ecf20Sopenharmony_ci	/* NOP				1011 1111 0000 0000 */
6818c2ecf20Sopenharmony_ci	/* WFE				1011 1111 0010 0000 */
6828c2ecf20Sopenharmony_ci	/* WFI				1011 1111 0011 0000 */
6838c2ecf20Sopenharmony_ci	DECODE_SIMULATE	(0xffcf, 0xbf00, PROBES_T16_WFE),
6848c2ecf20Sopenharmony_ci	/* Unassigned hints		1011 1111 xxxx 0000 */
6858c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xff0f, 0xbf00),
6868c2ecf20Sopenharmony_ci	/* IT				1011 1111 xxxx xxxx */
6878c2ecf20Sopenharmony_ci	DECODE_CUSTOM	(0xff00, 0xbf00, PROBES_T16_IT),
6888c2ecf20Sopenharmony_ci
6898c2ecf20Sopenharmony_ci	/* SETEND			1011 0110 010x xxxx */
6908c2ecf20Sopenharmony_ci	/* CPS				1011 0110 011x xxxx */
6918c2ecf20Sopenharmony_ci	/* BKPT				1011 1110 xxxx xxxx */
6928c2ecf20Sopenharmony_ci	/* And unallocated instructions...		    */
6938c2ecf20Sopenharmony_ci	DECODE_END
6948c2ecf20Sopenharmony_ci};
6958c2ecf20Sopenharmony_ci
6968c2ecf20Sopenharmony_ciconst union decode_item probes_decode_thumb16_table[] = {
6978c2ecf20Sopenharmony_ci
6988c2ecf20Sopenharmony_ci	/*
6998c2ecf20Sopenharmony_ci	 * Shift (immediate), add, subtract, move, and compare
7008c2ecf20Sopenharmony_ci	 *				00xx xxxx xxxx xxxx
7018c2ecf20Sopenharmony_ci	 */
7028c2ecf20Sopenharmony_ci
7038c2ecf20Sopenharmony_ci	/* CMP (immediate)		0010 1xxx xxxx xxxx */
7048c2ecf20Sopenharmony_ci	DECODE_EMULATE	(0xf800, 0x2800, PROBES_T16_CMP),
7058c2ecf20Sopenharmony_ci
7068c2ecf20Sopenharmony_ci	/* ADD (register)		0001 100x xxxx xxxx */
7078c2ecf20Sopenharmony_ci	/* SUB (register)		0001 101x xxxx xxxx */
7088c2ecf20Sopenharmony_ci	/* LSL (immediate)		0000 0xxx xxxx xxxx */
7098c2ecf20Sopenharmony_ci	/* LSR (immediate)		0000 1xxx xxxx xxxx */
7108c2ecf20Sopenharmony_ci	/* ASR (immediate)		0001 0xxx xxxx xxxx */
7118c2ecf20Sopenharmony_ci	/* ADD (immediate, Thumb)	0001 110x xxxx xxxx */
7128c2ecf20Sopenharmony_ci	/* SUB (immediate, Thumb)	0001 111x xxxx xxxx */
7138c2ecf20Sopenharmony_ci	/* MOV (immediate)		0010 0xxx xxxx xxxx */
7148c2ecf20Sopenharmony_ci	/* ADD (immediate, Thumb)	0011 0xxx xxxx xxxx */
7158c2ecf20Sopenharmony_ci	/* SUB (immediate, Thumb)	0011 1xxx xxxx xxxx */
7168c2ecf20Sopenharmony_ci	DECODE_EMULATE	(0xc000, 0x0000, PROBES_T16_ADDSUB),
7178c2ecf20Sopenharmony_ci
7188c2ecf20Sopenharmony_ci	/*
7198c2ecf20Sopenharmony_ci	 * 16-bit Thumb data-processing instructions
7208c2ecf20Sopenharmony_ci	 *				0100 00xx xxxx xxxx
7218c2ecf20Sopenharmony_ci	 */
7228c2ecf20Sopenharmony_ci
7238c2ecf20Sopenharmony_ci	/* TST (register)		0100 0010 00xx xxxx */
7248c2ecf20Sopenharmony_ci	DECODE_EMULATE	(0xffc0, 0x4200, PROBES_T16_CMP),
7258c2ecf20Sopenharmony_ci	/* CMP (register)		0100 0010 10xx xxxx */
7268c2ecf20Sopenharmony_ci	/* CMN (register)		0100 0010 11xx xxxx */
7278c2ecf20Sopenharmony_ci	DECODE_EMULATE	(0xff80, 0x4280, PROBES_T16_CMP),
7288c2ecf20Sopenharmony_ci	/* AND (register)		0100 0000 00xx xxxx */
7298c2ecf20Sopenharmony_ci	/* EOR (register)		0100 0000 01xx xxxx */
7308c2ecf20Sopenharmony_ci	/* LSL (register)		0100 0000 10xx xxxx */
7318c2ecf20Sopenharmony_ci	/* LSR (register)		0100 0000 11xx xxxx */
7328c2ecf20Sopenharmony_ci	/* ASR (register)		0100 0001 00xx xxxx */
7338c2ecf20Sopenharmony_ci	/* ADC (register)		0100 0001 01xx xxxx */
7348c2ecf20Sopenharmony_ci	/* SBC (register)		0100 0001 10xx xxxx */
7358c2ecf20Sopenharmony_ci	/* ROR (register)		0100 0001 11xx xxxx */
7368c2ecf20Sopenharmony_ci	/* RSB (immediate)		0100 0010 01xx xxxx */
7378c2ecf20Sopenharmony_ci	/* ORR (register)		0100 0011 00xx xxxx */
7388c2ecf20Sopenharmony_ci	/* MUL				0100 0011 00xx xxxx */
7398c2ecf20Sopenharmony_ci	/* BIC (register)		0100 0011 10xx xxxx */
7408c2ecf20Sopenharmony_ci	/* MVN (register)		0100 0011 10xx xxxx */
7418c2ecf20Sopenharmony_ci	DECODE_EMULATE	(0xfc00, 0x4000, PROBES_T16_LOGICAL),
7428c2ecf20Sopenharmony_ci
7438c2ecf20Sopenharmony_ci	/*
7448c2ecf20Sopenharmony_ci	 * Special data instructions and branch and exchange
7458c2ecf20Sopenharmony_ci	 *				0100 01xx xxxx xxxx
7468c2ecf20Sopenharmony_ci	 */
7478c2ecf20Sopenharmony_ci
7488c2ecf20Sopenharmony_ci	/* BLX pc			0100 0111 1111 1xxx */
7498c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xfff8, 0x47f8),
7508c2ecf20Sopenharmony_ci
7518c2ecf20Sopenharmony_ci	/* BX (register)		0100 0111 0xxx xxxx */
7528c2ecf20Sopenharmony_ci	/* BLX (register)		0100 0111 1xxx xxxx */
7538c2ecf20Sopenharmony_ci	DECODE_SIMULATE (0xff00, 0x4700, PROBES_T16_BLX),
7548c2ecf20Sopenharmony_ci
7558c2ecf20Sopenharmony_ci	/* ADD pc, pc			0100 0100 1111 1111 */
7568c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xffff, 0x44ff),
7578c2ecf20Sopenharmony_ci
7588c2ecf20Sopenharmony_ci	/* ADD (register)		0100 0100 xxxx xxxx */
7598c2ecf20Sopenharmony_ci	/* CMP (register)		0100 0101 xxxx xxxx */
7608c2ecf20Sopenharmony_ci	/* MOV (register)		0100 0110 xxxx xxxx */
7618c2ecf20Sopenharmony_ci	DECODE_CUSTOM	(0xfc00, 0x4400, PROBES_T16_HIREGOPS),
7628c2ecf20Sopenharmony_ci
7638c2ecf20Sopenharmony_ci	/*
7648c2ecf20Sopenharmony_ci	 * Load from Literal Pool
7658c2ecf20Sopenharmony_ci	 * LDR (literal)		0100 1xxx xxxx xxxx
7668c2ecf20Sopenharmony_ci	 */
7678c2ecf20Sopenharmony_ci	DECODE_SIMULATE	(0xf800, 0x4800, PROBES_T16_LDR_LIT),
7688c2ecf20Sopenharmony_ci
7698c2ecf20Sopenharmony_ci	/*
7708c2ecf20Sopenharmony_ci	 * 16-bit Thumb Load/store instructions
7718c2ecf20Sopenharmony_ci	 *				0101 xxxx xxxx xxxx
7728c2ecf20Sopenharmony_ci	 *				011x xxxx xxxx xxxx
7738c2ecf20Sopenharmony_ci	 *				100x xxxx xxxx xxxx
7748c2ecf20Sopenharmony_ci	 */
7758c2ecf20Sopenharmony_ci
7768c2ecf20Sopenharmony_ci	/* STR (register)		0101 000x xxxx xxxx */
7778c2ecf20Sopenharmony_ci	/* STRH (register)		0101 001x xxxx xxxx */
7788c2ecf20Sopenharmony_ci	/* STRB (register)		0101 010x xxxx xxxx */
7798c2ecf20Sopenharmony_ci	/* LDRSB (register)		0101 011x xxxx xxxx */
7808c2ecf20Sopenharmony_ci	/* LDR (register)		0101 100x xxxx xxxx */
7818c2ecf20Sopenharmony_ci	/* LDRH (register)		0101 101x xxxx xxxx */
7828c2ecf20Sopenharmony_ci	/* LDRB (register)		0101 110x xxxx xxxx */
7838c2ecf20Sopenharmony_ci	/* LDRSH (register)		0101 111x xxxx xxxx */
7848c2ecf20Sopenharmony_ci	/* STR (immediate, Thumb)	0110 0xxx xxxx xxxx */
7858c2ecf20Sopenharmony_ci	/* LDR (immediate, Thumb)	0110 1xxx xxxx xxxx */
7868c2ecf20Sopenharmony_ci	/* STRB (immediate, Thumb)	0111 0xxx xxxx xxxx */
7878c2ecf20Sopenharmony_ci	/* LDRB (immediate, Thumb)	0111 1xxx xxxx xxxx */
7888c2ecf20Sopenharmony_ci	DECODE_EMULATE	(0xc000, 0x4000, PROBES_T16_LDRHSTRH),
7898c2ecf20Sopenharmony_ci	/* STRH (immediate, Thumb)	1000 0xxx xxxx xxxx */
7908c2ecf20Sopenharmony_ci	/* LDRH (immediate, Thumb)	1000 1xxx xxxx xxxx */
7918c2ecf20Sopenharmony_ci	DECODE_EMULATE	(0xf000, 0x8000, PROBES_T16_LDRHSTRH),
7928c2ecf20Sopenharmony_ci	/* STR (immediate, Thumb)	1001 0xxx xxxx xxxx */
7938c2ecf20Sopenharmony_ci	/* LDR (immediate, Thumb)	1001 1xxx xxxx xxxx */
7948c2ecf20Sopenharmony_ci	DECODE_SIMULATE	(0xf000, 0x9000, PROBES_T16_LDRSTR),
7958c2ecf20Sopenharmony_ci
7968c2ecf20Sopenharmony_ci	/*
7978c2ecf20Sopenharmony_ci	 * Generate PC-/SP-relative address
7988c2ecf20Sopenharmony_ci	 * ADR (literal)		1010 0xxx xxxx xxxx
7998c2ecf20Sopenharmony_ci	 * ADD (SP plus immediate)	1010 1xxx xxxx xxxx
8008c2ecf20Sopenharmony_ci	 */
8018c2ecf20Sopenharmony_ci	DECODE_SIMULATE	(0xf000, 0xa000, PROBES_T16_ADR),
8028c2ecf20Sopenharmony_ci
8038c2ecf20Sopenharmony_ci	/*
8048c2ecf20Sopenharmony_ci	 * Miscellaneous 16-bit instructions
8058c2ecf20Sopenharmony_ci	 *				1011 xxxx xxxx xxxx
8068c2ecf20Sopenharmony_ci	 */
8078c2ecf20Sopenharmony_ci	DECODE_TABLE	(0xf000, 0xb000, t16_table_1011),
8088c2ecf20Sopenharmony_ci
8098c2ecf20Sopenharmony_ci	/* STM				1100 0xxx xxxx xxxx */
8108c2ecf20Sopenharmony_ci	/* LDM				1100 1xxx xxxx xxxx */
8118c2ecf20Sopenharmony_ci	DECODE_EMULATE	(0xf000, 0xc000, PROBES_T16_LDMSTM),
8128c2ecf20Sopenharmony_ci
8138c2ecf20Sopenharmony_ci	/*
8148c2ecf20Sopenharmony_ci	 * Conditional branch, and Supervisor Call
8158c2ecf20Sopenharmony_ci	 */
8168c2ecf20Sopenharmony_ci
8178c2ecf20Sopenharmony_ci	/* Permanently UNDEFINED	1101 1110 xxxx xxxx */
8188c2ecf20Sopenharmony_ci	/* SVC				1101 1111 xxxx xxxx */
8198c2ecf20Sopenharmony_ci	DECODE_REJECT	(0xfe00, 0xde00),
8208c2ecf20Sopenharmony_ci
8218c2ecf20Sopenharmony_ci	/* Conditional branch		1101 xxxx xxxx xxxx */
8228c2ecf20Sopenharmony_ci	DECODE_CUSTOM	(0xf000, 0xd000, PROBES_T16_BRANCH_COND),
8238c2ecf20Sopenharmony_ci
8248c2ecf20Sopenharmony_ci	/*
8258c2ecf20Sopenharmony_ci	 * Unconditional branch
8268c2ecf20Sopenharmony_ci	 * B				1110 0xxx xxxx xxxx
8278c2ecf20Sopenharmony_ci	 */
8288c2ecf20Sopenharmony_ci	DECODE_SIMULATE	(0xf800, 0xe000, PROBES_T16_BRANCH),
8298c2ecf20Sopenharmony_ci
8308c2ecf20Sopenharmony_ci	DECODE_END
8318c2ecf20Sopenharmony_ci};
8328c2ecf20Sopenharmony_ci#ifdef CONFIG_ARM_KPROBES_TEST_MODULE
8338c2ecf20Sopenharmony_ciEXPORT_SYMBOL_GPL(probes_decode_thumb16_table);
8348c2ecf20Sopenharmony_ci#endif
8358c2ecf20Sopenharmony_ci
8368c2ecf20Sopenharmony_cistatic unsigned long __kprobes thumb_check_cc(unsigned long cpsr)
8378c2ecf20Sopenharmony_ci{
8388c2ecf20Sopenharmony_ci	if (unlikely(in_it_block(cpsr)))
8398c2ecf20Sopenharmony_ci		return probes_condition_checks[current_cond(cpsr)](cpsr);
8408c2ecf20Sopenharmony_ci	return true;
8418c2ecf20Sopenharmony_ci}
8428c2ecf20Sopenharmony_ci
8438c2ecf20Sopenharmony_cistatic void __kprobes thumb16_singlestep(probes_opcode_t opcode,
8448c2ecf20Sopenharmony_ci		struct arch_probes_insn *asi,
8458c2ecf20Sopenharmony_ci		struct pt_regs *regs)
8468c2ecf20Sopenharmony_ci{
8478c2ecf20Sopenharmony_ci	regs->ARM_pc += 2;
8488c2ecf20Sopenharmony_ci	asi->insn_handler(opcode, asi, regs);
8498c2ecf20Sopenharmony_ci	regs->ARM_cpsr = it_advance(regs->ARM_cpsr);
8508c2ecf20Sopenharmony_ci}
8518c2ecf20Sopenharmony_ci
8528c2ecf20Sopenharmony_cistatic void __kprobes thumb32_singlestep(probes_opcode_t opcode,
8538c2ecf20Sopenharmony_ci		struct arch_probes_insn *asi,
8548c2ecf20Sopenharmony_ci		struct pt_regs *regs)
8558c2ecf20Sopenharmony_ci{
8568c2ecf20Sopenharmony_ci	regs->ARM_pc += 4;
8578c2ecf20Sopenharmony_ci	asi->insn_handler(opcode, asi, regs);
8588c2ecf20Sopenharmony_ci	regs->ARM_cpsr = it_advance(regs->ARM_cpsr);
8598c2ecf20Sopenharmony_ci}
8608c2ecf20Sopenharmony_ci
8618c2ecf20Sopenharmony_cienum probes_insn __kprobes
8628c2ecf20Sopenharmony_cithumb16_probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi,
8638c2ecf20Sopenharmony_ci			   bool emulate, const union decode_action *actions,
8648c2ecf20Sopenharmony_ci			   const struct decode_checker *checkers[])
8658c2ecf20Sopenharmony_ci{
8668c2ecf20Sopenharmony_ci	asi->insn_singlestep = thumb16_singlestep;
8678c2ecf20Sopenharmony_ci	asi->insn_check_cc = thumb_check_cc;
8688c2ecf20Sopenharmony_ci	return probes_decode_insn(insn, asi, probes_decode_thumb16_table, true,
8698c2ecf20Sopenharmony_ci				  emulate, actions, checkers);
8708c2ecf20Sopenharmony_ci}
8718c2ecf20Sopenharmony_ci
8728c2ecf20Sopenharmony_cienum probes_insn __kprobes
8738c2ecf20Sopenharmony_cithumb32_probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi,
8748c2ecf20Sopenharmony_ci			   bool emulate, const union decode_action *actions,
8758c2ecf20Sopenharmony_ci			   const struct decode_checker *checkers[])
8768c2ecf20Sopenharmony_ci{
8778c2ecf20Sopenharmony_ci	asi->insn_singlestep = thumb32_singlestep;
8788c2ecf20Sopenharmony_ci	asi->insn_check_cc = thumb_check_cc;
8798c2ecf20Sopenharmony_ci	return probes_decode_insn(insn, asi, probes_decode_thumb32_table, true,
8808c2ecf20Sopenharmony_ci				  emulate, actions, checkers);
8818c2ecf20Sopenharmony_ci}
882