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

Function STRH_imm

arch/arm64/disassembler/decode2.c:25655–25731  ·  view source on GitHub ↗

strh_imm.xml */

Source from the content-addressed store, hash-verified

25653
25654/* strh_imm.xml */
25655int STRH_imm(context *ctx, Instruction *instr)
25656{
25657 int rc = DECODE_STATUS_UNMATCHED;
25658 /* class iclass_post_indexed */
25659 /* size=01|111|V=0|00|opc=00|0|imm9=xxxxxxxxx|01|Rn=xxxxx|Rt=xxxxx */
25660 if((INSWORD & 0xFFE00C00)==0x78000400) {
25661 decode_fields32(ENC_STRH_32_LDST_IMMPOST, ctx, instr);
25662 ctx->wback = TRUE;
25663 ctx->postindex = TRUE;
25664 ctx->scale = UINT(ctx->size);
25665 ctx->offset = SignExtend(ctx->imm9,9);
25666 OK(ENC_STRH_32_LDST_IMMPOST);
25667 }
25668 /* class iclass_pre_indexed */
25669 /* size=01|111|V=0|00|opc=00|0|imm9=xxxxxxxxx|11|Rn=xxxxx|Rt=xxxxx */
25670 if((INSWORD & 0xFFE00C00)==0x78000C00) {
25671 decode_fields32(ENC_STRH_32_LDST_IMMPRE, ctx, instr);
25672 ctx->wback = TRUE;
25673 ctx->postindex = FALSE;
25674 ctx->scale = UINT(ctx->size);
25675 ctx->offset = SignExtend(ctx->imm9,9);
25676 OK(ENC_STRH_32_LDST_IMMPRE);
25677 }
25678 /* class iclass_unsigned_scaled_offset */
25679 /* size=01|111|V=0|01|opc=00|imm12=xxxxxxxxxxxx|Rn=xxxxx|Rt=xxxxx */
25680 if((INSWORD & 0xFFC00000)==0x79000000) {
25681 decode_fields32(ENC_STRH_32_LDST_POS, ctx, instr);
25682 ctx->wback = FALSE;
25683 ctx->postindex = FALSE;
25684 ctx->scale = UINT(ctx->size);
25685 ctx->offset = LSL(ZeroExtend(ctx->imm12,0x40),ctx->scale);
25686 OK(ENC_STRH_32_LDST_POS);
25687 }
25688 /* post-decode pcode */
25689 ctx->n = UINT(ctx->Rn);
25690 ctx->t = UINT(ctx->Rt);
25691 ctx->acctype = ctx->AccType_NORMAL;
25692 if(SLICE(ctx->opc,1,1)==0) {
25693 if(SLICE(ctx->opc,0,0)==1) {
25694 ctx->memop = MemOp_LOAD;
25695 };
25696 if(ctx->size==3) {
25697 ctx->regsize = 0x40;
25698 };
25699 ctx->signed_ = FALSE;
25700 }
25701 else {
25702 if(ctx->size==3) {
25703 UNDEFINED;
25704 }
25705 else {
25706 ctx->memop = MemOp_LOAD;
25707 if(ctx->size==2 && SLICE(ctx->opc,0,0)==1) {
25708 UNDEFINED;
25709 }
25710 if(SLICE(ctx->opc,0,0)==1) {
25711 ctx->regsize = 0x20;
25712 };

Callers 3

decode_iclass_ldst_posFunction · 0.85

Calls 2

decode_fields32Function · 0.85
SignExtendFunction · 0.85

Tested by

no test coverage detected