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

Function LDP_gen

arch/arm64/disassembler/decode2.c:14251–14307  ·  view source on GitHub ↗

ldp_gen.xml */

Source from the content-addressed store, hash-verified

14249
14250/* ldp_gen.xml */
14251int LDP_gen(context *ctx, Instruction *instr)
14252{
14253 int rc = DECODE_STATUS_UNMATCHED;
14254 /* class iclass_post_indexed */
14255 /* opc=x0|101|V=0|001|L=1|imm7=xxxxxxx|Rt2=xxxxx|Rn=xxxxx|Rt=xxxxx */
14256 if((INSWORD & 0x7FC00000)==0x28C00000) {
14257 decode_fields32(ENC_LDP_32_LDSTPAIR_POST, ctx, instr);
14258 if(ctx->opc==0) OK(ENC_LDP_32_LDSTPAIR_POST);
14259 if(ctx->opc==2) OK(ENC_LDP_64_LDSTPAIR_POST);
14260 }
14261 /* class iclass_pre_indexed */
14262 /* opc=x0|101|V=0|011|L=1|imm7=xxxxxxx|Rt2=xxxxx|Rn=xxxxx|Rt=xxxxx */
14263 if((INSWORD & 0x7FC00000)==0x29C00000) {
14264 decode_fields32(ENC_LDP_32_LDSTPAIR_PRE, ctx, instr);
14265 if(ctx->opc==0) OK(ENC_LDP_32_LDSTPAIR_PRE);
14266 if(ctx->opc==2) OK(ENC_LDP_64_LDSTPAIR_PRE);
14267 }
14268 /* class iclass_signed_scaled_offset */
14269 /* opc=x0|101|V=0|010|L=1|imm7=xxxxxxx|Rt2=xxxxx|Rn=xxxxx|Rt=xxxxx */
14270 if((INSWORD & 0x7FC00000)==0x29400000) {
14271 decode_fields32(ENC_LDP_32_LDSTPAIR_OFF, ctx, instr);
14272 if(ctx->opc==0) OK(ENC_LDP_32_LDSTPAIR_OFF);
14273 if(ctx->opc==2) OK(ENC_LDP_64_LDSTPAIR_OFF);
14274 }
14275 /* post-decode pcode */
14276 ctx->n = UINT(ctx->Rn);
14277 ctx->t = UINT(ctx->Rt);
14278 ctx->t2 = UINT(ctx->Rt2);
14279 ctx->acctype = ctx->AccType_NORMAL;
14280 ctx->memop = (ctx->L==1) ? MemOp_LOAD : MemOp_STORE;
14281 if(((ctx->L<<1)|SLICE(ctx->opc,0,0))==1 || ctx->opc==3) {
14282 UNDEFINED;
14283 }
14284 ctx->signed_ = (SLICE(ctx->opc,0,0)!=0);
14285 ctx->scale = 2+UINT(SLICE(ctx->opc,1,1));
14286 ctx->datasize = (8) << (ctx->scale);
14287 ctx->offset = LSL(SignExtend(ctx->imm7,7),ctx->scale);
14288 ctx->tag_checked = ctx->wback || ctx->n!=0x1f;
14289 ctx->rt_unknown = FALSE;
14290 ctx->wb_unknown = FALSE;
14291 if(ctx->memop==MemOp_LOAD && ctx->wback && (ctx->t==ctx->n || ctx->t2==ctx->n) && ctx->n!=0x1f) {
14292 ctx->c = ConstrainUnpredictable(Unpredictable_WBOVERLAPLD);
14293 // assert
14294 // switch on constraint
14295 }
14296 if(ctx->memop==MemOp_STORE && ctx->wback && (ctx->t==ctx->n || ctx->t2==ctx->n) && ctx->n!=0x1f) {
14297 ctx->c = ConstrainUnpredictable(Unpredictable_WBOVERLAPST);
14298 // assert
14299 // switch on constraint
14300 }
14301 if(ctx->memop==MemOp_LOAD && ctx->t==ctx->t2) {
14302 ctx->c = ConstrainUnpredictable(Unpredictable_LDPOVERLAP);
14303 // assert
14304 // switch on constraint
14305 }
14306 return rc;
14307}
14308

Callers 3

Calls 3

decode_fields32Function · 0.85
SignExtendFunction · 0.85
ConstrainUnpredictableFunction · 0.85

Tested by

no test coverage detected