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

Function SBFM

arch/arm64/disassembler/decode2.c:20322–20371  ·  view source on GitHub ↗

sbfm.xml */

Source from the content-addressed store, hash-verified

20320
20321/* sbfm.xml */
20322int SBFM(context *ctx, Instruction *instr)
20323{
20324 int rc = DECODE_STATUS_UNMATCHED;
20325 /* class iclass_signed_fill */
20326 /* sf=x|opc=00|100110|N=x|immr=xxxxxx|imms=xxxxxx|Rn=xxxxx|Rd=xxxxx */
20327 if((INSWORD & 0x7F800000)==0x13000000) {
20328 decode_fields32(ENC_SBFM_32M_BITFIELD, ctx, instr);
20329 ctx->d = UINT(ctx->Rd);
20330 ctx->n = UINT(ctx->Rn);
20331 ctx->datasize = (ctx->sf==1) ? 0x40 : 0x20;
20332 if(!ctx->opc) {
20333 ctx->inzero = TRUE;
20334 ctx->extend = TRUE;
20335 }
20336 else if(ctx->opc==1) {
20337 ctx->inzero = FALSE;
20338 ctx->extend = FALSE;
20339 }
20340 else if(ctx->opc==2) {
20341 ctx->inzero = TRUE;
20342 ctx->extend = FALSE;
20343 }
20344 else if(ctx->opc==3) {
20345 UNDEFINED;
20346 }
20347 if(ctx->sf==1 && ctx->N!=1) {
20348 UNDEFINED;
20349 }
20350 if(ctx->sf==0 && (ctx->N!=0 || SLICE(ctx->immr,5,5)!=0 || SLICE(ctx->imms,5,5)!=0)) {
20351 UNDEFINED;
20352 }
20353 ctx->R = UINT(ctx->immr);
20354 ctx->S = UINT(ctx->imms);
20355 DecodeBitMasks_ReturnType dbmrt = DecodeBitMasks(ctx->N,ctx->imms,ctx->immr);
20356 ctx->wmask = dbmrt.wmask;
20357 ctx->tmask = dbmrt.tmask;
20358 /* regular aliases */
20359 bool encoding32 = ctx->sf==0 && ctx->N==0;
20360 bool encoding64 = ctx->sf==1 && ctx->N==1;
20361 if((ctx->imms==0x1f && EncodingLabeled32Bit()) || (ctx->imms==0x3f && EncodingLabeled64Bit())) return ASR_SBFM(ctx, instr);
20362 if(UINT(ctx->imms)<UINT(ctx->immr)) return SBFIZ_SBFM(ctx, instr);
20363 if(BFXPreferred(ctx->sf,SLICE(ctx->opc,1,1),ctx->imms,ctx->immr)) return SBFX_SBFM(ctx, instr);
20364 if(ctx->immr==0 && ctx->imms==7) return SXTB_SBFM(ctx, instr);
20365 if(ctx->immr==0 && ctx->imms==15) return SXTH_SBFM(ctx, instr);
20366 if(ctx->immr==0 && ctx->imms==0x1f) return SXTW_SBFM(ctx, instr);
20367 if(ctx->sf==0 && ctx->N==0) OK(ENC_SBFM_32M_BITFIELD);
20368 if(ctx->sf==1 && ctx->N==1) OK(ENC_SBFM_64M_BITFIELD);
20369 }
20370 return rc;
20371}
20372
20373/* sbfx_sbfm.xml */
20374int SBFX_SBFM(context *ctx, Instruction *instr)

Callers 1

decode_iclass_bitfieldFunction · 0.85

Calls 9

decode_fields32Function · 0.85
DecodeBitMasksFunction · 0.85
ASR_SBFMFunction · 0.85
SBFIZ_SBFMFunction · 0.85
BFXPreferredFunction · 0.85
SBFX_SBFMFunction · 0.85
SXTB_SBFMFunction · 0.85
SXTH_SBFMFunction · 0.85
SXTW_SBFMFunction · 0.85

Tested by

no test coverage detected