Commit Graph

311 Commits

Author SHA1 Message Date
Tristan Ravitch
7d1fa366c2 ppc32: Add IP alignment rules for code discovery
This was stubbed out before. It is basically identical to the ppc64 version,
except with offsets corrected.
2021-08-23 08:35:56 -07:00
Tristan Ravitch
6b712c6280
Fix the default ppc32 ABI (#222)
None of the common default ppc32 ABIs use a Table of Contents (TOC), so default
our code to not assume it either. This has accompanying changes in
macaw-loader-ppc, which also made incorrect assumptions about ppc32.

Note that we may eventually need to support rarely-used ABIs that do use a
TOC (or similar dedicated registers, e.g., the Small Data Area mode). When we
do, we will probably want that to be a data-oriented decision rather than a
type-level one, as each architecture supports multiple ABIs. We may also need to
modify ppc64 to support ABIs without TOCs, but we'll do it when we need to.
2021-08-19 07:41:29 -07:00
Kevin Quick
6cfc78d114
Updates to PPC tests for new elf-edit API. 2020-12-06 10:53:36 -08:00
Brian Huffman
2a620d41de Switch from ansi-wl-pprint to the prettyprinter package.
This patch relies on the following submodule updates:
- GaloisInc/what4#77
- GaloisInc/elf-edit#20
- GaloisInc/crucible#586
- GaloisInc/asl-translator#28

This patch updates the following packages:
- macaw-base
- macaw-symbolic
- macaw-x86
- macaw-x86-symbolic
- macaw-aarch32
- macaw-ppc
- macaw-semmc
- macaw-refinement
2020-12-02 11:38:19 -08:00
Daniel Matichuk
3765c5eaab remove 'constraints' dependency 2020-10-06 11:20:40 -07:00
Daniel Matichuk
44c2536f30 add default arch type override for ppc 2020-07-28 11:57:07 -07:00
Ben Selfridge
039b8497fc
updates what4, crucible, etc. (#146)
* update to bv-sized branch of what4 and other things

* removed parameterized-utils submodule completely

* Updates submodules

* Fixes macaw-symbolic w.r.t. crucible-llvm changes

Co-authored-by: Ben Selfridge <ben@000548-benselfridge.local>
2020-06-16 16:49:55 -07:00
Tristan Ravitch
89fc5a73f7
Tr/full arm intrinsics (#137)
Improve the TH codegen for macaw-semmc

This change lazily translates as much as possible.  It also generates somewhat more compact code. This change also finishes implementing primitives for the aarch32 backend.  Complementing the aarch32 changes, the macaw-semmc interface has been modified to allow macaw-aarch32 to avoid a redundant serialize-deserialize round.

Co-authored-by: Kevin Quick <kquick@galois.com>
2020-05-26 09:24:45 -07:00
Tristan Ravitch
e7cff66577
Fix a failure case in the macaw-ppc disassembler logic (#140)
This code was confusing what "offset" to pass to the `failAt` function.  Some
sites were passing the offset from the beginning of the block (correct), while
others passed the offset from the start of the segment (incorrect).  The
incorrect values were later used as block sizes, which caused some downstream
failures (in renovate).

This commit uniformly fails with the offset from the start of the block.
2020-05-20 23:36:53 -07:00
Kevin Quick
fb86f7acae
[macaw-ppc] Update test expectations for number of discovered blocks.
This change is probably due to the BitTrie modifications in
dismantle-tablegen.  It's not clear whether the older or newer number
of discovered blocks is correct; testing at this point is focused more
on getting roughly the correct order of magnitude rather than being
refined enough for high precision values.
2020-05-13 21:29:57 -07:00
Tristan Ravitch
02c2fcd96a
Clean up the PowerPC architecture specifications (#130)
This commit reduces duplication in the PowerPC backend.  Instances are now in terms of the generic `AnyPPC` type, rather than having separate instances for 32 and 64 bit.  Shuffling some type parameters also allows us to remove a large number of type equalities that e.g., fix the arch register type to `PPCReg`.
2020-04-19 11:56:42 -07:00
Tristan Ravitch
a824fc4051
Tr/warning cleanups (#127)
Warning and style cleanups in macaw-semmc and macaw-aarch32
2020-04-14 00:07:15 -07:00
Tristan Ravitch
cbe4a9f0c0 Fix the macaw-ppc build 2020-04-08 20:19:33 -07:00
Tristan Ravitch
a5977918ac Merge remote-tracking branch 'origin/wip/equiv' into feature/asl 2020-04-06 23:16:15 -07:00
Tristan Ravitch
58150e91b5 Update macaw-ppc to the macaw-semmc endianness parameterization 2020-04-05 14:44:53 -07:00
Daniel Wagner
95dd08bce9 Merge branch 'master' into wip/equiv 2020-02-04 12:21:51 -05:00
Tristan Ravitch
e3aaf47a50
Tr/update submodules (#105)
The main change here is in macaw-semmc to account for a change to the BVOrBits
operation in Crucible.
2020-01-25 12:25:38 -08:00
Tristan Ravitch
d119a9ed5a
Update submodules (#104)
The main change here is in macaw-semmc to account for a change to the BVOrBits
operation in Crucible.
2020-01-17 16:17:30 -08:00
Daniel Wagner
c22f140a3b Merge branch 'tr/new-macaw-symbolic-entry' into wip/equiv 2020-01-13 22:21:51 -05:00
Tristan Ravitch
b44e8c480f Update the semmc submodule
This brings it up to master.  The submodule has some improvements to synthesis,
but they changed some APIs.
2019-11-21 20:42:05 -08:00
Tristan Ravitch
9e9eb1b770 Fix macaw-ppc compilation
Fixes #80, which removed a type parameter from `IntraJumpBounds`
2019-11-19 17:28:40 -08:00
Tristan Ravitch
4c7a69b11d Update macaw-ppc to account for recent changes in macaw-base
The main changes are:

- `postCallAbsState` was removed from the architecture info
- `mkInitialRegsForBlock` was renamed to `initialBlockRegs` and takes slightly
  different parameters
- There is a new type family and some new functions in the architecture info
  relating to post-block/terminator abstract state construction

PowerPC doesn't need any extra information to compute post-block abstract
states, so we use () as the ArchBlockPrecond type.
2019-11-12 17:27:14 -08:00
Daniel Wagner
10a1fbc24a misc. build fixes 2019-10-17 16:38:16 -04:00
Daniel Wagner
5f15b14136 Merge branch 'master' into wip/equiv 2019-10-01 14:40:52 -04:00
Joe Hendrix
494aff6ff0
This makes a number of changes to abstract domains.
The goal is to support a jumptable testcase that is not supported by
the current jump bounds check.  The jump bounds check needs to be
augmented so that it understands equality relationships between stack
values and registers, and bounds on both.

This patch tracks when a register points to a concrete stack offset.

As part of this, we droped the AbsDomain instance for AbsBlockState.
Clients should now likely use `fnStartAbsBlockState` in lieu of `top`.

The other client visible change is that the ClassifyFailure
constructor now has an extra argument with details about why
classification failure occured.
2019-08-21 23:29:16 -07:00
Tristan Ravitch
06f64078df
Wip/ppc no block labels (#66)
Update to API changes in macaw-base in macaw-ppc and macaw-arm

The "block label" abstraction (used during arch-specific disassembly) was removed some time ago in the base macaw library.  This change updates macaw-ppc and macaw-arm to remove uses of block labels.  The major change is that the disassembly function only returns a single block at a time instead of a sequence of blocks.

To facilitate this, the handling of the PowerPC conditional trap instruction (trap doubleword) is now an architecture-specific terminator instruction instead of encoding the logic of conditional trapping.  We will now have to encode the conditional trapping logic in macaw-ppc-symbolic.  Note that we have not done so yet.

This commit also updates the expected results of the PowerPC tests; the number of discovered blocks is different, but not significantly so.  It is hard to tell if this is a regression or an improvement.
2019-08-09 16:11:59 -07:00
Kevin Quick
fb31de230f
Merge branch 'master' into semiring_upd 2019-07-19 13:17:09 -07:00
Daniel Wagner
1dae825c73 DRY 2019-07-17 15:08:57 -04:00
Kevin Quick
6f76e4bef2
[macaw-ppc] Add test to check the number of blocks found for gzip.
Verifies that the number of blocks found matches what should generally
be expected from this particular executable.

The specific value checked for is not independently verified, it just
happens to be a reasonable-looking value that the discovery process
currently identifies, and encoding it here ensures that if discovery
ever changes that the change will be seen and explicitly accepted or
fixed as needed.
2019-07-11 14:25:13 -07:00
Kevin Quick
f525351621
Handle conversions for Float Mux in macaw-ppc. 2019-07-11 13:55:01 -07:00
Kevin Quick
a89ca13413
[macaw-ppc] Update for semiring changes in What4 Exprs. 2019-07-11 11:24:23 -07:00
Joe Hendrix
fbb3b300ce
Prep work to get building with warning as errors. 2019-03-25 14:39:33 -07:00
Luke Maurer
68ae66bff5 NatRepr changes 2019-02-13 14:21:48 -08:00
Kevin Quick
0f97a86c3e
Added missing pretty-printer import. 2019-02-08 17:29:03 -08:00
Kevin Quick
9f46c9e60b Merge branch 'master' of github.com:GaloisInc/macaw-semmc 2019-02-08 14:37:54 -08:00
Luke Maurer
8d3c501fd0 Coerce PPCTermStmts rather than returning new ones when rewriting
This was eating up a surprising amount of heap space.
2019-01-28 14:48:25 -08:00
Kevin Quick
4e32007436
[ppc] Use pretty representation for IP in error messages. 2019-01-22 23:17:24 -08:00
Tristan Ravitch
7e573101b4 Finish porting macaw-ppc to use the unified PPC architecture tag 2019-01-08 13:27:40 -08:00
Tristan Ravitch
be3bc845f9 Change an 'undefined' to a more informative error 2019-01-08 11:22:55 -08:00
Luke Maurer
dbce1b1265 Refactor to use AnyPPC 2018-12-21 11:47:40 -08:00
Luke Maurer
b5a75832a3 Adapt to and re-export new AnyPPC arch constructor 2018-12-20 16:43:46 -08:00
Kevin Quick
294299a8eb
[macaw-ppc] ArchitecturInfo updates: mkInitialRegsForBlock, checkForReturnAddr. 2018-12-13 22:48:26 -08:00
Daniel Wagner
718467815b fix GaloisInc/semmc/issues/15
We now thread a snapshot of the register state from the beginning of the
instruction evaluation through each instruction's semantics instead of
re-fetching register values each time we need it and potentially seeing
incorrect, partially modified register values.
2018-12-03 17:34:18 -05:00
Tristan Ravitch
72040c023d Fix handling of InstructionStart
The field it contains is supposed to be the instruction offset in its basic
block; overflowing it can cause significant problems during symbolic simulation.
2018-11-28 20:26:58 -08:00
Tristan Ravitch
30b5d2e091 Update macaw-arm and macaw-ppc to emit extra metadata
There is a new metadata statement that tracks the start address of each
instruction.  This is used in the translation to Crucible to provide better
error messages.  The x86 backend was already updated, this commit adds the
metadata to the ARM and PowerPC backends.
2018-11-28 10:22:25 -08:00
Tristan Ravitch
ff79eba6aa ppc: Use the new HasTOC class
This avoids a hard dependency on the exact format of ArchBinaryData for PowerPC
2018-10-30 11:01:46 -07:00
Tristan Ravitch
ebcbbe6c5c Remove the BinaryAddrWidth type family 2018-10-30 10:34:56 -07:00
Kevin Quick
d464403a25
Update tests from deprecated relativeSegmentAddr to segoffAddr. 2018-10-29 15:55:41 -07:00
Kevin Quick
730f855c71
Update to use macaw-loader for uniform binary loading. 2018-10-29 15:51:42 -07:00
Tristan Ravitch
ee58037c2d Make the powerpc tests more verbose when encountering a translation error 2018-10-24 10:26:55 -07:00