Skip to content

Commit

Permalink
add fix for hint 127
Browse files Browse the repository at this point in the history
  • Loading branch information
blacktop committed Aug 21, 2021
1 parent 85e1e96 commit f915c6d
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 56 deletions.
19 changes: 15 additions & 4 deletions disassemble/decode.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include "decode.h"
#include "feature_flags.h"

int decode_spec(context *ctx, Instruction *dec); // from decode0.cpp
int decode_spec(context *ctx, Instruction *dec); // from decode0.cpp
int decode_scratchpad(context *ctx, Instruction *dec); // from decode_scratchpad.c

int aarch64_decompose(uint32_t instructionValue, Instruction *instr, uint64_t address)
{
context ctx = { 0 };
context ctx = {0};
ctx.halted = 1; // enable disassembly of exception instructions like DCPS1
ctx.insword = instructionValue;
ctx.address = address;
Expand All @@ -16,8 +16,19 @@ int aarch64_decompose(uint32_t instructionValue, Instruction *instr, uint64_t ad

/* have the spec-generated code populate all the pcode variables */
int rc = decode_spec(&ctx, instr);
if(rc != DECODE_STATUS_OK)
return rc;

if (rc != DECODE_STATUS_OK)
{
/* exceptional cases where we accept a non-OK decode status */
if (rc == DECODE_STATUS_END_OF_INSTRUCTION && instr->encoding == ENC_HINT_HM_HINTS)
{
while (0)
;
}
/* no exception! fail! */
else
return rc;
}

/* if UDF encoding, return undefined */
//if(instr->encoding == ENC_UDF_ONLY_PERM_UNDEF)
Expand Down
1 change: 1 addition & 0 deletions disassemble/decode1.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ int decode_iclass_hints(context *ctx, Instruction *dec)
if(CRm==3 && op2==6 && HasPAuth()) return AUTIB(ctx, dec); // -> AUTIBZ_HI_hints
if(CRm==3 && op2==7 && HasPAuth()) return AUTIB(ctx, dec); // -> AUTIBSP_HI_hints
if(CRm==4 && !(op2&1) && HasBTI()) return BTI(ctx, dec); // -> BTI_HB_hints
if(1) return HINT(ctx, dec); // -> HINT_HM_hints
UNMATCHED;
}

Expand Down
Loading

0 comments on commit f915c6d

Please sign in to comment.