Tristan Ravitch
0513ae7a39
x86: Add some more missing signed immediate handling cases in getAddrRegSegmentOrImm
...
This is not currently an error, as this function is only used in the definition
of the semantics for push, which doesn't accept a signed immediate value. This
fix is defensive in case someone decides to re-use this helper in another
context where the missing cases could cause a problem.
2018-10-24 10:25:18 -07:00
Tristan Ravitch
d6060e51be
x86: Fix a bug affecting imul (and add a test case)
...
We were hitting a translation error for imul in another application - this test
case is a reduced example demonstrating the problem.
The root cause was that there were a few missing cases for the new signed
immediate values from flexdis; this caused a fallthrough that mis-identified
signed immediates as non-immediates, triggering an error.
2018-10-24 10:23:51 -07:00
Tristan Ravitch
cc165d7316
x86: Make the test suite more verbose on translation errors
...
This makes debugging easier
2018-10-24 10:22:21 -07:00
Tristan Ravitch
563547fee5
Add semantics for minss, maxss, minsp, and maxsp (x86)
2018-10-23 15:18:40 -07:00
Joe Hendrix
c886c19b03
Rename Memory exports.
...
This update renames many of the declarations exported by
Data.Macaw.Memory so that we have more consistent names.
The majority of the existing names are now exported with DEPRECATION
warnings. Some of the symbol declarations that were not used by the
Memory datatype have been moved to other modules.
The minor version of macaw-base has been incremented.
2018-10-18 10:07:20 -07:00
Joe Hendrix
18e36f84aa
Ensure X86 register names are unique
2018-10-03 11:36:44 -07:00
Andrei Stefanescu
c5f0806751
Add symbolic semantics to X86 SSE floats.
2018-09-18 22:07:17 -07:00
Andrei Stefanescu
bd906c85a9
Merge pull request #13 from GaloisInc/floating-point
...
Add support for floating-point.
2018-09-06 14:05:23 -07:00
Nathan Collins
b6bc9c91e7
Generate MacawArchStateUpdate
stmts in Crucible IR
...
By adding `asAtomicStateUpdate` in analogy with
`Data.Macaw.SemMC.Generator.asAtomicStateUpdate` and its use in
`Data.Macaw.PPC.Disassemble`.
2018-08-30 14:49:37 -07:00
Andrei Stefanescu
e2ea117465
Propagate Macaw float type changes to X86 semantics.
2018-08-27 11:37:01 -07:00
Joe Hendrix
230b318dcf
Updates to discovery
2018-08-14 23:29:02 -07:00
Kevin Quick
c56f66a150
[x86] Fix/update haddock documentation.
2018-07-28 15:28:28 -07:00
Joe Hendrix
e4a27d7bbc
Merge branch 'master' of github.com:GaloisInc/macaw
2018-07-27 00:28:50 -07:00
Joe Hendrix
c6a1ecba6c
Rename MemSet to RepStos to reflect underlying x86 function.
2018-07-27 00:24:24 -07:00
Tristan Ravitch
4e78ec3b8a
x86: Haddock fixes
2018-07-26 20:32:32 -07:00
Joe Hendrix
3906cbd501
Change MemCopy to RepMovS primitive.
2018-07-24 14:13:44 -07:00
Joe Hendrix
901446bda5
Add test case for object jump table.
2018-07-20 18:16:52 -07:00
Joe Hendrix
0d0898c644
Add support for parsing jump tables with relocations in entries.
...
This also adds simplification rules and some refactoring of existing
interfaces
2018-07-20 09:57:06 -07:00
Joe Hendrix
f1c5b10fd5
Extend relocation support and 1-1 x86 block association.
2018-07-18 16:57:17 -07:00
Joe Hendrix
6391a87db1
Merge branch 'master' of github.com:GaloisInc/macaw
2018-06-12 16:20:55 -07:00
Daniel Wagner
f4d4e381b7
have a way to align potentially misaligned IPs
2018-06-11 10:30:32 -04:00
Joe Hendrix
494f6c176d
Updates to Macaw.
2018-06-06 11:48:45 -07:00
Daniel Wagner
d0566fe03b
lay some groundwork for jump table detection on PPC
2018-05-30 15:50:16 -04:00
Jason Dagit
d0d30f038d
Merge branch 'master' of github.com:GaloisInc/macaw
2018-05-29 18:36:35 -07:00
Jason Dagit
e9756ed6a9
Semantics: fix repnz termination condition
2018-05-29 18:36:26 -07:00
Daniel Wagner
588e92cc01
add a few jump target formats
2018-04-24 17:05:17 -04:00
Joe Hendrix
000c2f900e
Move macaw stack.yaml to root for similiarity with other Galois packages.
2018-04-24 09:05:36 -07:00
Joe Hendrix
6267122136
Add packages to stack.yaml
2018-04-24 08:25:13 -07:00
Joe Hendrix
9259a7e1f3
Update stack to reflect actual ghc version.
2018-04-23 11:57:24 -07:00
Joe Hendrix
4c290c2a33
Update to build with ghc 8.2.1
2018-04-23 11:56:01 -07:00
Joe Hendrix
097edda1ef
Relocation support; various cleanups.
...
This patch adds initial support for relocations in Macaw code
discovery, and adds other refactoring.
* It introduces a SymbolValue constructor to represent references to
symbols within Macaw.
* The various cases for x86 mov are made explicit after the flexdis refactor
broke the previous code. We should now support segment register movs and
give better error messages when seeing mov with control or debug registers.
* The generic exception operation is replaced with Hlt and UD2 terminal
x86-specific statements.
* CodeAddrReason is split into FunctionExploreReason and BlockExploreReason to
clarify whether a function or block was discovered.
* The Macaw pretty printer is changed to use write_mem in place of pointer syntax.
* Various other refactoring is made to clarify code.
2018-04-23 11:24:21 -07:00
Joe Hendrix
0b8e95b0b0
Merge branch 'master' of github.com:GaloisInc/macaw
2018-04-17 16:02:28 -07:00
Tristan Ravitch
43688edef9
Fix a haddock parse error
...
Postfix haddock comments on GADT constructors (or constructor arguments) are not
yet supported.
2018-04-10 09:51:10 -07:00
Joe Hendrix
81e9c168af
Update submodules
2018-04-05 09:10:39 -07:00
Joe Hendrix
2feebceddc
Refactor relocation support; support .rel and some object symbols.
2018-04-05 09:06:12 -07:00
Tristan Ravitch
4bd307e41d
x86: Have the x86 backend emit the ArchState
metadata statment
...
This statement will be used for architecture-independent analysis of macaw
(or possibly crucible) values in machine registers.
2018-03-30 10:35:47 -07:00
Joe Hendrix
a258cf7b2b
Update submodule
2018-03-29 17:43:33 -07:00
Joe Hendrix
9f49b7327a
Bump elf-edit
2018-03-29 16:40:26 -07:00
Joe Hendrix
265f61e206
Merge branch 'master' of github.com:GaloisInc/macaw
2018-03-29 16:30:29 -07:00
Joe Hendrix
16d975d81f
Update submodules
2018-03-29 15:34:57 -07:00
Joe Hendrix
007405db1d
Improve robustness of elf loader, and start trying to parse relocations in objects.
2018-03-29 15:21:31 -07:00
Tristan Ravitch
6152912518
x86: Improve the testing harness
...
The tests now check to make sure that no blocks end in a classification failure.
This exposed a problem where some simple cases (where the return address was
read from the stack) where we were getting classification failures.
It turns out that the problem was due to the code being PIE and loaded at a very
low address. This made a number of small constants look like code pointers,
which threw off the abstract interpretation.
The fix is to load the test binaries at a large offset (0x400000 or so) to
reduce the likelihood of overlap.
2018-03-28 16:54:35 -07:00
Iavor Diatchki
777fad441d
Make it build with the Haskell2010
option
2018-03-27 11:01:18 -07:00
Iavor Diatchki
37c951722d
Merge branch 'master' of github.com:GaloisInc/macaw
2018-03-27 10:51:53 -07:00
Kevin Quick
789841f9fe
[x86] Constent use of language specification in cabal file.
...
Also updates the minimum cabal version. This eliminates warnings
regarding this cabal file.
2018-03-27 10:41:18 -07:00
Kevin Quick
377c3d1a2b
Use architecture-specific identifyReturn in Discovery process.
...
Instead of inline analysis of whether the instruction pointer has been
updated to contain the ReturnAddr symbolic value, defer the
determination of the call return to the (previously defined but
unused) architecture-specific handling. This allows architectures
like ARM that perform modifications on the values loaded to the
instruction pointer (e.g. clearing lower bits) to provide their own
recognition of a return operation.
Also modifies the signature of identifyReturn to return a Sequence of
statements to match the identifyCall type signature.
Replaces the previously unused identifyX86Return with the inline
detection of IP == ReturnAddr.
2018-03-27 10:35:55 -07:00
Iavor Diatchki
f54f0a13ba
Add some support for unpack; no symbolic implementation yet.
2018-03-26 18:51:19 -07:00
Iavor Diatchki
cb9cef128e
Implement vpinsrq
and structore for the rest of the vector insert instruction
2018-03-26 13:17:03 -07:00
Joe Hendrix
ceefa7ae75
Update memory to use explicit BSS region and disable includeBSS option.
2018-03-23 16:26:07 -07:00
Iavor Diatchki
9ffaf478bf
Semantics for vmovq
2018-03-23 16:15:43 -07:00
Aaron Tomb
e33ecf3e84
Fix build with GHC 8.4.1
2018-03-23 14:09:28 -07:00
Iavor Diatchki
d3d5f39ebb
Change YMM patterns to just use Word8 directly.
...
Simpler, not clear that the additional abstraction was useful.
2018-03-21 16:14:59 -07:00
Iavor Diatchki
6875f84971
Add implementation for vpsllq
2018-03-15 09:49:03 -07:00
Iavor Diatchki
e967573eb0
Set false
to False
, not True
:)
2018-03-14 15:22:19 -07:00
Iavor Diatchki
9c7070f8e6
Haddock comments fixes, thanks to Brian
2018-03-09 09:51:55 -08:00
Iavor Diatchki
82e1dc0ebc
Add shift right for vectors.
2018-03-08 11:20:41 -08:00
Joe Hendrix
14ab6352f5
Export elfAddrWidth
2018-02-28 09:26:10 -08:00
Joe Hendrix
a167997fc2
Merge branch 'master' of github.com:GaloisInc/macaw
2018-02-27 17:09:57 -08:00
Iavor Diatchki
2e21856afe
Merge remote-tracking branch 'origin/master' into mem-model
...
# Conflicts:
# base/src/Data/Macaw/Memory/ElfLoader.hs
2018-02-27 16:36:08 -08:00
Joe Hendrix
cf3949b170
Fix Elf X86 tests.
2018-02-27 07:37:06 -08:00
Joe Hendrix
83fa71b210
Update elf submodule
2018-02-26 14:53:08 -08:00
Iavor Diatchki
22fbaf9d4f
Change the types of the patterns, so that matching allows us to learn the type
2018-02-15 17:03:30 -08:00
Joe Hendrix
e3a1b35307
Fix macaw-x86 tests.
2018-01-29 23:19:50 -08:00
Joe Hendrix
5f219026ec
Update submodules
2018-01-29 20:14:42 -08:00
Joe Hendrix
7e144a51f4
Memory interface renamings.
2018-01-29 11:05:19 -08:00
Joe Hendrix
e1e558239e
Minor cleanups.
2018-01-29 01:06:59 -08:00
Iavor Diatchki
5959bfc6f0
Merge branch 'master' of github.com:GaloisInc/macaw
2018-01-26 14:43:50 -08:00
Daniel Wagner
c6dcd09738
regression tests for splitting blocks mid-instruction
2018-01-26 14:09:01 -08:00
Daniel Wagner
dfa21bc40a
modify tail-call test
...
Previously, we asked macaw to discover three functions in the tail-call
test. One of those only ever appeared as a tail call from another
function; currently macaw isn't smart enough to discover that as its own
function (and that's probably okay for now).
2018-01-26 14:09:01 -08:00
Daniel Wagner
293b13cc47
check that the expected functions are all discovered
2018-01-26 14:09:01 -08:00
Iavor Diatchki
9cf05f6f29
Slight improvement to pretty printing.
2018-01-26 11:35:58 -08:00
Iavor Diatchki
a7b5ac73ec
Fix comment
2018-01-26 11:35:42 -08:00
Daniel Wagner
fc76fd5dc0
split blocks when we discover a jump into their middle
2018-01-26 10:18:31 -08:00
Daniel Wagner
d61e6d4a7f
give an expected block size in x86_64 tests
2018-01-26 10:18:31 -08:00
Joe Hendrix
b3cd6fd049
Fix loop in X86 bvUle simplification.
2018-01-23 16:06:54 -08:00
Joe Hendrix
278b079a49
Fix warnings; remove -Werror
2018-01-21 07:56:04 -08:00
Joe Hendrix
4482229156
Update flexdis
2018-01-16 23:09:42 -08:00
Joe Hendrix
a7c8014269
Update flexdis submodule
2018-01-16 22:38:15 -08:00
Joe Hendrix
b81a51067c
Update submodules
2018-01-16 22:20:34 -08:00
Joe Hendrix
79b5606e3c
Merge remote-tracking branch 'origin/avx'
2018-01-16 15:38:14 -08:00
Joe Hendrix
48001ea6f1
Add updated flexdis constraints.
2018-01-16 15:37:30 -08:00
Joe Hendrix
b7e06e64ee
Progress on macaw-symbolic and macaw-x86-symbolic.
2018-01-16 15:06:31 -08:00
Joe Hendrix
b89f60bf2b
Replace SymbolAddrMap with AddrSymMap for better code reused in reopt.
2018-01-08 12:28:28 -08:00
Joe Hendrix
e5f6a70586
Bump submodules
2018-01-08 10:58:50 -08:00
Joe Hendrix
250c41d40b
Progrsss on symbolic and fixes to x86-support.
2018-01-03 13:18:13 -08:00
Iavor Diatchki
70aaccb406
Merge remote-tracking branch 'origin/master' into avx
...
# Conflicts:
# symbolic/src/Data/Macaw/Symbolic.hs
# symbolic/src/Data/Macaw/Symbolic/CrucGen.hs
# symbolic/src/Data/Macaw/Symbolic/PersistentState.hs
# x86/src/Data/Macaw/X86/Getters.hs
2018-01-03 12:01:10 -08:00
Joe Hendrix
622daeb920
Update submodules.
2018-01-02 22:56:06 -08:00
Joe Hendrix
deab99869d
Update for parameterized-utils compat.
2018-01-02 17:31:42 -08:00
Iavor Diatchki
cdb02f2acf
Typo
2018-01-02 09:56:42 -08:00
Joe Hendrix
3f32b82943
Merge branch 'master' of github.com:GaloisInc/macaw
2017-12-21 15:42:50 -08:00
Joe Hendrix
a15fc42ed4
Minor updates.
2017-12-21 15:42:33 -08:00
Iavor Diatchki
bb4d8c16c8
Add the rest of the missing instructions that we need for now.
2017-12-20 16:29:38 -08:00
Iavor Diatchki
7afcea48d1
Add some more instructions
2017-12-19 17:20:16 -08:00
Daniel Wagner
febd82f284
get x86 tests building again
2017-12-19 14:09:32 -08:00
Iavor Diatchki
1f2e80f1a5
Implement a couple of instructions
2017-12-18 16:53:27 -08:00
Ben Selfridge
0170d9c639
Fixed an incomplete pattern match by adding an erroneous case
2017-12-15 11:02:44 -08:00
Iavor Diatchki
bee40539ea
Use latest version of flexdis in testing sub-module
2017-12-14 17:09:28 -08:00
Iavor Diatchki
60f834625d
Move to latest version of flexdis
2017-12-14 17:08:54 -08:00
Iavor Diatchki
74465f8b65
Add a little state to keep track if we are translating an AVX instruciton.
...
Writes to an XMM register may or may not affect to corresponding YMM
register, depending on the type of instruction we are using.
With SSE instruction, the upper bits of YMM are left as is, while with
AVX the upper bits are set to 0.
The `avxMode` field of the monad keeps track of what insturction we
are translating.
2017-12-14 16:44:02 -08:00
Iavor Diatchki
caa875b4c2
Add support from 256-bit YMM registers.
2017-12-14 16:01:12 -08:00
Iavor Diatchki
6df1aa01a3
Typo in comment.
2017-12-14 15:59:33 -08:00
Iavor Diatchki
384039cdef
Merge branch 'master' of github.com:GaloisInc/macaw
2017-12-13 14:40:35 -08:00
Iavor Diatchki
456827d295
Add a place-holder for YMM registers.
...
This is a temporary patch while we fix it properly, which enables
macaw to build.
2017-12-13 14:40:27 -08:00
Joe Hendrix
a8265ec28d
Bump parameterized-utils submodule.
2017-12-08 11:44:43 -08:00
Joe Hendrix
da8d7a0c7a
Remove IsValue class as it had a single instance.
2017-12-07 23:55:08 -08:00
Joe Hendrix
d7202f7834
Update parameterized-utils version.
2017-12-07 00:47:32 -08:00
Joe Hendrix
b9eda0a9b9
Use more parameterized-utils features.
2017-12-07 00:24:04 -08:00
Joe Hendrix
d2b1b20ea8
Fix typo in fsub name.
2017-12-06 18:42:57 -08:00
Joe Hendrix
32b53b96b1
Migrate floating point code to architecture specific backends.
...
This should complete the transition so that all App values are total
functions, and functions with side effects are architecture-specific.
2017-12-06 16:58:33 -08:00
Joe Hendrix
4d5b90e285
Begin cleaning up floating point and x86-specific functions.
2017-12-05 13:31:12 -08:00
Joe Hendrix
716de707c2
Fix failing x86 tests broken by last commit.
2017-12-01 15:09:07 -08:00
Joe Hendrix
478e7db31a
Refactor X86 semantics types; add tuples to Macaw.
2017-12-01 13:58:20 -08:00
Joe Hendrix
e0417a09a1
Merge branch 'master' of github.com:GaloisInc/macaw
2017-11-22 14:08:49 -08:00
Joe Hendrix
2bd710b49d
Move global function argument analysis to Macaw; Syscall changes
...
We also moved the syscall interface to be X86 specific to be compat
with earlier changes.
2017-11-22 14:07:55 -08:00
Joe Hendrix
4377e8c46e
Update for language-c >= 0.6 compat.
2017-11-21 09:59:30 -08:00
Ben Selfridge
a10edcf56a
added Cabal to stack.yaml dependencies
2017-11-09 16:13:05 -08:00
Ben Selfridge
bf0b6813d2
add cabal-doctest to stack.yaml
2017-11-09 16:02:34 -08:00
Ben Selfridge
9caacd01ef
added needed submodules
2017-11-09 15:00:23 -08:00
Ben Selfridge
b19c7e3ab6
deleted badly added submodules
2017-11-09 14:59:01 -08:00
Ben Selfridge
c39ac71631
still fixing travis
2017-11-09 10:59:47 -08:00
Ben Selfridge
4467a29728
Moved .travis.yml up to macaw root, testing travis-ci again
2017-11-08 14:26:22 -08:00
Ben Selfridge
afeb8f77c9
New Travis script
2017-11-08 12:05:28 -08:00
Ben Selfridge
ff7bff7108
Added submodules to macaw/x86/tests.
2017-11-07 14:40:49 -08:00
Joe Hendrix
9b2b95512d
Add support for memory "regions" to better support relocatable files.
2017-11-07 13:15:03 -08:00
Ben Selfridge
580cb634cd
Fixed macaw-x86 test suite, all tests seem to pass fine.
2017-11-01 15:56:54 -07:00
Joe Hendrix
b99927f3b0
Fix issue in architecture-specific statement addresses.
2017-10-31 12:00:09 -07:00
Joe Hendrix
8e9b453189
Simplify demand computation.
2017-10-27 16:24:16 -07:00
Joe Hendrix
f7503f12a5
Generalize ArchStmt.
2017-10-27 15:57:36 -07:00
Joe Hendrix
4c67e08e21
Generalize semantics of architecture-specific term statement.
...
This also makes some small changes/improvments to the rewriter and
removes redundent argument from x86-backend.
2017-10-27 09:26:26 -07:00
Joe Hendrix
16693d4a63
Generalize disassembler so that it can be used with ST RealWorld.
2017-10-23 13:55:58 -07:00
Joe Hendrix
5eaf2605ed
Add support for adc/sbb.
2017-10-17 11:50:23 -07:00
Joe Hendrix
135add62ae
Minor refactorings so ARM disassembler doesn't need MemSegmentOff.
2017-10-12 23:34:39 -07:00
Joe Hendrix
c95d3e7d0f
Cleanups to Macaw.
2017-10-10 11:38:28 -07:00
Joe Hendrix
b17122e4c5
Fix macaw-symbolic compile error; add additional operands.
2017-10-06 14:35:22 -07:00
Joe Hendrix
dd7c817702
Modify BVTestBit to require arguments have same width.
2017-10-06 11:22:55 -07:00
Joe Hendrix
1ebc6f247b
Make X86Stmt more generic to reuse code in reopt.
2017-10-02 17:02:00 -07:00
Joe Hendrix
c77d1ac421
Remove generic quot/rem ops, and BoolMux; Refactor macaw-symbolic.
2017-10-02 14:40:14 -07:00
Joe Hendrix
7c33bf82e4
Update license information.
2017-09-27 15:59:06 -07:00
Joe Hendrix
4dcb26ebee
Add x86 specific code.
2017-09-27 15:54:43 -07:00