MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / UBFM

Function UBFM

arch/arm64/disassembler/decode2.c:28135–28184  ·  view source on GitHub ↗

ubfm.xml */

Source from the content-addressed store, hash-verified

28133
28134/* ubfm.xml */
28135int UBFM(context *ctx, Instruction *instr)
28136{
28137 int rc = DECODE_STATUS_UNMATCHED;
28138 /* class iclass_zero_fill */
28139 /* sf=x|opc=10|100110|N=x|immr=xxxxxx|imms=xxxxxx|Rn=xxxxx|Rd=xxxxx */
28140 if((INSWORD & 0x7F800000)==0x53000000) {
28141 decode_fields32(ENC_UBFM_32M_BITFIELD, ctx, instr);
28142 ctx->d = UINT(ctx->Rd);
28143 ctx->n = UINT(ctx->Rn);
28144 ctx->datasize = (ctx->sf==1) ? 0x40 : 0x20;
28145 if(!ctx->opc) {
28146 ctx->inzero = TRUE;
28147 ctx->extend = TRUE;
28148 }
28149 else if(ctx->opc==1) {
28150 ctx->inzero = FALSE;
28151 ctx->extend = FALSE;
28152 }
28153 else if(ctx->opc==2) {
28154 ctx->inzero = TRUE;
28155 ctx->extend = FALSE;
28156 }
28157 else if(ctx->opc==3) {
28158 UNDEFINED;
28159 }
28160 if(ctx->sf==1 && ctx->N!=1) {
28161 UNDEFINED;
28162 }
28163 if(ctx->sf==0 && (ctx->N!=0 || SLICE(ctx->immr,5,5)!=0 || SLICE(ctx->imms,5,5)!=0)) {
28164 UNDEFINED;
28165 }
28166 ctx->R = UINT(ctx->immr);
28167 ctx->S = UINT(ctx->imms);
28168 DecodeBitMasks_ReturnType dbmrt = DecodeBitMasks(ctx->N,ctx->imms,ctx->immr);
28169 ctx->wmask = dbmrt.wmask;
28170 ctx->tmask = dbmrt.tmask;
28171 /* regular aliases */
28172 bool encoding32 = ctx->sf==0 && ctx->N==0;
28173 bool encoding64 = ctx->sf==1 && ctx->N==1;
28174 if((ctx->imms!=0x1f && ctx->imms+1==ctx->immr && EncodingLabeled32Bit()) || (ctx->imms!=0x3f && ctx->imms+1==ctx->immr && EncodingLabeled64Bit())) return LSL_UBFM(ctx, instr);
28175 if((ctx->imms==0x1f && EncodingLabeled32Bit()) || (ctx->imms==0x3f && EncodingLabeled64Bit())) return LSR_UBFM(ctx, instr);
28176 if(UINT(ctx->imms)<UINT(ctx->immr)) return UBFIZ_UBFM(ctx, instr);
28177 if(BFXPreferred(ctx->sf,SLICE(ctx->opc,1,1),ctx->imms,ctx->immr)) return UBFX_UBFM(ctx, instr);
28178 if(ctx->immr==0 && ctx->imms==7) return UXTB_UBFM(ctx, instr);
28179 if(ctx->immr==0 && ctx->imms==15) return UXTH_UBFM(ctx, instr);
28180 if(ctx->sf==0 && ctx->N==0) OK(ENC_UBFM_32M_BITFIELD);
28181 if(ctx->sf==1 && ctx->N==1) OK(ENC_UBFM_64M_BITFIELD);
28182 }
28183 return rc;
28184}
28185
28186/* ubfx_ubfm.xml */
28187int UBFX_UBFM(context *ctx, Instruction *instr)

Callers 1

decode_iclass_bitfieldFunction · 0.85

Calls 9

decode_fields32Function · 0.85
DecodeBitMasksFunction · 0.85
LSL_UBFMFunction · 0.85
LSR_UBFMFunction · 0.85
UBFIZ_UBFMFunction · 0.85
BFXPreferredFunction · 0.85
UBFX_UBFMFunction · 0.85
UXTB_UBFMFunction · 0.85
UXTH_UBFMFunction · 0.85

Tested by

no test coverage detected