forked from rems-project/asl-interpreter
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support compilation to Javascript (#90)
* Split libASL and isolate Z3 into virtual library (#91) Z3 links to a native shared library, and so is unsuitable for use via js-of-ocaml. This separates the one use of Z3 in the code (the type-checker's constraint solver) into a separate library which may be stubbed for non-native platforms. This separates libASL into two parts: libASL_ast which is the minimum needed to define the ASL syntax tree, and libASL which contains the rest of the library. libASL should still be used as the public interface of the library. Since libASL re-exports all of libASL_ast, this should not affect the API visible by downstream users. This is required since we need to insert a platform-specific library, libASL_support, which introduces z3 only on native builds. The dependency tree now looks like: libASL_ast <- libASL_support (virtual) <- libASL. * remove pcre library, use ocaml str instead (#93) PCRE relies on a shared library, precluding its use in Javascript. instead, we use the standard ocaml "str" library. note, however, that this supports a smaller subscript of regex (notably no negative lookahead), and has a different syntax. see: https://ocaml.org/manual/5.2/api/Str.html * Embed ARM ASL specs within OCaml (#92) * extract arm environment into separate file. * allow loading files from either disk or memory * use ppx_blob to embed ASL files instead of dune-site This is instead of installing the ASL files to disk. This should make the installation less liable to random breakages when installed or linked in an unexpected way. The binary size increases by 6MB. Updates tests/coverage/run.sh to substitute away the new file paths of the embedded files, so no coverage re-generation needed. * replace --aarch64-dir with --export-aarch64 this is more useful once the MRA files are bundled. * initialising jsoo * tcheck: make global env0 mutable necessary for correct unmarshalling, as this must contain global variables * dummy libASL to reduce conflicts * rename libASL parts to stage0/stage1
- Loading branch information
1 parent
c683d6e
commit 4d0bac9
Showing
31 changed files
with
353 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
(* defines the evaluation environment for the bundled Arm spsecifications. *) | ||
|
||
let aarch64_asl_dir: string option = | ||
None | ||
|
||
let prelude_blob : LoadASL.source = DataSource ("prelude.asl", [%blob "../prelude.asl"]) | ||
|
||
let asl_blobs : LoadASL.source list = [ | ||
DataSource ("mra_tools/arch/regs.asl", [%blob "../mra_tools/arch/regs.asl"]); | ||
DataSource ("mra_tools/types.asl", [%blob "../mra_tools/types.asl"]); | ||
DataSource ("mra_tools/arch/arch.asl", [%blob "../mra_tools/arch/arch.asl"]); | ||
DataSource ("mra_tools/arch/arch_instrs.asl", [%blob "../mra_tools/arch/arch_instrs.asl"]); | ||
DataSource ("mra_tools/arch/regs_access.asl", [%blob "../mra_tools/arch/regs_access.asl"]); | ||
DataSource ("mra_tools/arch/arch_decode.asl", [%blob "../mra_tools/arch/arch_decode.asl"]); | ||
DataSource ("mra_tools/support/aes.asl", [%blob "../mra_tools/support/aes.asl"]); | ||
DataSource ("mra_tools/support/barriers.asl", [%blob "../mra_tools/support/barriers.asl"]); | ||
DataSource ("mra_tools/support/debug.asl", [%blob "../mra_tools/support/debug.asl";]); | ||
DataSource ("mra_tools/support/feature.asl", [%blob "../mra_tools/support/feature.asl"]); | ||
DataSource ("mra_tools/support/hints.asl", [%blob "../mra_tools/support/hints.asl"]); | ||
DataSource ("mra_tools/support/interrupts.asl", [%blob "../mra_tools/support/interrupts.asl"]); | ||
DataSource ("mra_tools/support/memory.asl", [%blob "../mra_tools/support/memory.asl";]); | ||
DataSource ("mra_tools/support/stubs.asl", [%blob "../mra_tools/support/stubs.asl"]); | ||
DataSource ("mra_tools/support/fetchdecode.asl", [%blob "../mra_tools/support/fetchdecode.asl"]); | ||
DataSource ("tests/override.asl", [%blob "../tests/override.asl"]); | ||
DataSource ("tests/override.prj", [%blob "../tests/override.prj"]); | ||
] | ||
|
||
let aarch64_asl_files: (LoadASL.source * LoadASL.source list) option = | ||
Some (prelude_blob, asl_blobs) | ||
|
||
let aarch64_evaluation_environment ?(verbose = false) (): Eval.Env.t option = | ||
Option.bind aarch64_asl_files | ||
(fun (prelude, filenames) -> Eval.evaluation_environment prelude filenames verbose) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.