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

Function LDRH_imm

arch/arm64/disassembler/decode2.c:14484–14560  ·  view source on GitHub ↗

ldrh_imm.xml */

Source from the content-addressed store, hash-verified

14482
14483/* ldrh_imm.xml */
14484int LDRH_imm(context *ctx, Instruction *instr)
14485{
14486 int rc = DECODE_STATUS_UNMATCHED;
14487 /* class iclass_post_indexed */
14488 /* size=01|111|V=0|00|opc=01|0|imm9=xxxxxxxxx|01|Rn=xxxxx|Rt=xxxxx */
14489 if((INSWORD & 0xFFE00C00)==0x78400400) {
14490 decode_fields32(ENC_LDRH_32_LDST_IMMPOST, ctx, instr);
14491 ctx->wback = TRUE;
14492 ctx->postindex = TRUE;
14493 ctx->scale = UINT(ctx->size);
14494 ctx->offset = SignExtend(ctx->imm9,9);
14495 OK(ENC_LDRH_32_LDST_IMMPOST);
14496 }
14497 /* class iclass_pre_indexed */
14498 /* size=01|111|V=0|00|opc=01|0|imm9=xxxxxxxxx|11|Rn=xxxxx|Rt=xxxxx */
14499 if((INSWORD & 0xFFE00C00)==0x78400C00) {
14500 decode_fields32(ENC_LDRH_32_LDST_IMMPRE, ctx, instr);
14501 ctx->wback = TRUE;
14502 ctx->postindex = FALSE;
14503 ctx->scale = UINT(ctx->size);
14504 ctx->offset = SignExtend(ctx->imm9,9);
14505 OK(ENC_LDRH_32_LDST_IMMPRE);
14506 }
14507 /* class iclass_unsigned_scaled_offset */
14508 /* size=01|111|V=0|01|opc=01|imm12=xxxxxxxxxxxx|Rn=xxxxx|Rt=xxxxx */
14509 if((INSWORD & 0xFFC00000)==0x79400000) {
14510 decode_fields32(ENC_LDRH_32_LDST_POS, ctx, instr);
14511 ctx->wback = FALSE;
14512 ctx->postindex = FALSE;
14513 ctx->scale = UINT(ctx->size);
14514 ctx->offset = LSL(ZeroExtend(ctx->imm12,0x40),ctx->scale);
14515 OK(ENC_LDRH_32_LDST_POS);
14516 }
14517 /* post-decode pcode */
14518 ctx->n = UINT(ctx->Rn);
14519 ctx->t = UINT(ctx->Rt);
14520 ctx->acctype = ctx->AccType_NORMAL;
14521 if(SLICE(ctx->opc,1,1)==0) {
14522 if(SLICE(ctx->opc,0,0)==1) {
14523 ctx->memop = MemOp_LOAD;
14524 };
14525 if(ctx->size==3) {
14526 ctx->regsize = 0x40;
14527 };
14528 ctx->signed_ = FALSE;
14529 }
14530 else {
14531 if(ctx->size==3) {
14532 UNDEFINED;
14533 }
14534 else {
14535 ctx->memop = MemOp_LOAD;
14536 if(ctx->size==2 && SLICE(ctx->opc,0,0)==1) {
14537 UNDEFINED;
14538 }
14539 if(SLICE(ctx->opc,0,0)==1) {
14540 ctx->regsize = 0x20;
14541 };

Callers 3

decode_iclass_ldst_posFunction · 0.85

Calls 2

decode_fields32Function · 0.85
SignExtendFunction · 0.85

Tested by

no test coverage detected