lifting-bits / remill

Library for lifting machine code to LLVM bitcode
Apache License 2.0
1.22k stars 142 forks source link

Remill does not recognize `adcs` #649

Open aqjune opened 1 year ago

aqjune commented 1 year ago

Hello all, It seems Remill cannot lift the adcs instruction in ARMv8. I tested HEX code 0e020cba : https://armconverter.com/?disasm&code=0e020cba&offset=400544

I attach the bash command that I used:

 docker run --rm -it remill \
      --arch aarch64 --address 0x400544 --ir_out /dev/stdout \
      -bytes 0e020cba
hxm-cpp commented 1 year ago

you can implement it by yourself, here is how its semantic should looks like :


void SemanticAdcs(Context &ctx) {
  auto &state = ctx.NewState();
  auto &alu = state.alu;
  alu.result = state.regs[0].W() + state.regs[1].W() + alu.carry;
  alu.flags.C = (alu.result < state.regs[0].W());
  alu.flags.Z = (alu.result == 0);
  alu.flags.S = (alu.result & 0x80000000);
  alu.flags.O = (((state.regs[0].W() ^ state.regs[1].W()) & (state.regs[0].W() ^ alu.result)) & 0x80000000);
}