MCPcopy Create free account
hub / github.com/capstone-engine/capstone / DecodeT2AddrModeImm8

Function DecodeT2AddrModeImm8

arch/ARM/ARMDisassembler.c:4003–4049  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4001}
4002
4003static DecodeStatus DecodeT2AddrModeImm8(MCInst *Inst, unsigned Val,
4004 uint64_t Address, const void *Decoder)
4005{
4006 DecodeStatus S = MCDisassembler_Success;
4007
4008 unsigned Rn = fieldFromInstruction_4(Val, 9, 4);
4009 unsigned imm = fieldFromInstruction_4(Val, 0, 9);
4010
4011 // Thumb stores cannot use PC as dest register.
4012 switch (MCInst_getOpcode(Inst)) {
4013 case ARM_t2STRT:
4014 case ARM_t2STRBT:
4015 case ARM_t2STRHT:
4016 case ARM_t2STRi8:
4017 case ARM_t2STRHi8:
4018 case ARM_t2STRBi8:
4019 if (Rn == 15)
4020 return MCDisassembler_Fail;
4021 break;
4022 default:
4023 break;
4024 }
4025
4026 // Some instructions always use an additive offset.
4027 switch (MCInst_getOpcode(Inst)) {
4028 case ARM_t2LDRT:
4029 case ARM_t2LDRBT:
4030 case ARM_t2LDRHT:
4031 case ARM_t2LDRSBT:
4032 case ARM_t2LDRSHT:
4033 case ARM_t2STRT:
4034 case ARM_t2STRBT:
4035 case ARM_t2STRHT:
4036 imm |= 0x100;
4037 break;
4038 default:
4039 break;
4040 }
4041
4042 if (!Check(&S, DecodeGPRRegisterClass(Inst, Rn, Address, Decoder)))
4043 return MCDisassembler_Fail;
4044
4045 if (!Check(&S, DecodeT2Imm8(Inst, imm, Address, Decoder)))
4046 return MCDisassembler_Fail;
4047
4048 return S;
4049}
4050
4051static DecodeStatus DecodeT2LdStPre(MCInst *Inst, unsigned Insn,
4052 uint64_t Address, const void *Decoder)

Callers 3

DecodeT2LoadImm8Function · 0.85
DecodeT2LoadTFunction · 0.85
DecodeT2LdStPreFunction · 0.85

Calls 4

MCInst_getOpcodeFunction · 0.85
DecodeT2Imm8Function · 0.85
CheckFunction · 0.70
DecodeGPRRegisterClassFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…