Commit Graph

49 Commits

Author SHA1 Message Date
Rafal Kolanski 6095e9ecb2 cparser: annotate AST printing for top-level decls
In order to compare ASTs for appearance/disappearance/modification of
declarations, it is easier to have the annotations obvious to any
external tool for ease of parsing.

Annotations take the form:
"##<decl_type>: <name>", e.g. "##Function: ctzl"

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-05-10 16:40:42 +10:00
Gerwin Klein ffcaff6af9 c-parser: provide AARCH64 setup
The setup for L4V_ARCH=AARCH64 is identical to RISCV64, i.e. same word
length, encoding, and endianness. The setup includes the standalone
parser used for compile and preprocess checks in the seL4 repo.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-02-03 16:13:45 +11:00
Gerwin Klein 18428256f0 c-parser: update to Isabelle2020
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Matthew Brecknell 6f23d50ea9 c-parser: avoid cleaning `umm_heap/ARM_HYP`
Initially the `Makefile` copied `umm_heap/ARM_HYP` from `umm_heap/ARM`,
and deleted `umm_heap/ARM_HYP` during `make clean`. However, the
contents of `umm_heap/ARM_HYP` have since been committed, so this is no
longer appropriate.

Reported-by: Michael Norrish <Michael.Norrish@data61.csiro.au>
Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2020-08-26 14:58:15 +10:00
Gerwin Klein c68915b92b license: provide documentation under CC-BY-SA-4.0
Datat61 provides all docs under CC-BY-SA-4.0.
2020-03-16 14:19:15 +08:00
Gerwin Klein 86a941e7e7 spdx: review missing copyright & license info
Some files were missing machine-readable copyright info, others were tagged
incorrectly.
2020-03-16 14:19:15 +08:00
Gerwin Klein a424d55e3e licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
Gerwin Klein 8d12d8e4be licenses: tag .md and document file 2020-03-02 18:52:15 +08:00
Matthew Brecknell 52dae5f25a c-parser standalone: don't delete original source files on Isabelle2019 2019-06-19 14:39:56 +10:00
Gerwin Klein 47a7511941 c-parser: tweaks for mlton 20180207 in standalone C parser 2018-07-02 08:51:40 +02:00
Rafal Kolanski edd02390e1 c-parser: reinstate X64 target accidentally clobbered by RISCV64 2018-06-28 18:42:43 +10:00
Rafal Kolanski 31b635401d riscv: setup cspec build for L4V_ARCH=RISCV64
C parser and word setup copied from X64
2018-06-27 10:05:44 +02:00
Thomas Sewell 4b2c812323 c-parser: VER-881: process more function calls.
Two kinds of function calls were escaping the analysis. The first is simple,
the ReturnFnCall statement type, which was a silly omission from before.

Function calls inside initialiser statements are a more difficult problem.
The simplest solution was to move the VER-881 calculation into a
post-processing phase once those function calls have been moved to statement
positions.
2018-03-14 17:56:53 +11:00
Thomas Sewell f35caa8dca JIRA VER-881: avoid complex call lvals.
This scans for statement-level function calls which will have complex
lvalue translations, either because their lvalues are compound
expressions or because their function return type will be promoted to
be stored. It treats them like expression-level function calls, with
an additional call statement added (saving to a ret_ variable) and
the complex lvalue step treated like an assignment.
2018-02-28 11:22:46 +11:00
Pang Luo 6b9912c47a manually adjust non-obvious cases of tab to space replacement 2017-10-20 14:22:36 +11:00
Matthew Brecknell 184d6b70b7 remove most tab characters 2017-10-20 14:22:36 +11:00
Adrian Danis 49d6cf721b Munge test: Delete munge tests that have been moved to a new repository
tags: [NO_PROOF]
2017-09-28 15:21:11 +10:00
Adrian Danis 6e96015e32 Munge Test: Update for changes to cspec
The C kernel build in cspec was changed to have a different directory structure and
build targets. This updates the make_munge.sh script to reflect those changes

tags: [NO_PROOF]
2017-09-28 14:39:25 +10:00
Adrian Danis 38057504aa Munge Test: Always produce expected kernel_all.txt
tags: [NO_PROOF]
2017-09-28 14:39:19 +10:00
Alejandro Gomez-Londono 32f3a731ac Munge test: Support for multi Arch CSpec
tag: [NO_PROOF]
2017-04-03 13:21:00 +10:00
Alejandro Gomez-Londono d6ac616294 CParser multi_arch_refactor: Adding support for ARM_HYP 2017-03-10 11:10:24 +11:00
Joel Beeren 3dafec7d46 backport changes to ARM proofs from X64 work in progress
- replace ARM-specific constants and types with aliases which can be
  instantiated separately for each architecture.
- expand lib with lemmas used in X64 proofs.
- simplify some proofs.

Also-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2017-01-27 08:31:07 +11:00
Alejandro Gomez-Londono 858bff7a7f Munge Test: adding --underscore_idents flag to c-parser
tags: [NO_PROOF]
2016-12-13 14:57:28 +11:00
Thomas Sewell 5a367ea7e5 Standalone C parser: scan for unhandled ASM.
Adds an additional analysis option to the external C parser. This
will report about any asm statements that were encountered and could
not be properly handled.

[NO_PROOF]
2016-12-06 16:01:23 +11:00
Matthew Brecknell 945ee811c3 CParser multi_arch_refactor: build standalone parser in dir named after arch
Architecture names follow L4V_ARCH-style naming conventions ('ARM', 'FAKE64').
However, the standalone parser does not make use of the L4V_ARCH environment
variable.

The standalone-parser Makefile builds all architectures at once, producing
binaries at 'ARM/c-parser', 'FAKE64/c-parser', and similarly for the tokenizer.

There are also wrapper scripts 'c-parser' and 'tokenizer' in the
standalone-parser directory, which take an architecture on the command line.

The make_munge.sh script calls the appropriate binary parser directly.
2016-09-02 23:38:40 +10:00
Matthew Brecknell 886fe0ef12 CParser multi_arch_refactor: fix tokenizer build 2016-09-01 12:35:33 +10:00
Michael Norrish 4062decf79 Merge branch 'sort-munge-output' into multi_arch_refactor 2016-08-17 10:42:38 +10:00
Michael Norrish af1c77243b c-parser: fix list sorting to use Isabelle code
This makes the licensing situation clearer than with the code coming
from Moscow ML (which might conceivably be GPL).
2016-08-17 10:38:21 +10:00
Michael Norrish 936caa2e4f c-parser: multi_arch_refactor: merge with master
factorial regression test does not succeed.
2016-08-15 11:30:24 +10:00
Michael Norrish 7da160d23b Create standalone parser per architecture
Also include a wrapper that calls any of them in a completely
straightforward way.
2016-08-13 17:24:49 +10:00
Michael Norrish e321cae1b3 c-parser: sort munge output 2016-08-12 09:41:16 +10:00
Alejandro Gomez-Londono 7724dff916 test_munge.sh updated to print diff of symbols and kernel [VER-584] 2016-07-14 16:34:55 +10:00
Alejandro Gomez-Londono 6991fab7e8 c-parser: allow_underscore_idents flag added + examples [VER-619][NO_PROOF] 2016-07-12 12:07:53 +10:00
Alejandro Gomez-Londono 89b64646ec test_munge.sh and make_munge.sh updated to support
the new --ast flag in c-parser [VER-584][VER-512][NO_PROOF]
2016-07-06 16:59:37 +10:00
Thomas Sewell 50ab074d71 Tweak serial code, don't reference print.
The function print isn't in scope in the Isabelle environment.
2016-07-05 17:37:14 +10:00
Thomas Sewell 20c50e46b0 Finish serialisation code for AST. 2016-07-05 17:37:14 +10:00
Thomas Sewell 0490bcba6a Start of AST-dump analysis for c-parser.
Give the standalone c-parser the facility to dump out its internal AST. Only
half finished, I got bored writing serialisers for the many syntax datatypes.

There has been some discussion about how to check whether an seL4 change
impacts verification. My thought was that the obvious thing to check is the
C-parser's AST. If this is unchanged, then further analyses must be unchanged.
2016-07-05 17:37:14 +10:00
Alejandro Gomez-Londono 495665e3c9 Munge make/test scripts 2016-06-21 14:50:04 +10:00
Michael Norrish a344d156c6 c-parser: make munge_info available from standalone-parser
Specification of file to emit to is via command-line switch.  Take the
opportunity to make comand-line processing be done via GetOpt library.

JIRA VER-473
2016-06-14 12:39:03 +10:00
Michael Norrish 6b06652da3 Fix standalone parser in light of 344ed539 2016-02-17 09:00:32 +11:00
Michael Norrish 9827e78177 Handle cpp in both standalone and Isabelle parsers
Japheth's recent change (6f7c660cb) to error-reporting for the latter
broke the former. Refactor code so that old and new code can coexist.
Would just use Japheth's code in the purely SML version too, but it uses
Isabelle/ML libraries that I can't be bothered to recreate in SML.
2015-04-10 14:51:36 +10:00
Michael Norrish d66755aa26 Also get tokenizer tool to build given cc996ca 2015-04-10 14:05:16 +10:00
Michael Norrish cc996ca9ca Properly fix JIRA VER-439
The handling of local static variables is now part of a general
improvement in the handling of all the "munging" that the parser does.

*Munging* is the process of renaming variables so that Isabelle can cope
with them.  There are at least three different forms of munging at the
moment:

- static locals get munged so that multiple static locals (which have to
  be treated as globals) can co-exist with the same source name.
- local variables of the same source name but different types have to be
  able to co-exist
- variables with legitimate C names but illegal Isabelle names have to
  be allowed

The new structure MString implements an opaque version of string
designed to make it clear to the typechecker that certain strings are
"munged".
2015-04-09 15:09:29 +10:00
Michael Norrish 9149fe41c7 New option to standalone parser to just test the C grammar.
Without even typechecking, none of the later phases of the analysis
get run.
2015-01-28 14:40:15 +11:00
Michael Norrish 72d54eeb0b Allow user to control path to C preprocessor (or not use it entirely).
As per example, syntax is

    declare [[cpp_path="path to file"]]

If the empty string is used as the value, then no preprocessor will be
called.

The standalone parser has also been adjusted so that you can it with

    --cpp=path

or

    --nocpp

options.

Closes JIRA issue VER-337
2015-01-22 14:05:39 +11:00
David Greenaway 0fb7a8084d misc: Proofing and formatting of README.md files.
Attempt to improve readability of the files when viewed as plain ASCII;
proof-read and fix minor issues.
2014-07-28 13:15:48 +10:00
Gerwin Klein f126d8bf45 adjust isabelle paths for standalone `make` 2014-07-27 20:25:04 +02:00
Gerwin Klein cd6abfb096 added README.md 2014-07-27 20:24:24 +02:00
Gerwin Klein 2a03e81df4 Import release snapshot. 2014-07-14 21:32:44 +02:00