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

Function BRA

arch/arm64/disassembler/decode2.c:1604–1652  ·  view source on GitHub ↗

bra.xml */

Source from the content-addressed store, hash-verified

1602
1603/* bra.xml */
1604int BRA(context *ctx, Instruction *instr)
1605{
1606 int rc = DECODE_STATUS_UNMATCHED;
1607 /* class iclass_general */
1608 /* 1101011|Z=x|opc[2:1]=0|op=00|op2=11111|op3[5:2]=0000|A=1|M=x|Rn=xxxxx|Rm=xxxxx */
1609 if((INSWORD & 0xFEFFF800)==0xD61F0800) {
1610 decode_fields32(ENC_BRAAZ_64_BRANCH_REG, ctx, instr);
1611 ctx->n = UINT(ctx->Rn);
1612 ctx->m = UINT(ctx->Rm);
1613 ctx->pac = (ctx->A==1);
1614 ctx->use_key_a = (ctx->M==0);
1615 ctx->source_is_sp = ((ctx->Z==1) && (ctx->m==0x1f));
1616 if(!ctx->pac && ctx->m!=0) {
1617 UNDEFINED;
1618 }
1619 else if(ctx->pac && !HavePACExt()) {
1620 UNDEFINED;
1621 }
1622 if(!ctx->op) {
1623 ctx->branch_type = BranchType_INDIR;
1624 }
1625 else if(ctx->op==1) {
1626 ctx->branch_type = BranchType_INDCALL;
1627 }
1628 else if(ctx->op==2) {
1629 ctx->branch_type = BranchType_RET;
1630 }
1631 else {
1632 UNDEFINED;
1633 }
1634 if(ctx->pac) {
1635 if(ctx->Z==0 && ctx->m!=0x1f) {
1636 UNDEFINED;
1637 }
1638 if(ctx->branch_type==BranchType_RET) {
1639 if(ctx->n!=0x1f) {
1640 UNDEFINED;
1641 }
1642 ctx->n = 0x1e;
1643 ctx->source_is_sp = TRUE;
1644 }
1645 }
1646 if(ctx->Z==0 && ctx->M==0 && ctx->Rm==0x1f) OK(ENC_BRAAZ_64_BRANCH_REG);
1647 if(ctx->Z==1 && ctx->M==0) OK(ENC_BRAA_64P_BRANCH_REG);
1648 if(ctx->Z==0 && ctx->M==1 && ctx->Rm==0x1f) OK(ENC_BRABZ_64_BRANCH_REG);
1649 if(ctx->Z==1 && ctx->M==1) OK(ENC_BRAB_64P_BRANCH_REG);
1650 }
1651 return rc;
1652}
1653
1654/* brk.xml */
1655int BRK(context *ctx, Instruction *instr)

Callers 1

decode_iclass_branch_regFunction · 0.85

Calls 1

decode_fields32Function · 0.85

Tested by

no test coverage detected