macaw/macaw-aarch32/tests
Tristan Ravitch 37861df8c7
Support for mixed ARM/Thumb binaries (#174)
aarch32: Support mixed ARM/Thumb1 binaries

This updates the aarch32 backend to decode Thumb instructions and generate the Thumb semantics. The major implementation change is to use the `ArchBlockPrecond` feature of macaw to track the Thumb state (`PSTATE_T`) across block boundaries.

The ARM code discovery decides whether or not a function entry point should be decoded as Thumb by examining the low bit of the function address. If the low bit is set, it is a Thumb entry point. This has the slightly odd effect of causing macaw to say that the function is at the address with the low bit set, which is not technically true. This is documented in the README, but not obvious on inspection. Most use cases should not care, and can in any case account for it. In the future, it should be possible to fix this (though it will require some changes to the core of macaw).
2020-11-02 12:48:01 -08:00
..
arm Support for mixed ARM/Thumb binaries (#174) 2020-11-02 12:48:01 -08:00
ARMTests.hs Make tests less chatty 2020-04-08 19:57:26 -07:00
MismatchTests.hs Rename macaw-asl to macaw-aarch32 2020-04-05 15:16:39 -07:00
README.md Support for mixed ARM/Thumb binaries (#174) 2020-11-02 12:48:01 -08:00
Shared.hs Rename macaw-asl to macaw-aarch32 2020-04-05 15:16:39 -07:00
TestMain.hs Rename macaw-asl to macaw-aarch32 2020-04-05 15:16:39 -07:00

Overview

The tests in this directory attempt to test both ARM and Thumb decoding/discovery. The test suite only runs on the binaries with corresponding .mcw.expected files, which describe the expected discovered basic blocks.

  • test-just-exit-a32.exe: Ensures that the very basics of anything at all works
  • test-conditional-a32.exe: Ensures that conditional branches in A32 mode are handled correctly
  • test-direct-call-a32.exe: Ensures that call and return sequences work in A32 mode
  • test-direct-call-t32.exe: Ensures that transitions (via call) to Thumb mode work correctly
  • test-conditional-mixed.exe: Ensures that multi-block Thumb functions are handled correctly
  • test-just-exit-t32.exe: Ensures that Thumb entry points work correctly

Notes

The test-just-exit-t32.exe test is interesting because executables with Thumb entry points have the low bit set (even though it isn't technically the address where the function starts - it happens to work because the ISA clears the bit before jumping). We want to make sure that macaw handles it correctly.