162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * arch/arm/probes/decode-thumb.c 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2011 Jon Medhurst <tixy@yxit.co.uk>. 662306a36Sopenharmony_ci */ 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#include <linux/stddef.h> 962306a36Sopenharmony_ci#include <linux/kernel.h> 1062306a36Sopenharmony_ci#include <linux/module.h> 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#include "decode.h" 1362306a36Sopenharmony_ci#include "decode-thumb.h" 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_cistatic const union decode_item t32_table_1110_100x_x0xx[] = { 1762306a36Sopenharmony_ci /* Load/store multiple instructions */ 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci /* Rn is PC 1110 100x x0xx 1111 xxxx xxxx xxxx xxxx */ 2062306a36Sopenharmony_ci DECODE_REJECT (0xfe4f0000, 0xe80f0000), 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci /* SRS 1110 1000 00x0 xxxx xxxx xxxx xxxx xxxx */ 2362306a36Sopenharmony_ci /* RFE 1110 1000 00x1 xxxx xxxx xxxx xxxx xxxx */ 2462306a36Sopenharmony_ci DECODE_REJECT (0xffc00000, 0xe8000000), 2562306a36Sopenharmony_ci /* SRS 1110 1001 10x0 xxxx xxxx xxxx xxxx xxxx */ 2662306a36Sopenharmony_ci /* RFE 1110 1001 10x1 xxxx xxxx xxxx xxxx xxxx */ 2762306a36Sopenharmony_ci DECODE_REJECT (0xffc00000, 0xe9800000), 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci /* STM Rn, {...pc} 1110 100x x0x0 xxxx 1xxx xxxx xxxx xxxx */ 3062306a36Sopenharmony_ci DECODE_REJECT (0xfe508000, 0xe8008000), 3162306a36Sopenharmony_ci /* LDM Rn, {...lr,pc} 1110 100x x0x1 xxxx 11xx xxxx xxxx xxxx */ 3262306a36Sopenharmony_ci DECODE_REJECT (0xfe50c000, 0xe810c000), 3362306a36Sopenharmony_ci /* LDM/STM Rn, {...sp} 1110 100x x0xx xxxx xx1x xxxx xxxx xxxx */ 3462306a36Sopenharmony_ci DECODE_REJECT (0xfe402000, 0xe8002000), 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci /* STMIA 1110 1000 10x0 xxxx xxxx xxxx xxxx xxxx */ 3762306a36Sopenharmony_ci /* LDMIA 1110 1000 10x1 xxxx xxxx xxxx xxxx xxxx */ 3862306a36Sopenharmony_ci /* STMDB 1110 1001 00x0 xxxx xxxx xxxx xxxx xxxx */ 3962306a36Sopenharmony_ci /* LDMDB 1110 1001 00x1 xxxx xxxx xxxx xxxx xxxx */ 4062306a36Sopenharmony_ci DECODE_CUSTOM (0xfe400000, 0xe8000000, PROBES_T32_LDMSTM), 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci DECODE_END 4362306a36Sopenharmony_ci}; 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_cistatic const union decode_item t32_table_1110_100x_x1xx[] = { 4662306a36Sopenharmony_ci /* Load/store dual, load/store exclusive, table branch */ 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci /* STRD (immediate) 1110 1000 x110 xxxx xxxx xxxx xxxx xxxx */ 4962306a36Sopenharmony_ci /* LDRD (immediate) 1110 1000 x111 xxxx xxxx xxxx xxxx xxxx */ 5062306a36Sopenharmony_ci DECODE_OR (0xff600000, 0xe8600000), 5162306a36Sopenharmony_ci /* STRD (immediate) 1110 1001 x1x0 xxxx xxxx xxxx xxxx xxxx */ 5262306a36Sopenharmony_ci /* LDRD (immediate) 1110 1001 x1x1 xxxx xxxx xxxx xxxx xxxx */ 5362306a36Sopenharmony_ci DECODE_EMULATEX (0xff400000, 0xe9400000, PROBES_T32_LDRDSTRD, 5462306a36Sopenharmony_ci REGS(NOPCWB, NOSPPC, NOSPPC, 0, 0)), 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci /* TBB 1110 1000 1101 xxxx xxxx xxxx 0000 xxxx */ 5762306a36Sopenharmony_ci /* TBH 1110 1000 1101 xxxx xxxx xxxx 0001 xxxx */ 5862306a36Sopenharmony_ci DECODE_SIMULATEX(0xfff000e0, 0xe8d00000, PROBES_T32_TABLE_BRANCH, 5962306a36Sopenharmony_ci REGS(NOSP, 0, 0, 0, NOSPPC)), 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci /* STREX 1110 1000 0100 xxxx xxxx xxxx xxxx xxxx */ 6262306a36Sopenharmony_ci /* LDREX 1110 1000 0101 xxxx xxxx xxxx xxxx xxxx */ 6362306a36Sopenharmony_ci /* STREXB 1110 1000 1100 xxxx xxxx xxxx 0100 xxxx */ 6462306a36Sopenharmony_ci /* STREXH 1110 1000 1100 xxxx xxxx xxxx 0101 xxxx */ 6562306a36Sopenharmony_ci /* STREXD 1110 1000 1100 xxxx xxxx xxxx 0111 xxxx */ 6662306a36Sopenharmony_ci /* LDREXB 1110 1000 1101 xxxx xxxx xxxx 0100 xxxx */ 6762306a36Sopenharmony_ci /* LDREXH 1110 1000 1101 xxxx xxxx xxxx 0101 xxxx */ 6862306a36Sopenharmony_ci /* LDREXD 1110 1000 1101 xxxx xxxx xxxx 0111 xxxx */ 6962306a36Sopenharmony_ci /* And unallocated instructions... */ 7062306a36Sopenharmony_ci DECODE_END 7162306a36Sopenharmony_ci}; 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_cistatic const union decode_item t32_table_1110_101x[] = { 7462306a36Sopenharmony_ci /* Data-processing (shifted register) */ 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci /* TST 1110 1010 0001 xxxx xxxx 1111 xxxx xxxx */ 7762306a36Sopenharmony_ci /* TEQ 1110 1010 1001 xxxx xxxx 1111 xxxx xxxx */ 7862306a36Sopenharmony_ci DECODE_EMULATEX (0xff700f00, 0xea100f00, PROBES_T32_TST, 7962306a36Sopenharmony_ci REGS(NOSPPC, 0, 0, 0, NOSPPC)), 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ci /* CMN 1110 1011 0001 xxxx xxxx 1111 xxxx xxxx */ 8262306a36Sopenharmony_ci DECODE_OR (0xfff00f00, 0xeb100f00), 8362306a36Sopenharmony_ci /* CMP 1110 1011 1011 xxxx xxxx 1111 xxxx xxxx */ 8462306a36Sopenharmony_ci DECODE_EMULATEX (0xfff00f00, 0xebb00f00, PROBES_T32_TST, 8562306a36Sopenharmony_ci REGS(NOPC, 0, 0, 0, NOSPPC)), 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_ci /* MOV 1110 1010 010x 1111 xxxx xxxx xxxx xxxx */ 8862306a36Sopenharmony_ci /* MVN 1110 1010 011x 1111 xxxx xxxx xxxx xxxx */ 8962306a36Sopenharmony_ci DECODE_EMULATEX (0xffcf0000, 0xea4f0000, PROBES_T32_MOV, 9062306a36Sopenharmony_ci REGS(0, 0, NOSPPC, 0, NOSPPC)), 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci /* ??? 1110 1010 101x xxxx xxxx xxxx xxxx xxxx */ 9362306a36Sopenharmony_ci /* ??? 1110 1010 111x xxxx xxxx xxxx xxxx xxxx */ 9462306a36Sopenharmony_ci DECODE_REJECT (0xffa00000, 0xeaa00000), 9562306a36Sopenharmony_ci /* ??? 1110 1011 001x xxxx xxxx xxxx xxxx xxxx */ 9662306a36Sopenharmony_ci DECODE_REJECT (0xffe00000, 0xeb200000), 9762306a36Sopenharmony_ci /* ??? 1110 1011 100x xxxx xxxx xxxx xxxx xxxx */ 9862306a36Sopenharmony_ci DECODE_REJECT (0xffe00000, 0xeb800000), 9962306a36Sopenharmony_ci /* ??? 1110 1011 111x xxxx xxxx xxxx xxxx xxxx */ 10062306a36Sopenharmony_ci DECODE_REJECT (0xffe00000, 0xebe00000), 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_ci /* ADD/SUB SP, SP, Rm, LSL #0..3 */ 10362306a36Sopenharmony_ci /* 1110 1011 x0xx 1101 x000 1101 xx00 xxxx */ 10462306a36Sopenharmony_ci DECODE_EMULATEX (0xff4f7f30, 0xeb0d0d00, PROBES_T32_ADDSUB, 10562306a36Sopenharmony_ci REGS(SP, 0, SP, 0, NOSPPC)), 10662306a36Sopenharmony_ci 10762306a36Sopenharmony_ci /* ADD/SUB SP, SP, Rm, shift */ 10862306a36Sopenharmony_ci /* 1110 1011 x0xx 1101 xxxx 1101 xxxx xxxx */ 10962306a36Sopenharmony_ci DECODE_REJECT (0xff4f0f00, 0xeb0d0d00), 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_ci /* ADD/SUB Rd, SP, Rm, shift */ 11262306a36Sopenharmony_ci /* 1110 1011 x0xx 1101 xxxx xxxx xxxx xxxx */ 11362306a36Sopenharmony_ci DECODE_EMULATEX (0xff4f0000, 0xeb0d0000, PROBES_T32_ADDSUB, 11462306a36Sopenharmony_ci REGS(SP, 0, NOPC, 0, NOSPPC)), 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_ci /* AND 1110 1010 000x xxxx xxxx xxxx xxxx xxxx */ 11762306a36Sopenharmony_ci /* BIC 1110 1010 001x xxxx xxxx xxxx xxxx xxxx */ 11862306a36Sopenharmony_ci /* ORR 1110 1010 010x xxxx xxxx xxxx xxxx xxxx */ 11962306a36Sopenharmony_ci /* ORN 1110 1010 011x xxxx xxxx xxxx xxxx xxxx */ 12062306a36Sopenharmony_ci /* EOR 1110 1010 100x xxxx xxxx xxxx xxxx xxxx */ 12162306a36Sopenharmony_ci /* PKH 1110 1010 110x xxxx xxxx xxxx xxxx xxxx */ 12262306a36Sopenharmony_ci /* ADD 1110 1011 000x xxxx xxxx xxxx xxxx xxxx */ 12362306a36Sopenharmony_ci /* ADC 1110 1011 010x xxxx xxxx xxxx xxxx xxxx */ 12462306a36Sopenharmony_ci /* SBC 1110 1011 011x xxxx xxxx xxxx xxxx xxxx */ 12562306a36Sopenharmony_ci /* SUB 1110 1011 101x xxxx xxxx xxxx xxxx xxxx */ 12662306a36Sopenharmony_ci /* RSB 1110 1011 110x xxxx xxxx xxxx xxxx xxxx */ 12762306a36Sopenharmony_ci DECODE_EMULATEX (0xfe000000, 0xea000000, PROBES_T32_LOGICAL, 12862306a36Sopenharmony_ci REGS(NOSPPC, 0, NOSPPC, 0, NOSPPC)), 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ci DECODE_END 13162306a36Sopenharmony_ci}; 13262306a36Sopenharmony_ci 13362306a36Sopenharmony_cistatic const union decode_item t32_table_1111_0x0x___0[] = { 13462306a36Sopenharmony_ci /* Data-processing (modified immediate) */ 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_ci /* TST 1111 0x00 0001 xxxx 0xxx 1111 xxxx xxxx */ 13762306a36Sopenharmony_ci /* TEQ 1111 0x00 1001 xxxx 0xxx 1111 xxxx xxxx */ 13862306a36Sopenharmony_ci DECODE_EMULATEX (0xfb708f00, 0xf0100f00, PROBES_T32_TST, 13962306a36Sopenharmony_ci REGS(NOSPPC, 0, 0, 0, 0)), 14062306a36Sopenharmony_ci 14162306a36Sopenharmony_ci /* CMN 1111 0x01 0001 xxxx 0xxx 1111 xxxx xxxx */ 14262306a36Sopenharmony_ci DECODE_OR (0xfbf08f00, 0xf1100f00), 14362306a36Sopenharmony_ci /* CMP 1111 0x01 1011 xxxx 0xxx 1111 xxxx xxxx */ 14462306a36Sopenharmony_ci DECODE_EMULATEX (0xfbf08f00, 0xf1b00f00, PROBES_T32_CMP, 14562306a36Sopenharmony_ci REGS(NOPC, 0, 0, 0, 0)), 14662306a36Sopenharmony_ci 14762306a36Sopenharmony_ci /* MOV 1111 0x00 010x 1111 0xxx xxxx xxxx xxxx */ 14862306a36Sopenharmony_ci /* MVN 1111 0x00 011x 1111 0xxx xxxx xxxx xxxx */ 14962306a36Sopenharmony_ci DECODE_EMULATEX (0xfbcf8000, 0xf04f0000, PROBES_T32_MOV, 15062306a36Sopenharmony_ci REGS(0, 0, NOSPPC, 0, 0)), 15162306a36Sopenharmony_ci 15262306a36Sopenharmony_ci /* ??? 1111 0x00 101x xxxx 0xxx xxxx xxxx xxxx */ 15362306a36Sopenharmony_ci DECODE_REJECT (0xfbe08000, 0xf0a00000), 15462306a36Sopenharmony_ci /* ??? 1111 0x00 110x xxxx 0xxx xxxx xxxx xxxx */ 15562306a36Sopenharmony_ci /* ??? 1111 0x00 111x xxxx 0xxx xxxx xxxx xxxx */ 15662306a36Sopenharmony_ci DECODE_REJECT (0xfbc08000, 0xf0c00000), 15762306a36Sopenharmony_ci /* ??? 1111 0x01 001x xxxx 0xxx xxxx xxxx xxxx */ 15862306a36Sopenharmony_ci DECODE_REJECT (0xfbe08000, 0xf1200000), 15962306a36Sopenharmony_ci /* ??? 1111 0x01 100x xxxx 0xxx xxxx xxxx xxxx */ 16062306a36Sopenharmony_ci DECODE_REJECT (0xfbe08000, 0xf1800000), 16162306a36Sopenharmony_ci /* ??? 1111 0x01 111x xxxx 0xxx xxxx xxxx xxxx */ 16262306a36Sopenharmony_ci DECODE_REJECT (0xfbe08000, 0xf1e00000), 16362306a36Sopenharmony_ci 16462306a36Sopenharmony_ci /* ADD Rd, SP, #imm 1111 0x01 000x 1101 0xxx xxxx xxxx xxxx */ 16562306a36Sopenharmony_ci /* SUB Rd, SP, #imm 1111 0x01 101x 1101 0xxx xxxx xxxx xxxx */ 16662306a36Sopenharmony_ci DECODE_EMULATEX (0xfb4f8000, 0xf10d0000, PROBES_T32_ADDSUB, 16762306a36Sopenharmony_ci REGS(SP, 0, NOPC, 0, 0)), 16862306a36Sopenharmony_ci 16962306a36Sopenharmony_ci /* AND 1111 0x00 000x xxxx 0xxx xxxx xxxx xxxx */ 17062306a36Sopenharmony_ci /* BIC 1111 0x00 001x xxxx 0xxx xxxx xxxx xxxx */ 17162306a36Sopenharmony_ci /* ORR 1111 0x00 010x xxxx 0xxx xxxx xxxx xxxx */ 17262306a36Sopenharmony_ci /* ORN 1111 0x00 011x xxxx 0xxx xxxx xxxx xxxx */ 17362306a36Sopenharmony_ci /* EOR 1111 0x00 100x xxxx 0xxx xxxx xxxx xxxx */ 17462306a36Sopenharmony_ci /* ADD 1111 0x01 000x xxxx 0xxx xxxx xxxx xxxx */ 17562306a36Sopenharmony_ci /* ADC 1111 0x01 010x xxxx 0xxx xxxx xxxx xxxx */ 17662306a36Sopenharmony_ci /* SBC 1111 0x01 011x xxxx 0xxx xxxx xxxx xxxx */ 17762306a36Sopenharmony_ci /* SUB 1111 0x01 101x xxxx 0xxx xxxx xxxx xxxx */ 17862306a36Sopenharmony_ci /* RSB 1111 0x01 110x xxxx 0xxx xxxx xxxx xxxx */ 17962306a36Sopenharmony_ci DECODE_EMULATEX (0xfa008000, 0xf0000000, PROBES_T32_LOGICAL, 18062306a36Sopenharmony_ci REGS(NOSPPC, 0, NOSPPC, 0, 0)), 18162306a36Sopenharmony_ci 18262306a36Sopenharmony_ci DECODE_END 18362306a36Sopenharmony_ci}; 18462306a36Sopenharmony_ci 18562306a36Sopenharmony_cistatic const union decode_item t32_table_1111_0x1x___0[] = { 18662306a36Sopenharmony_ci /* Data-processing (plain binary immediate) */ 18762306a36Sopenharmony_ci 18862306a36Sopenharmony_ci /* ADDW Rd, PC, #imm 1111 0x10 0000 1111 0xxx xxxx xxxx xxxx */ 18962306a36Sopenharmony_ci DECODE_OR (0xfbff8000, 0xf20f0000), 19062306a36Sopenharmony_ci /* SUBW Rd, PC, #imm 1111 0x10 1010 1111 0xxx xxxx xxxx xxxx */ 19162306a36Sopenharmony_ci DECODE_EMULATEX (0xfbff8000, 0xf2af0000, PROBES_T32_ADDWSUBW_PC, 19262306a36Sopenharmony_ci REGS(PC, 0, NOSPPC, 0, 0)), 19362306a36Sopenharmony_ci 19462306a36Sopenharmony_ci /* ADDW SP, SP, #imm 1111 0x10 0000 1101 0xxx 1101 xxxx xxxx */ 19562306a36Sopenharmony_ci DECODE_OR (0xfbff8f00, 0xf20d0d00), 19662306a36Sopenharmony_ci /* SUBW SP, SP, #imm 1111 0x10 1010 1101 0xxx 1101 xxxx xxxx */ 19762306a36Sopenharmony_ci DECODE_EMULATEX (0xfbff8f00, 0xf2ad0d00, PROBES_T32_ADDWSUBW, 19862306a36Sopenharmony_ci REGS(SP, 0, SP, 0, 0)), 19962306a36Sopenharmony_ci 20062306a36Sopenharmony_ci /* ADDW 1111 0x10 0000 xxxx 0xxx xxxx xxxx xxxx */ 20162306a36Sopenharmony_ci DECODE_OR (0xfbf08000, 0xf2000000), 20262306a36Sopenharmony_ci /* SUBW 1111 0x10 1010 xxxx 0xxx xxxx xxxx xxxx */ 20362306a36Sopenharmony_ci DECODE_EMULATEX (0xfbf08000, 0xf2a00000, PROBES_T32_ADDWSUBW, 20462306a36Sopenharmony_ci REGS(NOPCX, 0, NOSPPC, 0, 0)), 20562306a36Sopenharmony_ci 20662306a36Sopenharmony_ci /* MOVW 1111 0x10 0100 xxxx 0xxx xxxx xxxx xxxx */ 20762306a36Sopenharmony_ci /* MOVT 1111 0x10 1100 xxxx 0xxx xxxx xxxx xxxx */ 20862306a36Sopenharmony_ci DECODE_EMULATEX (0xfb708000, 0xf2400000, PROBES_T32_MOVW, 20962306a36Sopenharmony_ci REGS(0, 0, NOSPPC, 0, 0)), 21062306a36Sopenharmony_ci 21162306a36Sopenharmony_ci /* SSAT16 1111 0x11 0010 xxxx 0000 xxxx 00xx xxxx */ 21262306a36Sopenharmony_ci /* SSAT 1111 0x11 00x0 xxxx 0xxx xxxx xxxx xxxx */ 21362306a36Sopenharmony_ci /* USAT16 1111 0x11 1010 xxxx 0000 xxxx 00xx xxxx */ 21462306a36Sopenharmony_ci /* USAT 1111 0x11 10x0 xxxx 0xxx xxxx xxxx xxxx */ 21562306a36Sopenharmony_ci DECODE_EMULATEX (0xfb508000, 0xf3000000, PROBES_T32_SAT, 21662306a36Sopenharmony_ci REGS(NOSPPC, 0, NOSPPC, 0, 0)), 21762306a36Sopenharmony_ci 21862306a36Sopenharmony_ci /* SFBX 1111 0x11 0100 xxxx 0xxx xxxx xxxx xxxx */ 21962306a36Sopenharmony_ci /* UFBX 1111 0x11 1100 xxxx 0xxx xxxx xxxx xxxx */ 22062306a36Sopenharmony_ci DECODE_EMULATEX (0xfb708000, 0xf3400000, PROBES_T32_BITFIELD, 22162306a36Sopenharmony_ci REGS(NOSPPC, 0, NOSPPC, 0, 0)), 22262306a36Sopenharmony_ci 22362306a36Sopenharmony_ci /* BFC 1111 0x11 0110 1111 0xxx xxxx xxxx xxxx */ 22462306a36Sopenharmony_ci DECODE_EMULATEX (0xfbff8000, 0xf36f0000, PROBES_T32_BITFIELD, 22562306a36Sopenharmony_ci REGS(0, 0, NOSPPC, 0, 0)), 22662306a36Sopenharmony_ci 22762306a36Sopenharmony_ci /* BFI 1111 0x11 0110 xxxx 0xxx xxxx xxxx xxxx */ 22862306a36Sopenharmony_ci DECODE_EMULATEX (0xfbf08000, 0xf3600000, PROBES_T32_BITFIELD, 22962306a36Sopenharmony_ci REGS(NOSPPCX, 0, NOSPPC, 0, 0)), 23062306a36Sopenharmony_ci 23162306a36Sopenharmony_ci DECODE_END 23262306a36Sopenharmony_ci}; 23362306a36Sopenharmony_ci 23462306a36Sopenharmony_cistatic const union decode_item t32_table_1111_0xxx___1[] = { 23562306a36Sopenharmony_ci /* Branches and miscellaneous control */ 23662306a36Sopenharmony_ci 23762306a36Sopenharmony_ci /* YIELD 1111 0011 1010 xxxx 10x0 x000 0000 0001 */ 23862306a36Sopenharmony_ci DECODE_OR (0xfff0d7ff, 0xf3a08001), 23962306a36Sopenharmony_ci /* SEV 1111 0011 1010 xxxx 10x0 x000 0000 0100 */ 24062306a36Sopenharmony_ci DECODE_EMULATE (0xfff0d7ff, 0xf3a08004, PROBES_T32_SEV), 24162306a36Sopenharmony_ci /* NOP 1111 0011 1010 xxxx 10x0 x000 0000 0000 */ 24262306a36Sopenharmony_ci /* WFE 1111 0011 1010 xxxx 10x0 x000 0000 0010 */ 24362306a36Sopenharmony_ci /* WFI 1111 0011 1010 xxxx 10x0 x000 0000 0011 */ 24462306a36Sopenharmony_ci DECODE_SIMULATE (0xfff0d7fc, 0xf3a08000, PROBES_T32_WFE), 24562306a36Sopenharmony_ci 24662306a36Sopenharmony_ci /* MRS Rd, CPSR 1111 0011 1110 xxxx 10x0 xxxx xxxx xxxx */ 24762306a36Sopenharmony_ci DECODE_SIMULATEX(0xfff0d000, 0xf3e08000, PROBES_T32_MRS, 24862306a36Sopenharmony_ci REGS(0, 0, NOSPPC, 0, 0)), 24962306a36Sopenharmony_ci 25062306a36Sopenharmony_ci /* 25162306a36Sopenharmony_ci * Unsupported instructions 25262306a36Sopenharmony_ci * 1111 0x11 1xxx xxxx 10x0 xxxx xxxx xxxx 25362306a36Sopenharmony_ci * 25462306a36Sopenharmony_ci * MSR 1111 0011 100x xxxx 10x0 xxxx xxxx xxxx 25562306a36Sopenharmony_ci * DBG hint 1111 0011 1010 xxxx 10x0 x000 1111 xxxx 25662306a36Sopenharmony_ci * Unallocated hints 1111 0011 1010 xxxx 10x0 x000 xxxx xxxx 25762306a36Sopenharmony_ci * CPS 1111 0011 1010 xxxx 10x0 xxxx xxxx xxxx 25862306a36Sopenharmony_ci * CLREX/DSB/DMB/ISB 1111 0011 1011 xxxx 10x0 xxxx xxxx xxxx 25962306a36Sopenharmony_ci * BXJ 1111 0011 1100 xxxx 10x0 xxxx xxxx xxxx 26062306a36Sopenharmony_ci * SUBS PC,LR,#<imm8> 1111 0011 1101 xxxx 10x0 xxxx xxxx xxxx 26162306a36Sopenharmony_ci * MRS Rd, SPSR 1111 0011 1111 xxxx 10x0 xxxx xxxx xxxx 26262306a36Sopenharmony_ci * SMC 1111 0111 1111 xxxx 1000 xxxx xxxx xxxx 26362306a36Sopenharmony_ci * UNDEFINED 1111 0111 1111 xxxx 1010 xxxx xxxx xxxx 26462306a36Sopenharmony_ci * ??? 1111 0111 1xxx xxxx 1010 xxxx xxxx xxxx 26562306a36Sopenharmony_ci */ 26662306a36Sopenharmony_ci DECODE_REJECT (0xfb80d000, 0xf3808000), 26762306a36Sopenharmony_ci 26862306a36Sopenharmony_ci /* Bcc 1111 0xxx xxxx xxxx 10x0 xxxx xxxx xxxx */ 26962306a36Sopenharmony_ci DECODE_CUSTOM (0xf800d000, 0xf0008000, PROBES_T32_BRANCH_COND), 27062306a36Sopenharmony_ci 27162306a36Sopenharmony_ci /* BLX 1111 0xxx xxxx xxxx 11x0 xxxx xxxx xxx0 */ 27262306a36Sopenharmony_ci DECODE_OR (0xf800d001, 0xf000c000), 27362306a36Sopenharmony_ci /* B 1111 0xxx xxxx xxxx 10x1 xxxx xxxx xxxx */ 27462306a36Sopenharmony_ci /* BL 1111 0xxx xxxx xxxx 11x1 xxxx xxxx xxxx */ 27562306a36Sopenharmony_ci DECODE_SIMULATE (0xf8009000, 0xf0009000, PROBES_T32_BRANCH), 27662306a36Sopenharmony_ci 27762306a36Sopenharmony_ci DECODE_END 27862306a36Sopenharmony_ci}; 27962306a36Sopenharmony_ci 28062306a36Sopenharmony_cistatic const union decode_item t32_table_1111_100x_x0x1__1111[] = { 28162306a36Sopenharmony_ci /* Memory hints */ 28262306a36Sopenharmony_ci 28362306a36Sopenharmony_ci /* PLD (literal) 1111 1000 x001 1111 1111 xxxx xxxx xxxx */ 28462306a36Sopenharmony_ci /* PLI (literal) 1111 1001 x001 1111 1111 xxxx xxxx xxxx */ 28562306a36Sopenharmony_ci DECODE_SIMULATE (0xfe7ff000, 0xf81ff000, PROBES_T32_PLDI), 28662306a36Sopenharmony_ci 28762306a36Sopenharmony_ci /* PLD{W} (immediate) 1111 1000 10x1 xxxx 1111 xxxx xxxx xxxx */ 28862306a36Sopenharmony_ci DECODE_OR (0xffd0f000, 0xf890f000), 28962306a36Sopenharmony_ci /* PLD{W} (immediate) 1111 1000 00x1 xxxx 1111 1100 xxxx xxxx */ 29062306a36Sopenharmony_ci DECODE_OR (0xffd0ff00, 0xf810fc00), 29162306a36Sopenharmony_ci /* PLI (immediate) 1111 1001 1001 xxxx 1111 xxxx xxxx xxxx */ 29262306a36Sopenharmony_ci DECODE_OR (0xfff0f000, 0xf990f000), 29362306a36Sopenharmony_ci /* PLI (immediate) 1111 1001 0001 xxxx 1111 1100 xxxx xxxx */ 29462306a36Sopenharmony_ci DECODE_SIMULATEX(0xfff0ff00, 0xf910fc00, PROBES_T32_PLDI, 29562306a36Sopenharmony_ci REGS(NOPCX, 0, 0, 0, 0)), 29662306a36Sopenharmony_ci 29762306a36Sopenharmony_ci /* PLD{W} (register) 1111 1000 00x1 xxxx 1111 0000 00xx xxxx */ 29862306a36Sopenharmony_ci DECODE_OR (0xffd0ffc0, 0xf810f000), 29962306a36Sopenharmony_ci /* PLI (register) 1111 1001 0001 xxxx 1111 0000 00xx xxxx */ 30062306a36Sopenharmony_ci DECODE_SIMULATEX(0xfff0ffc0, 0xf910f000, PROBES_T32_PLDI, 30162306a36Sopenharmony_ci REGS(NOPCX, 0, 0, 0, NOSPPC)), 30262306a36Sopenharmony_ci 30362306a36Sopenharmony_ci /* Other unallocated instructions... */ 30462306a36Sopenharmony_ci DECODE_END 30562306a36Sopenharmony_ci}; 30662306a36Sopenharmony_ci 30762306a36Sopenharmony_cistatic const union decode_item t32_table_1111_100x[] = { 30862306a36Sopenharmony_ci /* Store/Load single data item */ 30962306a36Sopenharmony_ci 31062306a36Sopenharmony_ci /* ??? 1111 100x x11x xxxx xxxx xxxx xxxx xxxx */ 31162306a36Sopenharmony_ci DECODE_REJECT (0xfe600000, 0xf8600000), 31262306a36Sopenharmony_ci 31362306a36Sopenharmony_ci /* ??? 1111 1001 0101 xxxx xxxx xxxx xxxx xxxx */ 31462306a36Sopenharmony_ci DECODE_REJECT (0xfff00000, 0xf9500000), 31562306a36Sopenharmony_ci 31662306a36Sopenharmony_ci /* ??? 1111 100x 0xxx xxxx xxxx 10x0 xxxx xxxx */ 31762306a36Sopenharmony_ci DECODE_REJECT (0xfe800d00, 0xf8000800), 31862306a36Sopenharmony_ci 31962306a36Sopenharmony_ci /* STRBT 1111 1000 0000 xxxx xxxx 1110 xxxx xxxx */ 32062306a36Sopenharmony_ci /* STRHT 1111 1000 0010 xxxx xxxx 1110 xxxx xxxx */ 32162306a36Sopenharmony_ci /* STRT 1111 1000 0100 xxxx xxxx 1110 xxxx xxxx */ 32262306a36Sopenharmony_ci /* LDRBT 1111 1000 0001 xxxx xxxx 1110 xxxx xxxx */ 32362306a36Sopenharmony_ci /* LDRSBT 1111 1001 0001 xxxx xxxx 1110 xxxx xxxx */ 32462306a36Sopenharmony_ci /* LDRHT 1111 1000 0011 xxxx xxxx 1110 xxxx xxxx */ 32562306a36Sopenharmony_ci /* LDRSHT 1111 1001 0011 xxxx xxxx 1110 xxxx xxxx */ 32662306a36Sopenharmony_ci /* LDRT 1111 1000 0101 xxxx xxxx 1110 xxxx xxxx */ 32762306a36Sopenharmony_ci DECODE_REJECT (0xfe800f00, 0xf8000e00), 32862306a36Sopenharmony_ci 32962306a36Sopenharmony_ci /* STR{,B,H} Rn,[PC...] 1111 1000 xxx0 1111 xxxx xxxx xxxx xxxx */ 33062306a36Sopenharmony_ci DECODE_REJECT (0xff1f0000, 0xf80f0000), 33162306a36Sopenharmony_ci 33262306a36Sopenharmony_ci /* STR{,B,H} PC,[Rn...] 1111 1000 xxx0 xxxx 1111 xxxx xxxx xxxx */ 33362306a36Sopenharmony_ci DECODE_REJECT (0xff10f000, 0xf800f000), 33462306a36Sopenharmony_ci 33562306a36Sopenharmony_ci /* LDR (literal) 1111 1000 x101 1111 xxxx xxxx xxxx xxxx */ 33662306a36Sopenharmony_ci DECODE_SIMULATEX(0xff7f0000, 0xf85f0000, PROBES_T32_LDR_LIT, 33762306a36Sopenharmony_ci REGS(PC, ANY, 0, 0, 0)), 33862306a36Sopenharmony_ci 33962306a36Sopenharmony_ci /* STR (immediate) 1111 1000 0100 xxxx xxxx 1xxx xxxx xxxx */ 34062306a36Sopenharmony_ci /* LDR (immediate) 1111 1000 0101 xxxx xxxx 1xxx xxxx xxxx */ 34162306a36Sopenharmony_ci DECODE_OR (0xffe00800, 0xf8400800), 34262306a36Sopenharmony_ci /* STR (immediate) 1111 1000 1100 xxxx xxxx xxxx xxxx xxxx */ 34362306a36Sopenharmony_ci /* LDR (immediate) 1111 1000 1101 xxxx xxxx xxxx xxxx xxxx */ 34462306a36Sopenharmony_ci DECODE_EMULATEX (0xffe00000, 0xf8c00000, PROBES_T32_LDRSTR, 34562306a36Sopenharmony_ci REGS(NOPCX, ANY, 0, 0, 0)), 34662306a36Sopenharmony_ci 34762306a36Sopenharmony_ci /* STR (register) 1111 1000 0100 xxxx xxxx 0000 00xx xxxx */ 34862306a36Sopenharmony_ci /* LDR (register) 1111 1000 0101 xxxx xxxx 0000 00xx xxxx */ 34962306a36Sopenharmony_ci DECODE_EMULATEX (0xffe00fc0, 0xf8400000, PROBES_T32_LDRSTR, 35062306a36Sopenharmony_ci REGS(NOPCX, ANY, 0, 0, NOSPPC)), 35162306a36Sopenharmony_ci 35262306a36Sopenharmony_ci /* LDRB (literal) 1111 1000 x001 1111 xxxx xxxx xxxx xxxx */ 35362306a36Sopenharmony_ci /* LDRSB (literal) 1111 1001 x001 1111 xxxx xxxx xxxx xxxx */ 35462306a36Sopenharmony_ci /* LDRH (literal) 1111 1000 x011 1111 xxxx xxxx xxxx xxxx */ 35562306a36Sopenharmony_ci /* LDRSH (literal) 1111 1001 x011 1111 xxxx xxxx xxxx xxxx */ 35662306a36Sopenharmony_ci DECODE_SIMULATEX(0xfe5f0000, 0xf81f0000, PROBES_T32_LDR_LIT, 35762306a36Sopenharmony_ci REGS(PC, NOSPPCX, 0, 0, 0)), 35862306a36Sopenharmony_ci 35962306a36Sopenharmony_ci /* STRB (immediate) 1111 1000 0000 xxxx xxxx 1xxx xxxx xxxx */ 36062306a36Sopenharmony_ci /* STRH (immediate) 1111 1000 0010 xxxx xxxx 1xxx xxxx xxxx */ 36162306a36Sopenharmony_ci /* LDRB (immediate) 1111 1000 0001 xxxx xxxx 1xxx xxxx xxxx */ 36262306a36Sopenharmony_ci /* LDRSB (immediate) 1111 1001 0001 xxxx xxxx 1xxx xxxx xxxx */ 36362306a36Sopenharmony_ci /* LDRH (immediate) 1111 1000 0011 xxxx xxxx 1xxx xxxx xxxx */ 36462306a36Sopenharmony_ci /* LDRSH (immediate) 1111 1001 0011 xxxx xxxx 1xxx xxxx xxxx */ 36562306a36Sopenharmony_ci DECODE_OR (0xfec00800, 0xf8000800), 36662306a36Sopenharmony_ci /* STRB (immediate) 1111 1000 1000 xxxx xxxx xxxx xxxx xxxx */ 36762306a36Sopenharmony_ci /* STRH (immediate) 1111 1000 1010 xxxx xxxx xxxx xxxx xxxx */ 36862306a36Sopenharmony_ci /* LDRB (immediate) 1111 1000 1001 xxxx xxxx xxxx xxxx xxxx */ 36962306a36Sopenharmony_ci /* LDRSB (immediate) 1111 1001 1001 xxxx xxxx xxxx xxxx xxxx */ 37062306a36Sopenharmony_ci /* LDRH (immediate) 1111 1000 1011 xxxx xxxx xxxx xxxx xxxx */ 37162306a36Sopenharmony_ci /* LDRSH (immediate) 1111 1001 1011 xxxx xxxx xxxx xxxx xxxx */ 37262306a36Sopenharmony_ci DECODE_EMULATEX (0xfec00000, 0xf8800000, PROBES_T32_LDRSTR, 37362306a36Sopenharmony_ci REGS(NOPCX, NOSPPCX, 0, 0, 0)), 37462306a36Sopenharmony_ci 37562306a36Sopenharmony_ci /* STRB (register) 1111 1000 0000 xxxx xxxx 0000 00xx xxxx */ 37662306a36Sopenharmony_ci /* STRH (register) 1111 1000 0010 xxxx xxxx 0000 00xx xxxx */ 37762306a36Sopenharmony_ci /* LDRB (register) 1111 1000 0001 xxxx xxxx 0000 00xx xxxx */ 37862306a36Sopenharmony_ci /* LDRSB (register) 1111 1001 0001 xxxx xxxx 0000 00xx xxxx */ 37962306a36Sopenharmony_ci /* LDRH (register) 1111 1000 0011 xxxx xxxx 0000 00xx xxxx */ 38062306a36Sopenharmony_ci /* LDRSH (register) 1111 1001 0011 xxxx xxxx 0000 00xx xxxx */ 38162306a36Sopenharmony_ci DECODE_EMULATEX (0xfe800fc0, 0xf8000000, PROBES_T32_LDRSTR, 38262306a36Sopenharmony_ci REGS(NOPCX, NOSPPCX, 0, 0, NOSPPC)), 38362306a36Sopenharmony_ci 38462306a36Sopenharmony_ci /* Other unallocated instructions... */ 38562306a36Sopenharmony_ci DECODE_END 38662306a36Sopenharmony_ci}; 38762306a36Sopenharmony_ci 38862306a36Sopenharmony_cistatic const union decode_item t32_table_1111_1010___1111[] = { 38962306a36Sopenharmony_ci /* Data-processing (register) */ 39062306a36Sopenharmony_ci 39162306a36Sopenharmony_ci /* ??? 1111 1010 011x xxxx 1111 xxxx 1xxx xxxx */ 39262306a36Sopenharmony_ci DECODE_REJECT (0xffe0f080, 0xfa60f080), 39362306a36Sopenharmony_ci 39462306a36Sopenharmony_ci /* SXTH 1111 1010 0000 1111 1111 xxxx 1xxx xxxx */ 39562306a36Sopenharmony_ci /* UXTH 1111 1010 0001 1111 1111 xxxx 1xxx xxxx */ 39662306a36Sopenharmony_ci /* SXTB16 1111 1010 0010 1111 1111 xxxx 1xxx xxxx */ 39762306a36Sopenharmony_ci /* UXTB16 1111 1010 0011 1111 1111 xxxx 1xxx xxxx */ 39862306a36Sopenharmony_ci /* SXTB 1111 1010 0100 1111 1111 xxxx 1xxx xxxx */ 39962306a36Sopenharmony_ci /* UXTB 1111 1010 0101 1111 1111 xxxx 1xxx xxxx */ 40062306a36Sopenharmony_ci DECODE_EMULATEX (0xff8ff080, 0xfa0ff080, PROBES_T32_SIGN_EXTEND, 40162306a36Sopenharmony_ci REGS(0, 0, NOSPPC, 0, NOSPPC)), 40262306a36Sopenharmony_ci 40362306a36Sopenharmony_ci 40462306a36Sopenharmony_ci /* ??? 1111 1010 1xxx xxxx 1111 xxxx 0x11 xxxx */ 40562306a36Sopenharmony_ci DECODE_REJECT (0xff80f0b0, 0xfa80f030), 40662306a36Sopenharmony_ci /* ??? 1111 1010 1x11 xxxx 1111 xxxx 0xxx xxxx */ 40762306a36Sopenharmony_ci DECODE_REJECT (0xffb0f080, 0xfab0f000), 40862306a36Sopenharmony_ci 40962306a36Sopenharmony_ci /* SADD16 1111 1010 1001 xxxx 1111 xxxx 0000 xxxx */ 41062306a36Sopenharmony_ci /* SASX 1111 1010 1010 xxxx 1111 xxxx 0000 xxxx */ 41162306a36Sopenharmony_ci /* SSAX 1111 1010 1110 xxxx 1111 xxxx 0000 xxxx */ 41262306a36Sopenharmony_ci /* SSUB16 1111 1010 1101 xxxx 1111 xxxx 0000 xxxx */ 41362306a36Sopenharmony_ci /* SADD8 1111 1010 1000 xxxx 1111 xxxx 0000 xxxx */ 41462306a36Sopenharmony_ci /* SSUB8 1111 1010 1100 xxxx 1111 xxxx 0000 xxxx */ 41562306a36Sopenharmony_ci 41662306a36Sopenharmony_ci /* QADD16 1111 1010 1001 xxxx 1111 xxxx 0001 xxxx */ 41762306a36Sopenharmony_ci /* QASX 1111 1010 1010 xxxx 1111 xxxx 0001 xxxx */ 41862306a36Sopenharmony_ci /* QSAX 1111 1010 1110 xxxx 1111 xxxx 0001 xxxx */ 41962306a36Sopenharmony_ci /* QSUB16 1111 1010 1101 xxxx 1111 xxxx 0001 xxxx */ 42062306a36Sopenharmony_ci /* QADD8 1111 1010 1000 xxxx 1111 xxxx 0001 xxxx */ 42162306a36Sopenharmony_ci /* QSUB8 1111 1010 1100 xxxx 1111 xxxx 0001 xxxx */ 42262306a36Sopenharmony_ci 42362306a36Sopenharmony_ci /* SHADD16 1111 1010 1001 xxxx 1111 xxxx 0010 xxxx */ 42462306a36Sopenharmony_ci /* SHASX 1111 1010 1010 xxxx 1111 xxxx 0010 xxxx */ 42562306a36Sopenharmony_ci /* SHSAX 1111 1010 1110 xxxx 1111 xxxx 0010 xxxx */ 42662306a36Sopenharmony_ci /* SHSUB16 1111 1010 1101 xxxx 1111 xxxx 0010 xxxx */ 42762306a36Sopenharmony_ci /* SHADD8 1111 1010 1000 xxxx 1111 xxxx 0010 xxxx */ 42862306a36Sopenharmony_ci /* SHSUB8 1111 1010 1100 xxxx 1111 xxxx 0010 xxxx */ 42962306a36Sopenharmony_ci 43062306a36Sopenharmony_ci /* UADD16 1111 1010 1001 xxxx 1111 xxxx 0100 xxxx */ 43162306a36Sopenharmony_ci /* UASX 1111 1010 1010 xxxx 1111 xxxx 0100 xxxx */ 43262306a36Sopenharmony_ci /* USAX 1111 1010 1110 xxxx 1111 xxxx 0100 xxxx */ 43362306a36Sopenharmony_ci /* USUB16 1111 1010 1101 xxxx 1111 xxxx 0100 xxxx */ 43462306a36Sopenharmony_ci /* UADD8 1111 1010 1000 xxxx 1111 xxxx 0100 xxxx */ 43562306a36Sopenharmony_ci /* USUB8 1111 1010 1100 xxxx 1111 xxxx 0100 xxxx */ 43662306a36Sopenharmony_ci 43762306a36Sopenharmony_ci /* UQADD16 1111 1010 1001 xxxx 1111 xxxx 0101 xxxx */ 43862306a36Sopenharmony_ci /* UQASX 1111 1010 1010 xxxx 1111 xxxx 0101 xxxx */ 43962306a36Sopenharmony_ci /* UQSAX 1111 1010 1110 xxxx 1111 xxxx 0101 xxxx */ 44062306a36Sopenharmony_ci /* UQSUB16 1111 1010 1101 xxxx 1111 xxxx 0101 xxxx */ 44162306a36Sopenharmony_ci /* UQADD8 1111 1010 1000 xxxx 1111 xxxx 0101 xxxx */ 44262306a36Sopenharmony_ci /* UQSUB8 1111 1010 1100 xxxx 1111 xxxx 0101 xxxx */ 44362306a36Sopenharmony_ci 44462306a36Sopenharmony_ci /* UHADD16 1111 1010 1001 xxxx 1111 xxxx 0110 xxxx */ 44562306a36Sopenharmony_ci /* UHASX 1111 1010 1010 xxxx 1111 xxxx 0110 xxxx */ 44662306a36Sopenharmony_ci /* UHSAX 1111 1010 1110 xxxx 1111 xxxx 0110 xxxx */ 44762306a36Sopenharmony_ci /* UHSUB16 1111 1010 1101 xxxx 1111 xxxx 0110 xxxx */ 44862306a36Sopenharmony_ci /* UHADD8 1111 1010 1000 xxxx 1111 xxxx 0110 xxxx */ 44962306a36Sopenharmony_ci /* UHSUB8 1111 1010 1100 xxxx 1111 xxxx 0110 xxxx */ 45062306a36Sopenharmony_ci DECODE_OR (0xff80f080, 0xfa80f000), 45162306a36Sopenharmony_ci 45262306a36Sopenharmony_ci /* SXTAH 1111 1010 0000 xxxx 1111 xxxx 1xxx xxxx */ 45362306a36Sopenharmony_ci /* UXTAH 1111 1010 0001 xxxx 1111 xxxx 1xxx xxxx */ 45462306a36Sopenharmony_ci /* SXTAB16 1111 1010 0010 xxxx 1111 xxxx 1xxx xxxx */ 45562306a36Sopenharmony_ci /* UXTAB16 1111 1010 0011 xxxx 1111 xxxx 1xxx xxxx */ 45662306a36Sopenharmony_ci /* SXTAB 1111 1010 0100 xxxx 1111 xxxx 1xxx xxxx */ 45762306a36Sopenharmony_ci /* UXTAB 1111 1010 0101 xxxx 1111 xxxx 1xxx xxxx */ 45862306a36Sopenharmony_ci DECODE_OR (0xff80f080, 0xfa00f080), 45962306a36Sopenharmony_ci 46062306a36Sopenharmony_ci /* QADD 1111 1010 1000 xxxx 1111 xxxx 1000 xxxx */ 46162306a36Sopenharmony_ci /* QDADD 1111 1010 1000 xxxx 1111 xxxx 1001 xxxx */ 46262306a36Sopenharmony_ci /* QSUB 1111 1010 1000 xxxx 1111 xxxx 1010 xxxx */ 46362306a36Sopenharmony_ci /* QDSUB 1111 1010 1000 xxxx 1111 xxxx 1011 xxxx */ 46462306a36Sopenharmony_ci DECODE_OR (0xfff0f0c0, 0xfa80f080), 46562306a36Sopenharmony_ci 46662306a36Sopenharmony_ci /* SEL 1111 1010 1010 xxxx 1111 xxxx 1000 xxxx */ 46762306a36Sopenharmony_ci DECODE_OR (0xfff0f0f0, 0xfaa0f080), 46862306a36Sopenharmony_ci 46962306a36Sopenharmony_ci /* LSL 1111 1010 000x xxxx 1111 xxxx 0000 xxxx */ 47062306a36Sopenharmony_ci /* LSR 1111 1010 001x xxxx 1111 xxxx 0000 xxxx */ 47162306a36Sopenharmony_ci /* ASR 1111 1010 010x xxxx 1111 xxxx 0000 xxxx */ 47262306a36Sopenharmony_ci /* ROR 1111 1010 011x xxxx 1111 xxxx 0000 xxxx */ 47362306a36Sopenharmony_ci DECODE_EMULATEX (0xff80f0f0, 0xfa00f000, PROBES_T32_MEDIA, 47462306a36Sopenharmony_ci REGS(NOSPPC, 0, NOSPPC, 0, NOSPPC)), 47562306a36Sopenharmony_ci 47662306a36Sopenharmony_ci /* CLZ 1111 1010 1010 xxxx 1111 xxxx 1000 xxxx */ 47762306a36Sopenharmony_ci DECODE_OR (0xfff0f0f0, 0xfab0f080), 47862306a36Sopenharmony_ci 47962306a36Sopenharmony_ci /* REV 1111 1010 1001 xxxx 1111 xxxx 1000 xxxx */ 48062306a36Sopenharmony_ci /* REV16 1111 1010 1001 xxxx 1111 xxxx 1001 xxxx */ 48162306a36Sopenharmony_ci /* RBIT 1111 1010 1001 xxxx 1111 xxxx 1010 xxxx */ 48262306a36Sopenharmony_ci /* REVSH 1111 1010 1001 xxxx 1111 xxxx 1011 xxxx */ 48362306a36Sopenharmony_ci DECODE_EMULATEX (0xfff0f0c0, 0xfa90f080, PROBES_T32_REVERSE, 48462306a36Sopenharmony_ci REGS(NOSPPC, 0, NOSPPC, 0, SAMEAS16)), 48562306a36Sopenharmony_ci 48662306a36Sopenharmony_ci /* Other unallocated instructions... */ 48762306a36Sopenharmony_ci DECODE_END 48862306a36Sopenharmony_ci}; 48962306a36Sopenharmony_ci 49062306a36Sopenharmony_cistatic const union decode_item t32_table_1111_1011_0[] = { 49162306a36Sopenharmony_ci /* Multiply, multiply accumulate, and absolute difference */ 49262306a36Sopenharmony_ci 49362306a36Sopenharmony_ci /* ??? 1111 1011 0000 xxxx 1111 xxxx 0001 xxxx */ 49462306a36Sopenharmony_ci DECODE_REJECT (0xfff0f0f0, 0xfb00f010), 49562306a36Sopenharmony_ci /* ??? 1111 1011 0111 xxxx 1111 xxxx 0001 xxxx */ 49662306a36Sopenharmony_ci DECODE_REJECT (0xfff0f0f0, 0xfb70f010), 49762306a36Sopenharmony_ci 49862306a36Sopenharmony_ci /* SMULxy 1111 1011 0001 xxxx 1111 xxxx 00xx xxxx */ 49962306a36Sopenharmony_ci DECODE_OR (0xfff0f0c0, 0xfb10f000), 50062306a36Sopenharmony_ci /* MUL 1111 1011 0000 xxxx 1111 xxxx 0000 xxxx */ 50162306a36Sopenharmony_ci /* SMUAD{X} 1111 1011 0010 xxxx 1111 xxxx 000x xxxx */ 50262306a36Sopenharmony_ci /* SMULWy 1111 1011 0011 xxxx 1111 xxxx 000x xxxx */ 50362306a36Sopenharmony_ci /* SMUSD{X} 1111 1011 0100 xxxx 1111 xxxx 000x xxxx */ 50462306a36Sopenharmony_ci /* SMMUL{R} 1111 1011 0101 xxxx 1111 xxxx 000x xxxx */ 50562306a36Sopenharmony_ci /* USAD8 1111 1011 0111 xxxx 1111 xxxx 0000 xxxx */ 50662306a36Sopenharmony_ci DECODE_EMULATEX (0xff80f0e0, 0xfb00f000, PROBES_T32_MUL_ADD, 50762306a36Sopenharmony_ci REGS(NOSPPC, 0, NOSPPC, 0, NOSPPC)), 50862306a36Sopenharmony_ci 50962306a36Sopenharmony_ci /* ??? 1111 1011 0111 xxxx xxxx xxxx 0001 xxxx */ 51062306a36Sopenharmony_ci DECODE_REJECT (0xfff000f0, 0xfb700010), 51162306a36Sopenharmony_ci 51262306a36Sopenharmony_ci /* SMLAxy 1111 1011 0001 xxxx xxxx xxxx 00xx xxxx */ 51362306a36Sopenharmony_ci DECODE_OR (0xfff000c0, 0xfb100000), 51462306a36Sopenharmony_ci /* MLA 1111 1011 0000 xxxx xxxx xxxx 0000 xxxx */ 51562306a36Sopenharmony_ci /* MLS 1111 1011 0000 xxxx xxxx xxxx 0001 xxxx */ 51662306a36Sopenharmony_ci /* SMLAD{X} 1111 1011 0010 xxxx xxxx xxxx 000x xxxx */ 51762306a36Sopenharmony_ci /* SMLAWy 1111 1011 0011 xxxx xxxx xxxx 000x xxxx */ 51862306a36Sopenharmony_ci /* SMLSD{X} 1111 1011 0100 xxxx xxxx xxxx 000x xxxx */ 51962306a36Sopenharmony_ci /* SMMLA{R} 1111 1011 0101 xxxx xxxx xxxx 000x xxxx */ 52062306a36Sopenharmony_ci /* SMMLS{R} 1111 1011 0110 xxxx xxxx xxxx 000x xxxx */ 52162306a36Sopenharmony_ci /* USADA8 1111 1011 0111 xxxx xxxx xxxx 0000 xxxx */ 52262306a36Sopenharmony_ci DECODE_EMULATEX (0xff8000c0, 0xfb000000, PROBES_T32_MUL_ADD2, 52362306a36Sopenharmony_ci REGS(NOSPPC, NOSPPCX, NOSPPC, 0, NOSPPC)), 52462306a36Sopenharmony_ci 52562306a36Sopenharmony_ci /* Other unallocated instructions... */ 52662306a36Sopenharmony_ci DECODE_END 52762306a36Sopenharmony_ci}; 52862306a36Sopenharmony_ci 52962306a36Sopenharmony_cistatic const union decode_item t32_table_1111_1011_1[] = { 53062306a36Sopenharmony_ci /* Long multiply, long multiply accumulate, and divide */ 53162306a36Sopenharmony_ci 53262306a36Sopenharmony_ci /* UMAAL 1111 1011 1110 xxxx xxxx xxxx 0110 xxxx */ 53362306a36Sopenharmony_ci DECODE_OR (0xfff000f0, 0xfbe00060), 53462306a36Sopenharmony_ci /* SMLALxy 1111 1011 1100 xxxx xxxx xxxx 10xx xxxx */ 53562306a36Sopenharmony_ci DECODE_OR (0xfff000c0, 0xfbc00080), 53662306a36Sopenharmony_ci /* SMLALD{X} 1111 1011 1100 xxxx xxxx xxxx 110x xxxx */ 53762306a36Sopenharmony_ci /* SMLSLD{X} 1111 1011 1101 xxxx xxxx xxxx 110x xxxx */ 53862306a36Sopenharmony_ci DECODE_OR (0xffe000e0, 0xfbc000c0), 53962306a36Sopenharmony_ci /* SMULL 1111 1011 1000 xxxx xxxx xxxx 0000 xxxx */ 54062306a36Sopenharmony_ci /* UMULL 1111 1011 1010 xxxx xxxx xxxx 0000 xxxx */ 54162306a36Sopenharmony_ci /* SMLAL 1111 1011 1100 xxxx xxxx xxxx 0000 xxxx */ 54262306a36Sopenharmony_ci /* UMLAL 1111 1011 1110 xxxx xxxx xxxx 0000 xxxx */ 54362306a36Sopenharmony_ci DECODE_EMULATEX (0xff9000f0, 0xfb800000, PROBES_T32_MUL_ADD_LONG, 54462306a36Sopenharmony_ci REGS(NOSPPC, NOSPPC, NOSPPC, 0, NOSPPC)), 54562306a36Sopenharmony_ci 54662306a36Sopenharmony_ci /* SDIV 1111 1011 1001 xxxx xxxx xxxx 1111 xxxx */ 54762306a36Sopenharmony_ci /* UDIV 1111 1011 1011 xxxx xxxx xxxx 1111 xxxx */ 54862306a36Sopenharmony_ci /* Other unallocated instructions... */ 54962306a36Sopenharmony_ci DECODE_END 55062306a36Sopenharmony_ci}; 55162306a36Sopenharmony_ci 55262306a36Sopenharmony_ciconst union decode_item probes_decode_thumb32_table[] = { 55362306a36Sopenharmony_ci 55462306a36Sopenharmony_ci /* 55562306a36Sopenharmony_ci * Load/store multiple instructions 55662306a36Sopenharmony_ci * 1110 100x x0xx xxxx xxxx xxxx xxxx xxxx 55762306a36Sopenharmony_ci */ 55862306a36Sopenharmony_ci DECODE_TABLE (0xfe400000, 0xe8000000, t32_table_1110_100x_x0xx), 55962306a36Sopenharmony_ci 56062306a36Sopenharmony_ci /* 56162306a36Sopenharmony_ci * Load/store dual, load/store exclusive, table branch 56262306a36Sopenharmony_ci * 1110 100x x1xx xxxx xxxx xxxx xxxx xxxx 56362306a36Sopenharmony_ci */ 56462306a36Sopenharmony_ci DECODE_TABLE (0xfe400000, 0xe8400000, t32_table_1110_100x_x1xx), 56562306a36Sopenharmony_ci 56662306a36Sopenharmony_ci /* 56762306a36Sopenharmony_ci * Data-processing (shifted register) 56862306a36Sopenharmony_ci * 1110 101x xxxx xxxx xxxx xxxx xxxx xxxx 56962306a36Sopenharmony_ci */ 57062306a36Sopenharmony_ci DECODE_TABLE (0xfe000000, 0xea000000, t32_table_1110_101x), 57162306a36Sopenharmony_ci 57262306a36Sopenharmony_ci /* 57362306a36Sopenharmony_ci * Coprocessor instructions 57462306a36Sopenharmony_ci * 1110 11xx xxxx xxxx xxxx xxxx xxxx xxxx 57562306a36Sopenharmony_ci */ 57662306a36Sopenharmony_ci DECODE_REJECT (0xfc000000, 0xec000000), 57762306a36Sopenharmony_ci 57862306a36Sopenharmony_ci /* 57962306a36Sopenharmony_ci * Data-processing (modified immediate) 58062306a36Sopenharmony_ci * 1111 0x0x xxxx xxxx 0xxx xxxx xxxx xxxx 58162306a36Sopenharmony_ci */ 58262306a36Sopenharmony_ci DECODE_TABLE (0xfa008000, 0xf0000000, t32_table_1111_0x0x___0), 58362306a36Sopenharmony_ci 58462306a36Sopenharmony_ci /* 58562306a36Sopenharmony_ci * Data-processing (plain binary immediate) 58662306a36Sopenharmony_ci * 1111 0x1x xxxx xxxx 0xxx xxxx xxxx xxxx 58762306a36Sopenharmony_ci */ 58862306a36Sopenharmony_ci DECODE_TABLE (0xfa008000, 0xf2000000, t32_table_1111_0x1x___0), 58962306a36Sopenharmony_ci 59062306a36Sopenharmony_ci /* 59162306a36Sopenharmony_ci * Branches and miscellaneous control 59262306a36Sopenharmony_ci * 1111 0xxx xxxx xxxx 1xxx xxxx xxxx xxxx 59362306a36Sopenharmony_ci */ 59462306a36Sopenharmony_ci DECODE_TABLE (0xf8008000, 0xf0008000, t32_table_1111_0xxx___1), 59562306a36Sopenharmony_ci 59662306a36Sopenharmony_ci /* 59762306a36Sopenharmony_ci * Advanced SIMD element or structure load/store instructions 59862306a36Sopenharmony_ci * 1111 1001 xxx0 xxxx xxxx xxxx xxxx xxxx 59962306a36Sopenharmony_ci */ 60062306a36Sopenharmony_ci DECODE_REJECT (0xff100000, 0xf9000000), 60162306a36Sopenharmony_ci 60262306a36Sopenharmony_ci /* 60362306a36Sopenharmony_ci * Memory hints 60462306a36Sopenharmony_ci * 1111 100x x0x1 xxxx 1111 xxxx xxxx xxxx 60562306a36Sopenharmony_ci */ 60662306a36Sopenharmony_ci DECODE_TABLE (0xfe50f000, 0xf810f000, t32_table_1111_100x_x0x1__1111), 60762306a36Sopenharmony_ci 60862306a36Sopenharmony_ci /* 60962306a36Sopenharmony_ci * Store single data item 61062306a36Sopenharmony_ci * 1111 1000 xxx0 xxxx xxxx xxxx xxxx xxxx 61162306a36Sopenharmony_ci * Load single data items 61262306a36Sopenharmony_ci * 1111 100x xxx1 xxxx xxxx xxxx xxxx xxxx 61362306a36Sopenharmony_ci */ 61462306a36Sopenharmony_ci DECODE_TABLE (0xfe000000, 0xf8000000, t32_table_1111_100x), 61562306a36Sopenharmony_ci 61662306a36Sopenharmony_ci /* 61762306a36Sopenharmony_ci * Data-processing (register) 61862306a36Sopenharmony_ci * 1111 1010 xxxx xxxx 1111 xxxx xxxx xxxx 61962306a36Sopenharmony_ci */ 62062306a36Sopenharmony_ci DECODE_TABLE (0xff00f000, 0xfa00f000, t32_table_1111_1010___1111), 62162306a36Sopenharmony_ci 62262306a36Sopenharmony_ci /* 62362306a36Sopenharmony_ci * Multiply, multiply accumulate, and absolute difference 62462306a36Sopenharmony_ci * 1111 1011 0xxx xxxx xxxx xxxx xxxx xxxx 62562306a36Sopenharmony_ci */ 62662306a36Sopenharmony_ci DECODE_TABLE (0xff800000, 0xfb000000, t32_table_1111_1011_0), 62762306a36Sopenharmony_ci 62862306a36Sopenharmony_ci /* 62962306a36Sopenharmony_ci * Long multiply, long multiply accumulate, and divide 63062306a36Sopenharmony_ci * 1111 1011 1xxx xxxx xxxx xxxx xxxx xxxx 63162306a36Sopenharmony_ci */ 63262306a36Sopenharmony_ci DECODE_TABLE (0xff800000, 0xfb800000, t32_table_1111_1011_1), 63362306a36Sopenharmony_ci 63462306a36Sopenharmony_ci /* 63562306a36Sopenharmony_ci * Coprocessor instructions 63662306a36Sopenharmony_ci * 1111 11xx xxxx xxxx xxxx xxxx xxxx xxxx 63762306a36Sopenharmony_ci */ 63862306a36Sopenharmony_ci DECODE_END 63962306a36Sopenharmony_ci}; 64062306a36Sopenharmony_ci#ifdef CONFIG_ARM_KPROBES_TEST_MODULE 64162306a36Sopenharmony_ciEXPORT_SYMBOL_GPL(probes_decode_thumb32_table); 64262306a36Sopenharmony_ci#endif 64362306a36Sopenharmony_ci 64462306a36Sopenharmony_cistatic const union decode_item t16_table_1011[] = { 64562306a36Sopenharmony_ci /* Miscellaneous 16-bit instructions */ 64662306a36Sopenharmony_ci 64762306a36Sopenharmony_ci /* ADD (SP plus immediate) 1011 0000 0xxx xxxx */ 64862306a36Sopenharmony_ci /* SUB (SP minus immediate) 1011 0000 1xxx xxxx */ 64962306a36Sopenharmony_ci DECODE_SIMULATE (0xff00, 0xb000, PROBES_T16_ADD_SP), 65062306a36Sopenharmony_ci 65162306a36Sopenharmony_ci /* CBZ 1011 00x1 xxxx xxxx */ 65262306a36Sopenharmony_ci /* CBNZ 1011 10x1 xxxx xxxx */ 65362306a36Sopenharmony_ci DECODE_SIMULATE (0xf500, 0xb100, PROBES_T16_CBZ), 65462306a36Sopenharmony_ci 65562306a36Sopenharmony_ci /* SXTH 1011 0010 00xx xxxx */ 65662306a36Sopenharmony_ci /* SXTB 1011 0010 01xx xxxx */ 65762306a36Sopenharmony_ci /* UXTH 1011 0010 10xx xxxx */ 65862306a36Sopenharmony_ci /* UXTB 1011 0010 11xx xxxx */ 65962306a36Sopenharmony_ci /* REV 1011 1010 00xx xxxx */ 66062306a36Sopenharmony_ci /* REV16 1011 1010 01xx xxxx */ 66162306a36Sopenharmony_ci /* ??? 1011 1010 10xx xxxx */ 66262306a36Sopenharmony_ci /* REVSH 1011 1010 11xx xxxx */ 66362306a36Sopenharmony_ci DECODE_REJECT (0xffc0, 0xba80), 66462306a36Sopenharmony_ci DECODE_EMULATE (0xf500, 0xb000, PROBES_T16_SIGN_EXTEND), 66562306a36Sopenharmony_ci 66662306a36Sopenharmony_ci /* PUSH 1011 010x xxxx xxxx */ 66762306a36Sopenharmony_ci DECODE_CUSTOM (0xfe00, 0xb400, PROBES_T16_PUSH), 66862306a36Sopenharmony_ci /* POP 1011 110x xxxx xxxx */ 66962306a36Sopenharmony_ci DECODE_CUSTOM (0xfe00, 0xbc00, PROBES_T16_POP), 67062306a36Sopenharmony_ci 67162306a36Sopenharmony_ci /* 67262306a36Sopenharmony_ci * If-Then, and hints 67362306a36Sopenharmony_ci * 1011 1111 xxxx xxxx 67462306a36Sopenharmony_ci */ 67562306a36Sopenharmony_ci 67662306a36Sopenharmony_ci /* YIELD 1011 1111 0001 0000 */ 67762306a36Sopenharmony_ci DECODE_OR (0xffff, 0xbf10), 67862306a36Sopenharmony_ci /* SEV 1011 1111 0100 0000 */ 67962306a36Sopenharmony_ci DECODE_EMULATE (0xffff, 0xbf40, PROBES_T16_SEV), 68062306a36Sopenharmony_ci /* NOP 1011 1111 0000 0000 */ 68162306a36Sopenharmony_ci /* WFE 1011 1111 0010 0000 */ 68262306a36Sopenharmony_ci /* WFI 1011 1111 0011 0000 */ 68362306a36Sopenharmony_ci DECODE_SIMULATE (0xffcf, 0xbf00, PROBES_T16_WFE), 68462306a36Sopenharmony_ci /* Unassigned hints 1011 1111 xxxx 0000 */ 68562306a36Sopenharmony_ci DECODE_REJECT (0xff0f, 0xbf00), 68662306a36Sopenharmony_ci /* IT 1011 1111 xxxx xxxx */ 68762306a36Sopenharmony_ci DECODE_CUSTOM (0xff00, 0xbf00, PROBES_T16_IT), 68862306a36Sopenharmony_ci 68962306a36Sopenharmony_ci /* SETEND 1011 0110 010x xxxx */ 69062306a36Sopenharmony_ci /* CPS 1011 0110 011x xxxx */ 69162306a36Sopenharmony_ci /* BKPT 1011 1110 xxxx xxxx */ 69262306a36Sopenharmony_ci /* And unallocated instructions... */ 69362306a36Sopenharmony_ci DECODE_END 69462306a36Sopenharmony_ci}; 69562306a36Sopenharmony_ci 69662306a36Sopenharmony_ciconst union decode_item probes_decode_thumb16_table[] = { 69762306a36Sopenharmony_ci 69862306a36Sopenharmony_ci /* 69962306a36Sopenharmony_ci * Shift (immediate), add, subtract, move, and compare 70062306a36Sopenharmony_ci * 00xx xxxx xxxx xxxx 70162306a36Sopenharmony_ci */ 70262306a36Sopenharmony_ci 70362306a36Sopenharmony_ci /* CMP (immediate) 0010 1xxx xxxx xxxx */ 70462306a36Sopenharmony_ci DECODE_EMULATE (0xf800, 0x2800, PROBES_T16_CMP), 70562306a36Sopenharmony_ci 70662306a36Sopenharmony_ci /* ADD (register) 0001 100x xxxx xxxx */ 70762306a36Sopenharmony_ci /* SUB (register) 0001 101x xxxx xxxx */ 70862306a36Sopenharmony_ci /* LSL (immediate) 0000 0xxx xxxx xxxx */ 70962306a36Sopenharmony_ci /* LSR (immediate) 0000 1xxx xxxx xxxx */ 71062306a36Sopenharmony_ci /* ASR (immediate) 0001 0xxx xxxx xxxx */ 71162306a36Sopenharmony_ci /* ADD (immediate, Thumb) 0001 110x xxxx xxxx */ 71262306a36Sopenharmony_ci /* SUB (immediate, Thumb) 0001 111x xxxx xxxx */ 71362306a36Sopenharmony_ci /* MOV (immediate) 0010 0xxx xxxx xxxx */ 71462306a36Sopenharmony_ci /* ADD (immediate, Thumb) 0011 0xxx xxxx xxxx */ 71562306a36Sopenharmony_ci /* SUB (immediate, Thumb) 0011 1xxx xxxx xxxx */ 71662306a36Sopenharmony_ci DECODE_EMULATE (0xc000, 0x0000, PROBES_T16_ADDSUB), 71762306a36Sopenharmony_ci 71862306a36Sopenharmony_ci /* 71962306a36Sopenharmony_ci * 16-bit Thumb data-processing instructions 72062306a36Sopenharmony_ci * 0100 00xx xxxx xxxx 72162306a36Sopenharmony_ci */ 72262306a36Sopenharmony_ci 72362306a36Sopenharmony_ci /* TST (register) 0100 0010 00xx xxxx */ 72462306a36Sopenharmony_ci DECODE_EMULATE (0xffc0, 0x4200, PROBES_T16_CMP), 72562306a36Sopenharmony_ci /* CMP (register) 0100 0010 10xx xxxx */ 72662306a36Sopenharmony_ci /* CMN (register) 0100 0010 11xx xxxx */ 72762306a36Sopenharmony_ci DECODE_EMULATE (0xff80, 0x4280, PROBES_T16_CMP), 72862306a36Sopenharmony_ci /* AND (register) 0100 0000 00xx xxxx */ 72962306a36Sopenharmony_ci /* EOR (register) 0100 0000 01xx xxxx */ 73062306a36Sopenharmony_ci /* LSL (register) 0100 0000 10xx xxxx */ 73162306a36Sopenharmony_ci /* LSR (register) 0100 0000 11xx xxxx */ 73262306a36Sopenharmony_ci /* ASR (register) 0100 0001 00xx xxxx */ 73362306a36Sopenharmony_ci /* ADC (register) 0100 0001 01xx xxxx */ 73462306a36Sopenharmony_ci /* SBC (register) 0100 0001 10xx xxxx */ 73562306a36Sopenharmony_ci /* ROR (register) 0100 0001 11xx xxxx */ 73662306a36Sopenharmony_ci /* RSB (immediate) 0100 0010 01xx xxxx */ 73762306a36Sopenharmony_ci /* ORR (register) 0100 0011 00xx xxxx */ 73862306a36Sopenharmony_ci /* MUL 0100 0011 00xx xxxx */ 73962306a36Sopenharmony_ci /* BIC (register) 0100 0011 10xx xxxx */ 74062306a36Sopenharmony_ci /* MVN (register) 0100 0011 10xx xxxx */ 74162306a36Sopenharmony_ci DECODE_EMULATE (0xfc00, 0x4000, PROBES_T16_LOGICAL), 74262306a36Sopenharmony_ci 74362306a36Sopenharmony_ci /* 74462306a36Sopenharmony_ci * Special data instructions and branch and exchange 74562306a36Sopenharmony_ci * 0100 01xx xxxx xxxx 74662306a36Sopenharmony_ci */ 74762306a36Sopenharmony_ci 74862306a36Sopenharmony_ci /* BLX pc 0100 0111 1111 1xxx */ 74962306a36Sopenharmony_ci DECODE_REJECT (0xfff8, 0x47f8), 75062306a36Sopenharmony_ci 75162306a36Sopenharmony_ci /* BX (register) 0100 0111 0xxx xxxx */ 75262306a36Sopenharmony_ci /* BLX (register) 0100 0111 1xxx xxxx */ 75362306a36Sopenharmony_ci DECODE_SIMULATE (0xff00, 0x4700, PROBES_T16_BLX), 75462306a36Sopenharmony_ci 75562306a36Sopenharmony_ci /* ADD pc, pc 0100 0100 1111 1111 */ 75662306a36Sopenharmony_ci DECODE_REJECT (0xffff, 0x44ff), 75762306a36Sopenharmony_ci 75862306a36Sopenharmony_ci /* ADD (register) 0100 0100 xxxx xxxx */ 75962306a36Sopenharmony_ci /* CMP (register) 0100 0101 xxxx xxxx */ 76062306a36Sopenharmony_ci /* MOV (register) 0100 0110 xxxx xxxx */ 76162306a36Sopenharmony_ci DECODE_CUSTOM (0xfc00, 0x4400, PROBES_T16_HIREGOPS), 76262306a36Sopenharmony_ci 76362306a36Sopenharmony_ci /* 76462306a36Sopenharmony_ci * Load from Literal Pool 76562306a36Sopenharmony_ci * LDR (literal) 0100 1xxx xxxx xxxx 76662306a36Sopenharmony_ci */ 76762306a36Sopenharmony_ci DECODE_SIMULATE (0xf800, 0x4800, PROBES_T16_LDR_LIT), 76862306a36Sopenharmony_ci 76962306a36Sopenharmony_ci /* 77062306a36Sopenharmony_ci * 16-bit Thumb Load/store instructions 77162306a36Sopenharmony_ci * 0101 xxxx xxxx xxxx 77262306a36Sopenharmony_ci * 011x xxxx xxxx xxxx 77362306a36Sopenharmony_ci * 100x xxxx xxxx xxxx 77462306a36Sopenharmony_ci */ 77562306a36Sopenharmony_ci 77662306a36Sopenharmony_ci /* STR (register) 0101 000x xxxx xxxx */ 77762306a36Sopenharmony_ci /* STRH (register) 0101 001x xxxx xxxx */ 77862306a36Sopenharmony_ci /* STRB (register) 0101 010x xxxx xxxx */ 77962306a36Sopenharmony_ci /* LDRSB (register) 0101 011x xxxx xxxx */ 78062306a36Sopenharmony_ci /* LDR (register) 0101 100x xxxx xxxx */ 78162306a36Sopenharmony_ci /* LDRH (register) 0101 101x xxxx xxxx */ 78262306a36Sopenharmony_ci /* LDRB (register) 0101 110x xxxx xxxx */ 78362306a36Sopenharmony_ci /* LDRSH (register) 0101 111x xxxx xxxx */ 78462306a36Sopenharmony_ci /* STR (immediate, Thumb) 0110 0xxx xxxx xxxx */ 78562306a36Sopenharmony_ci /* LDR (immediate, Thumb) 0110 1xxx xxxx xxxx */ 78662306a36Sopenharmony_ci /* STRB (immediate, Thumb) 0111 0xxx xxxx xxxx */ 78762306a36Sopenharmony_ci /* LDRB (immediate, Thumb) 0111 1xxx xxxx xxxx */ 78862306a36Sopenharmony_ci DECODE_EMULATE (0xc000, 0x4000, PROBES_T16_LDRHSTRH), 78962306a36Sopenharmony_ci /* STRH (immediate, Thumb) 1000 0xxx xxxx xxxx */ 79062306a36Sopenharmony_ci /* LDRH (immediate, Thumb) 1000 1xxx xxxx xxxx */ 79162306a36Sopenharmony_ci DECODE_EMULATE (0xf000, 0x8000, PROBES_T16_LDRHSTRH), 79262306a36Sopenharmony_ci /* STR (immediate, Thumb) 1001 0xxx xxxx xxxx */ 79362306a36Sopenharmony_ci /* LDR (immediate, Thumb) 1001 1xxx xxxx xxxx */ 79462306a36Sopenharmony_ci DECODE_SIMULATE (0xf000, 0x9000, PROBES_T16_LDRSTR), 79562306a36Sopenharmony_ci 79662306a36Sopenharmony_ci /* 79762306a36Sopenharmony_ci * Generate PC-/SP-relative address 79862306a36Sopenharmony_ci * ADR (literal) 1010 0xxx xxxx xxxx 79962306a36Sopenharmony_ci * ADD (SP plus immediate) 1010 1xxx xxxx xxxx 80062306a36Sopenharmony_ci */ 80162306a36Sopenharmony_ci DECODE_SIMULATE (0xf000, 0xa000, PROBES_T16_ADR), 80262306a36Sopenharmony_ci 80362306a36Sopenharmony_ci /* 80462306a36Sopenharmony_ci * Miscellaneous 16-bit instructions 80562306a36Sopenharmony_ci * 1011 xxxx xxxx xxxx 80662306a36Sopenharmony_ci */ 80762306a36Sopenharmony_ci DECODE_TABLE (0xf000, 0xb000, t16_table_1011), 80862306a36Sopenharmony_ci 80962306a36Sopenharmony_ci /* STM 1100 0xxx xxxx xxxx */ 81062306a36Sopenharmony_ci /* LDM 1100 1xxx xxxx xxxx */ 81162306a36Sopenharmony_ci DECODE_EMULATE (0xf000, 0xc000, PROBES_T16_LDMSTM), 81262306a36Sopenharmony_ci 81362306a36Sopenharmony_ci /* 81462306a36Sopenharmony_ci * Conditional branch, and Supervisor Call 81562306a36Sopenharmony_ci */ 81662306a36Sopenharmony_ci 81762306a36Sopenharmony_ci /* Permanently UNDEFINED 1101 1110 xxxx xxxx */ 81862306a36Sopenharmony_ci /* SVC 1101 1111 xxxx xxxx */ 81962306a36Sopenharmony_ci DECODE_REJECT (0xfe00, 0xde00), 82062306a36Sopenharmony_ci 82162306a36Sopenharmony_ci /* Conditional branch 1101 xxxx xxxx xxxx */ 82262306a36Sopenharmony_ci DECODE_CUSTOM (0xf000, 0xd000, PROBES_T16_BRANCH_COND), 82362306a36Sopenharmony_ci 82462306a36Sopenharmony_ci /* 82562306a36Sopenharmony_ci * Unconditional branch 82662306a36Sopenharmony_ci * B 1110 0xxx xxxx xxxx 82762306a36Sopenharmony_ci */ 82862306a36Sopenharmony_ci DECODE_SIMULATE (0xf800, 0xe000, PROBES_T16_BRANCH), 82962306a36Sopenharmony_ci 83062306a36Sopenharmony_ci DECODE_END 83162306a36Sopenharmony_ci}; 83262306a36Sopenharmony_ci#ifdef CONFIG_ARM_KPROBES_TEST_MODULE 83362306a36Sopenharmony_ciEXPORT_SYMBOL_GPL(probes_decode_thumb16_table); 83462306a36Sopenharmony_ci#endif 83562306a36Sopenharmony_ci 83662306a36Sopenharmony_cistatic unsigned long __kprobes thumb_check_cc(unsigned long cpsr) 83762306a36Sopenharmony_ci{ 83862306a36Sopenharmony_ci if (unlikely(in_it_block(cpsr))) 83962306a36Sopenharmony_ci return probes_condition_checks[current_cond(cpsr)](cpsr); 84062306a36Sopenharmony_ci return true; 84162306a36Sopenharmony_ci} 84262306a36Sopenharmony_ci 84362306a36Sopenharmony_cistatic void __kprobes thumb16_singlestep(probes_opcode_t opcode, 84462306a36Sopenharmony_ci struct arch_probes_insn *asi, 84562306a36Sopenharmony_ci struct pt_regs *regs) 84662306a36Sopenharmony_ci{ 84762306a36Sopenharmony_ci regs->ARM_pc += 2; 84862306a36Sopenharmony_ci asi->insn_handler(opcode, asi, regs); 84962306a36Sopenharmony_ci regs->ARM_cpsr = it_advance(regs->ARM_cpsr); 85062306a36Sopenharmony_ci} 85162306a36Sopenharmony_ci 85262306a36Sopenharmony_cistatic void __kprobes thumb32_singlestep(probes_opcode_t opcode, 85362306a36Sopenharmony_ci struct arch_probes_insn *asi, 85462306a36Sopenharmony_ci struct pt_regs *regs) 85562306a36Sopenharmony_ci{ 85662306a36Sopenharmony_ci regs->ARM_pc += 4; 85762306a36Sopenharmony_ci asi->insn_handler(opcode, asi, regs); 85862306a36Sopenharmony_ci regs->ARM_cpsr = it_advance(regs->ARM_cpsr); 85962306a36Sopenharmony_ci} 86062306a36Sopenharmony_ci 86162306a36Sopenharmony_cienum probes_insn __kprobes 86262306a36Sopenharmony_cithumb16_probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi, 86362306a36Sopenharmony_ci bool emulate, const union decode_action *actions, 86462306a36Sopenharmony_ci const struct decode_checker *checkers[]) 86562306a36Sopenharmony_ci{ 86662306a36Sopenharmony_ci asi->insn_singlestep = thumb16_singlestep; 86762306a36Sopenharmony_ci asi->insn_check_cc = thumb_check_cc; 86862306a36Sopenharmony_ci return probes_decode_insn(insn, asi, probes_decode_thumb16_table, true, 86962306a36Sopenharmony_ci emulate, actions, checkers); 87062306a36Sopenharmony_ci} 87162306a36Sopenharmony_ci 87262306a36Sopenharmony_cienum probes_insn __kprobes 87362306a36Sopenharmony_cithumb32_probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi, 87462306a36Sopenharmony_ci bool emulate, const union decode_action *actions, 87562306a36Sopenharmony_ci const struct decode_checker *checkers[]) 87662306a36Sopenharmony_ci{ 87762306a36Sopenharmony_ci asi->insn_singlestep = thumb32_singlestep; 87862306a36Sopenharmony_ci asi->insn_check_cc = thumb_check_cc; 87962306a36Sopenharmony_ci return probes_decode_insn(insn, asi, probes_decode_thumb32_table, true, 88062306a36Sopenharmony_ci emulate, actions, checkers); 88162306a36Sopenharmony_ci} 882