Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

few x86 enhancements #922

Merged
merged 2 commits into from
Feb 18, 2019

Conversation

gitoleg
Copy link
Contributor

@gitoleg gitoleg commented Feb 15, 2019

this PR adds a couple of x86 instructions:

  1. adds endbr instructions
    Despite that we implement these instructions as noop, they still are very important for cfg integrity,
    since they usually appear in the beginning of functions.

  2. adds call instructions with operand override prefix.
    Previously, we were lifting call instructions only if no prefixes present. But x86_disasm does all the
    job needed for prefix comprehension (at least in part of operand overriding).

Few examples:

$ echo "f3 0f 1e fa" | bap-mc --show-bil --show-insn
ENDBR64()
{

}
$ echo "f3 0f 1e fb" | bap-mc --show-bil --show-insn
ENDBR32()
{

}
$ echo "67 e8 00 fe ff ff" | bap-mc --show-bil --show-insn --addr=0x400500
CALL64pcrel32(-0x200)
{
  RSP := RSP - 8
  mem := mem with [RSP, el]:u64 <- 0x400506
  jmp 0x400306
}

fix #901

1) adds `endbr` instructions
   Despite that we implement these instructions as no-op,
   they still are very important for cfg integrity, since
   they usually appear in the begining of functions.

2) adds call instructions with operand override prefix.
   Previously, we were lifting `call` instructions only
   if no prefixes present. But `x86_disasm` does
   all the job needed for prefix comprehension (at least
   in part of operand overriding).
module IA32 = X86_backend.IA32
module AMD64 = X86_backend.AMD64

type endbr = [ `ENDBR32 | `ENDBR64 ] [@@deriving bin_io, sexp, compare, enumerate]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we use special here? :/

added special statement to `endbr` Bil
@ivg
Copy link
Member

ivg commented Feb 18, 2019

you can merge as soon as Travis approves :)

@gitoleg gitoleg merged commit 2ed58c1 into BinaryAnalysisPlatform:master Feb 18, 2019
@gitoleg gitoleg deleted the few-x86-enchancement branch May 13, 2020 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

addr32 callq instruction is dropped
2 participants