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

Function STP_gen

arch/arm64/disassembler/decode2.c:25449–25505  ·  view source on GitHub ↗

stp_gen.xml */

Source from the content-addressed store, hash-verified

25447
25448/* stp_gen.xml */
25449int STP_gen(context *ctx, Instruction *instr)
25450{
25451 int rc = DECODE_STATUS_UNMATCHED;
25452 /* class iclass_post_indexed */
25453 /* opc=x0|101|V=0|001|L=0|imm7=xxxxxxx|Rt2=xxxxx|Rn=xxxxx|Rt=xxxxx */
25454 if((INSWORD & 0x7FC00000)==0x28800000) {
25455 decode_fields32(ENC_STP_32_LDSTPAIR_POST, ctx, instr);
25456 if(ctx->opc==0) OK(ENC_STP_32_LDSTPAIR_POST);
25457 if(ctx->opc==2) OK(ENC_STP_64_LDSTPAIR_POST);
25458 }
25459 /* class iclass_pre_indexed */
25460 /* opc=x0|101|V=0|011|L=0|imm7=xxxxxxx|Rt2=xxxxx|Rn=xxxxx|Rt=xxxxx */
25461 if((INSWORD & 0x7FC00000)==0x29800000) {
25462 decode_fields32(ENC_STP_32_LDSTPAIR_PRE, ctx, instr);
25463 if(ctx->opc==0) OK(ENC_STP_32_LDSTPAIR_PRE);
25464 if(ctx->opc==2) OK(ENC_STP_64_LDSTPAIR_PRE);
25465 }
25466 /* class iclass_signed_scaled_offset */
25467 /* opc=x0|101|V=0|010|L=0|imm7=xxxxxxx|Rt2=xxxxx|Rn=xxxxx|Rt=xxxxx */
25468 if((INSWORD & 0x7FC00000)==0x29000000) {
25469 decode_fields32(ENC_STP_32_LDSTPAIR_OFF, ctx, instr);
25470 if(ctx->opc==0) OK(ENC_STP_32_LDSTPAIR_OFF);
25471 if(ctx->opc==2) OK(ENC_STP_64_LDSTPAIR_OFF);
25472 }
25473 /* post-decode pcode */
25474 ctx->n = UINT(ctx->Rn);
25475 ctx->t = UINT(ctx->Rt);
25476 ctx->t2 = UINT(ctx->Rt2);
25477 ctx->acctype = ctx->AccType_NORMAL;
25478 ctx->memop = (ctx->L==1) ? MemOp_LOAD : MemOp_STORE;
25479 if(((ctx->L<<1)|SLICE(ctx->opc,0,0))==1 || ctx->opc==3) {
25480 UNDEFINED;
25481 }
25482 ctx->signed_ = (SLICE(ctx->opc,0,0)!=0);
25483 ctx->scale = 2+UINT(SLICE(ctx->opc,1,1));
25484 ctx->datasize = (8) << (ctx->scale);
25485 ctx->offset = LSL(SignExtend(ctx->imm7,7),ctx->scale);
25486 ctx->tag_checked = ctx->wback || ctx->n!=0x1f;
25487 ctx->rt_unknown = FALSE;
25488 ctx->wb_unknown = FALSE;
25489 if(ctx->memop==MemOp_LOAD && ctx->wback && (ctx->t==ctx->n || ctx->t2==ctx->n) && ctx->n!=0x1f) {
25490 ctx->c = ConstrainUnpredictable(Unpredictable_WBOVERLAPLD);
25491 // assert
25492 // switch on constraint
25493 }
25494 if(ctx->memop==MemOp_STORE && ctx->wback && (ctx->t==ctx->n || ctx->t2==ctx->n) && ctx->n!=0x1f) {
25495 ctx->c = ConstrainUnpredictable(Unpredictable_WBOVERLAPST);
25496 // assert
25497 // switch on constraint
25498 }
25499 if(ctx->memop==MemOp_LOAD && ctx->t==ctx->t2) {
25500 ctx->c = ConstrainUnpredictable(Unpredictable_LDPOVERLAP);
25501 // assert
25502 // switch on constraint
25503 }
25504 return rc;
25505}
25506

Callers 3

Calls 3

decode_fields32Function · 0.85
SignExtendFunction · 0.85
ConstrainUnpredictableFunction · 0.85

Tested by

no test coverage detected