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

Function BLRA

arch/arm64/disassembler/decode2.c:1505–1553  ·  view source on GitHub ↗

blra.xml */

Source from the content-addressed store, hash-verified

1503
1504/* blra.xml */
1505int BLRA(context *ctx, Instruction *instr)
1506{
1507 int rc = DECODE_STATUS_UNMATCHED;
1508 /* class iclass_general */
1509 /* 1101011|Z=x|opc[2:1]=0|op=01|op2=11111|op3[5:2]=0000|A=1|M=x|Rn=xxxxx|Rm=xxxxx */
1510 if((INSWORD & 0xFEFFF800)==0xD63F0800) {
1511 decode_fields32(ENC_BLRAAZ_64_BRANCH_REG, ctx, instr);
1512 ctx->n = UINT(ctx->Rn);
1513 ctx->m = UINT(ctx->Rm);
1514 ctx->pac = (ctx->A==1);
1515 ctx->use_key_a = (ctx->M==0);
1516 ctx->source_is_sp = ((ctx->Z==1) && (ctx->m==0x1f));
1517 if(!ctx->pac && ctx->m!=0) {
1518 UNDEFINED;
1519 }
1520 else if(ctx->pac && !HavePACExt()) {
1521 UNDEFINED;
1522 }
1523 if(!ctx->op) {
1524 ctx->branch_type = BranchType_INDIR;
1525 }
1526 else if(ctx->op==1) {
1527 ctx->branch_type = BranchType_INDCALL;
1528 }
1529 else if(ctx->op==2) {
1530 ctx->branch_type = BranchType_RET;
1531 }
1532 else {
1533 UNDEFINED;
1534 }
1535 if(ctx->pac) {
1536 if(ctx->Z==0 && ctx->m!=0x1f) {
1537 UNDEFINED;
1538 }
1539 if(ctx->branch_type==BranchType_RET) {
1540 if(ctx->n!=0x1f) {
1541 UNDEFINED;
1542 }
1543 ctx->n = 0x1e;
1544 ctx->source_is_sp = TRUE;
1545 }
1546 }
1547 if(ctx->Z==0 && ctx->M==0 && ctx->Rm==0x1f) OK(ENC_BLRAAZ_64_BRANCH_REG);
1548 if(ctx->Z==1 && ctx->M==0) OK(ENC_BLRAA_64P_BRANCH_REG);
1549 if(ctx->Z==0 && ctx->M==1 && ctx->Rm==0x1f) OK(ENC_BLRABZ_64_BRANCH_REG);
1550 if(ctx->Z==1 && ctx->M==1) OK(ENC_BLRAB_64P_BRANCH_REG);
1551 }
1552 return rc;
1553}
1554
1555/* br.xml */
1556int BR(context *ctx, Instruction *instr)

Callers 1

decode_iclass_branch_regFunction · 0.85

Calls 1

decode_fields32Function · 0.85

Tested by

no test coverage detected