Commit Graph

425 Commits

Author SHA1 Message Date
Tristan Ravitch
76eb501d45 ppc: Improve the register pretty printer 2018-03-29 18:07:25 -07:00
Tristan Ravitch
f959773cbd Emit the new 'ArchState' macaw statement
This change is in the core generator monad and applied in the PowerPC backend.
This change includes some macaw updates (which required a new elf-edit version).
2018-03-29 18:06:26 -07:00
Tristan Ravitch
ebd52aa11c Remove some unused imports 2018-03-29 11:18:56 -07:00
Tristan Ravitch
13c202f966 Add a comment to setRegVal 2018-03-29 10:01:06 -07:00
Tristan Ravitch
1ebf0cabb7 Submodule updates
These updates include a new version of cabal required to build macaw-symbolic.
macaw-symbolic is also now added to the cabal.project file.
2018-03-29 09:57:17 -07:00
Tristan Ravitch
d00e1fc7c9 Update the macaw submodule 2018-03-28 17:00:57 -07:00
Tristan Ravitch
43babd43cf Add macaw-x86 to the cabal.project file 2018-03-28 17:00:38 -07:00
Tristan Ravitch
716092eef1 ppc: Improve the test suite
Now test to ensure that no blocks end in a classification failure (or a
disassembly failure).  Before, many blocks were not classified, which causes
problems downstream.  This required some changes in macaw core in two places:

1. The simplifier needed some additional rules to remove some redundant
   constructions that threw off the abstract interpretation of values.  This was
   particularly an issue while reading return values off of the stack in
   PowerPC.
2. Extending the abstract interpretation to be able to handle more operations (shiftl)
2018-03-28 16:59:12 -07:00
Tristan Ravitch
fdb00dec14 ppc: Initialize the stack pointer in the abstract state
PPC uses r1 for the stack pointer
2018-03-28 16:59:12 -07:00
Tristan Ravitch
d885de3a72 ppc: Implement identifyReturn
We need special treatment of the return, as the low two bits are cleared on
PowerPC, so we can't just rely on pattern matching against the ReturnAddr in the
IP register.
2018-03-28 16:59:12 -07:00
Tristan Ravitch
d3a97edb4b ppc: Implement identifyReturn 2018-03-27 18:19:36 -07:00
Kevin Quick
19abbf8620
Update macaw submodule reference. 2018-03-27 10:58:27 -07:00
Kevin Quick
c3f2d13092
[arm] Implement identifyReturn (not properly functional).
The Macaw Discovery now calls the identifyReturn to identify return
statements.  Supply this for ARM, but at present this simply
replicates the original inline code which does not properly detect ARM
return operations because the low bit(s) of the address are always
cleared when writing to the instruction pointer in ARM.
2018-03-27 10:52:50 -07:00
Kevin Quick
7d7656bbd7
[ppc] Replace deprecated asLiteralAddr with valueAsMemAddr. 2018-03-27 10:51:16 -07:00
Kevin Quick
5ec4b48e16
[ppc] Update identifyReturn to identify based on IP == LNK
The identifyReturn was previously unused because the Macaw Discovery
performed this test inline, but some architectures have different
semantics so the identifyReturn is now used by the Discovery process.
This implements the return discovery that should be sufficient for the
PPC.
2018-03-27 10:49:30 -07:00
Kevin Quick
74bd4e2e93 Merge branch 'master' of https://gitlab-ext.galois.com/macaw/macaw-semmc 2018-03-26 16:06:43 -07:00
Kevin Quick
9e0c325400
[arm] Fail disassembly if readInstruction returns 0 bytes consumed
Without this check this condition could cause the disassembly to
recurse until all system memory is exhausted.
2018-03-26 16:05:34 -07:00
Kevin Quick
80886bd73d
[arm] Add support for Thumb THINT uninterpreted function. 2018-03-26 16:04:34 -07:00
Tristan Ravitch
2d54ca1362 ppc: Fix some expected test output
Recent changes in macaw(-base) mean that we split blocks more aggressively.  The
old expected outputs were conservative - these new values are much more in line
with intuitive expectation (with more aggressive splitting of blocks and less
code duplication between blocks).
2018-03-23 15:14:54 -07:00
Kevin Quick
0e36353f63 Update dismantle submodule reference. 2018-03-15 17:41:28 -07:00
Kevin Quick
0069d3c907
[arm] Add ExtractValue for Maybe of Thumb LowGPR operand. 2018-03-11 10:54:33 -07:00
Kevin Quick
7d12033f0c Merge branch 'master' of https://gitlab-ext.galois.com/macaw/macaw-semmc 2018-03-11 10:54:24 -07:00
Kevin Quick
0942725e07 Update semmc submodule reference. 2018-03-11 10:54:10 -07:00
Kevin Quick
24991edd70 Merge branch 'master' of https://gitlab-ext.galois.com/macaw/macaw-semmc 2018-03-11 10:35:03 -07:00
Kevin Quick
b0205af9ff
[arm] Added ExtractValue for Thumb AddrModeIs4 operand. 2018-03-11 10:34:44 -07:00
Kevin Quick
99a8959b04 Update dismantle and semmc submodule references. 2018-03-11 10:31:36 -07:00
Kevin Quick
c50f01efef
[arm] Added test exe and results for test-just-exit-t32. 2018-03-10 21:55:29 -08:00
Kevin Quick
5e72398ef2
[arm] Add support for the Thumb Reglist operand. 2018-03-10 10:05:52 -08:00
Kevin Quick
0c67eddda8
Unsupported functions (nonceAppEval) should error immediately.
Original version was pushing error into generated TH, which was
generating the error statement into the SSA formula; this breaks
formula interpretation at compile time but hides the error.  Instead,
this changes it so that the error is thrown during TH evaluation.
2018-03-10 10:04:03 -08:00
Kevin Quick
1bceb8dc32
[arm] Update for change in export of numGPR from semmc-ppc. 2018-03-10 10:03:01 -08:00
Kevin Quick
86defa921b Merge branch 'THGenWrapper' 2018-03-07 14:50:42 -08:00
Kevin Quick
491c302bfb
[arm] Add support for ARM Thumb TImm01020S4 operand. 2018-03-07 14:48:34 -08:00
Kevin Quick
fc02db5664
Update semmc submodule reference. 2018-03-07 14:46:45 -08:00
Kevin Quick
ca2c54a98f [arm] Simplification of instruction decode selection wrapping. 2018-03-07 10:19:55 -08:00
Kevin Quick
af590fc7db
[arm] Add support for imm5 operand type. 2018-03-07 10:07:51 -08:00
Kevin Quick
cf9b6c5a30
[arm] Updated disassemble operation to support A32 or T32 block disassembly. 2018-03-07 10:06:29 -08:00
Kevin Quick
acb8812d68
[arm] Fix non-semantics instruction matcher to return Nothing when unrecognized. 2018-03-07 00:42:01 -08:00
Kevin Quick
54f87526e7
[arm] Update test LoadOptions for new loadRegionBaseOffset parameter. 2018-03-07 00:40:40 -08:00
Kevin Quick
1e85a15146
[arm] Add operands and genExecInstruction support for Thumb. 2018-03-07 00:36:22 -08:00
Kevin Quick
c3d89976e6
[arm] Update Operand eval to clarify A32 and for GPR number abstraction. 2018-03-07 00:32:17 -08:00
Kevin Quick
9f66c7a773
[arm] Update A32 instruction generation for new type args. 2018-03-07 00:30:15 -08:00
Kevin Quick
97a5902408
[arm] Add appEval for URem since it is not handled directly by Macaw base. 2018-03-07 00:27:51 -08:00
Kevin Quick
40b13f63b3
[arm] Define ARM_GP as standalone instead of in terms of A32 GPR.
Removes a dependency of the general Macaw semantics on the underlying
A32 dismantle/semmc representation.
2018-03-05 16:10:54 -08:00
Kevin Quick
a3fe4a0f6b
Modify genExecInstruction to use functions for opcode semantics bodies.
Pass operand and architecture types and instead of

   case opcode of
      ADD -> case operands of
               Just GPR gpr0 :< Nil of ->
                   SSA-semantics

Generate:

    let opc_ADD operands = case operands of
                             Just GPR gpr0 :< Nil of ->
                                SSA-semantics
    in case opcode of
         ADD -> opc_ADD operand

This provides better encapsulation for the individual operands and
more specific control over the types (at the cost of a pair of
additional type specifications in the call).  This also seems to
reduce memory consumption by about half.
2018-03-05 16:02:17 -08:00
Kevin Quick
334b799dd8
Update dismantle submodule reference. 2018-03-05 15:13:55 -08:00
Kevin Quick
b6816799ad
Update s-cargot and s-cargot-letbind submodule versions (0.1.4.0, 0.2.2.0). 2018-03-05 14:05:39 -08:00
Kevin Quick
ce8ebff929 Switch back to main s-cargot package: pretty-printing is now fast. 2018-03-05 13:36:53 -08:00
Tristan Ravitch
66caf33944 ppc: Submodule update for two new instructions 2018-03-01 17:59:57 -08:00
Tristan Ravitch
14c2740c9f Update semmc submodule for ppc instructions 2018-03-01 17:40:38 -08:00
Tristan Ravitch
3a2b5ac3f2 Remove the case for BVURem
We don't have a constructor for this in macaw (it has to be an arch-specific function)
2018-03-01 14:48:14 -08:00