Skip to content

Commit

Permalink
macaw-aarch32-syntax: Syntactic sugar for for AArch32 CFGs
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Nov 19, 2024
1 parent d7470c1 commit 6cc1604
Show file tree
Hide file tree
Showing 11 changed files with 679 additions and 0 deletions.
1 change: 1 addition & 0 deletions cabal.project.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
packages: base/
macaw-aarch32/
macaw-aarch32-symbolic/
macaw-aarch32-syntax/
macaw-dump/
macaw-semmc/
macaw-ppc/
Expand Down
30 changes: 30 additions & 0 deletions macaw-aarch32-syntax/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Copyright (c) 2024 Galois Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.

* Neither the name of Galois, Inc. nor the names of its contributors
may be used to endorse or promote products derived from this
software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
70 changes: 70 additions & 0 deletions macaw-aarch32-syntax/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# macaw-aarch32-syntax

This package provides concrete syntax for macaw-aarch32-symbolic types and
operations.

Concretely, it implements a `ParserHooks` for use with [`crucible-syntax`][syn].
This `ParserHooks` supports the following types and operations:

**Types**:

- `AArch32Regs`: the struct of all AArch32 registers

**Operations**:

- `get-reg :: AArch32Reg -> AArch32Regs -> t`: extract an x86 register
- `set-reg :: AArch32Reg -> t -> AArch32Regs -> AArch32Regs`: set an x86 register
- Registers:
- `r0 :: AArch32Reg`
- `r1 :: AArch32Reg`
- `r2 :: AArch32Reg`
- `r3 :: AArch32Reg`
- `r4 :: AArch32Reg`
- `r5 :: AArch32Reg`
- `r6 :: AArch32Reg`
- `r7 :: AArch32Reg`
- `r8 :: AArch32Reg`
- `r9 :: AArch32Reg`
- `r10 :: AArch32Reg`
- `r11 :: AArch32Reg`, AKA `fp`
- `fp :: AArch32Reg`, AKA `r11`
- `r12 :: AArch32Reg`, AKA `ip`
- `ip :: AArch32Reg`, AKA `r12`
- `r13 :: AArch32Reg`, AKA `sp`
- `sp :: AArch32Reg`, AKA `r13`
- `r14 :: AArch32Reg`, AKA `lr`
- `lr :: AArch32Reg`, AKA `r14`
- `v0 :: AArch32Reg`
- `v1 :: AArch32Reg`
- `v2 :: AArch32Reg`
- `v3 :: AArch32Reg`
- `v4 :: AArch32Reg`
- `v5 :: AArch32Reg`
- `v6 :: AArch32Reg`
- `v7 :: AArch32Reg`
- `v8 :: AArch32Reg`
- `v9 :: AArch32Reg`
- `v10 :: AArch32Reg`
- `v11 :: AArch32Reg`
- `v12 :: AArch32Reg`
- `v13 :: AArch32Reg`
- `v14 :: AArch32Reg`
- `v15 :: AArch32Reg`
- `v16 :: AArch32Reg`
- `v17 :: AArch32Reg`
- `v18 :: AArch32Reg`
- `v19 :: AArch32Reg`
- `v20 :: AArch32Reg`
- `v21 :: AArch32Reg`
- `v22 :: AArch32Reg`
- `v23 :: AArch32Reg`
- `v24 :: AArch32Reg`
- `v25 :: AArch32Reg`
- `v26 :: AArch32Reg`
- `v27 :: AArch32Reg`
- `v28 :: AArch32Reg`
- `v29 :: AArch32Reg`
- `v30 :: AArch32Reg`
- `v31 :: AArch32Reg`

[syn]: https://github.com/GaloisInc/crucible/tree/master/crucible-syntax
127 changes: 127 additions & 0 deletions macaw-aarch32-syntax/macaw-aarch32-syntax.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
Cabal-version: 2.2
Name: macaw-aarch32-syntax
Version: 0.1
Author: Galois Inc.
Maintainer: [email protected]
Build-type: Simple
License: BSD-3-Clause
License-file: LICENSE
Category: Language
Synopsis: A syntax for macaw-aarch32-symbolic control-flow graphs
-- Description:

extra-doc-files: README.md
extra-source-files:
test-data/*.cbl
test-data/*.out.good

common shared
-- Specifying -Wall and -Werror can cause the project to fail to build on
-- newer versions of GHC simply due to new warnings being added to -Wall. To
-- prevent this from happening we manually list which warnings should be
-- considered errors. We also list some warnings that are not in -Wall, though
-- try to avoid "opinionated" warnings (though this judgement is clearly
-- subjective).
--
-- Warnings are grouped by the GHC version that introduced them, and then
-- alphabetically.
--
-- A list of warnings and the GHC version in which they were introduced is
-- available here:
-- https://ghc.gitlab.haskell.org/ghc/doc/users_guide/using-warnings.html

-- Since GHC 9.4 or earlier:
ghc-options:
-Wall
-Werror=ambiguous-fields
-Werror=compat-unqualified-imports
-Werror=deferred-type-errors
-Werror=deprecated-flags
-Werror=deprecations
-Werror=deriving-defaults
-Werror=dodgy-foreign-imports
-Werror=duplicate-exports
-Werror=empty-enumerations
-Werror=forall-identifier
-Werror=identities
-Werror=inaccessible-code
-Werror=incomplete-patterns
-Werror=incomplete-record-updates
-Werror=incomplete-uni-patterns
-Werror=inline-rule-shadowing
-Werror=misplaced-pragmas
-Werror=missed-extra-shared-lib
-Werror=missing-exported-signatures
-Werror=missing-fields
-Werror=missing-home-modules
-Werror=missing-methods
-Werror=operator-whitespace
-Werror=operator-whitespace-ext-conflict
-Werror=overflowed-literals
-Werror=overlapping-patterns
-Werror=partial-fields
-Werror=partial-type-signatures
-Werror=redundant-bang-patterns
-Werror=redundant-strictness-flags
-Werror=simplifiable-class-constraints
-Werror=star-binder
-Werror=star-is-type
-Werror=tabs
-Werror=typed-holes
-Werror=type-equality-out-of-scope
-Werror=type-equality-requires-operators
-Werror=unrecognised-pragmas
-Werror=unrecognised-warning-flags
-Werror=unsupported-calling-conventions
-Werror=unsupported-llvm-version
-Werror=unticked-promoted-constructors
-Werror=unused-imports
-Werror=warnings-deprecations
-Werror=wrong-do-bind

ghc-prof-options: -O2 -fprof-auto-top
default-language: Haskell2010

library
import: shared

build-depends:
base >= 4.13,
containers,
crucible,
crucible-syntax,
macaw-aarch32,
macaw-aarch32-symbolic,
macaw-base,
macaw-symbolic,
mtl,
parameterized-utils,
text,
what4,

hs-source-dirs: src

exposed-modules:
Data.Macaw.AArch32.Symbolic.Syntax

test-suite macaw-aarch32-syntax-tests
import: shared
type: exitcode-stdio-1.0
main-is: Test.hs
hs-source-dirs: test
build-depends:
base,
containers,
crucible >= 0.1,
crucible-syntax,
crucible-llvm-syntax,
filepath,
macaw-aarch32,
macaw-aarch32-symbolic,
macaw-aarch32-syntax,
macaw-symbolic,
macaw-symbolic-syntax,
parameterized-utils >= 0.1.7,
tasty,
tasty-golden,
text,
Loading

0 comments on commit 6cc1604

Please sign in to comment.