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

Fix QEMU Plugin and add Instruction Address and Size Data; Make Branch Predictor Model Command-Line Parameter #37

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

andrej
Copy link
Collaborator

@andrej andrej commented Jan 12, 2025

  • Remove potentially failing assertion on instruction size, as moving to x86_64, we now have variable-width instruction encoding and the size of an MCInst may not be known a priori
  • To address previous issue, add new metadata field for instruction size, pulled directly from the input source; that way we know the instruction size is accurate
  • Add missing extern TypeId declarations to QEMU plugin; without those, I got any_cast assertion errors between the shared library and the main executable (see this discussion I started a while ago on the LLVM forum)
  • Make branch predictor unit model selectable on the command line: None, Naive or Skylake
  • Print some statistics on branch predictions at the end

With these changes, I'm now able to run a hello world program via QEMU through MCAD. I had to disable the instruction cache modeling (-enable-cache=false on the command line) to make this work, or it didn't seem to terminate (maybe the cache model is very slow?)

Interestingly, there seem to be many more branch mispredictions in this hello world example. Maybe it will be worth it to look into some more benchmarking of this after all.

The changes to the vivisect plugin with the new instruction size field should work, but I haven't tested them yet since we're probably not super interested in it any more now that we have QEMU.

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.

1 participant