Commit Graph

4501 Commits

Author SHA1 Message Date
Gerwin Klein
241d8d12c7 aarch64/vspace: fix error reporting in decode
seL4_InvalidCapability expects invalidCapNumber to be set.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2024-01-26 08:52:01 +11:00
Nick Spinale
9ec543ce5a cmake: propagate CROSS_COMPILER_PREFIX
Mark CROSS_COMPILER_PREFIX as meaningful to gcc.cmake, so that it is
propagated for all cases where gcc.cmake used.

Signed-off-by: Nick Spinale <nick@nickspinale.com>
2024-01-25 13:28:23 +11:00
Gerwin Klein
5df6964782 aarch64/vspace: test for page type directly
Test the PTE directly for being of page type and avoid ptr access to
ease verification in unmapPage.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2024-01-25 07:32:42 +11:00
Alwin Joshy
6baeeaef21 hw debug api: fix single stepping on ARMv7
The implementation of single-stepping on ARMv7 relies on instruction
mismatch breakpoints. The implementation sets one of the breakpoint
value registers (BVR) to NULL and configures the corresponding
breakpoint control register (BCR) to generate a debug exception for
instructions that are at any other virtual address. This is incorrect
as it means that when single-stepping is enabled, no progress will
ever be made by the thread, as every instruction will mismatch with
NULL and result in the generation of a debug exception.

This commit resolves this issue by setting the BVR to the LR of the
thread at the moment single stepping is configured. Then, when the
thread is permitted to execute again, the instruction pointed to by
the LR will be executed, but any other instruction will result in a
debug exception. It also changes the debug exception hander to
update the BVR to the new LR when a single-stepping execption occurs
so that we can step over multiple instructions before sending a debug
fault to the appropriate fault handler thread.

Signed-off-by: Alwin Joshy <joshyalwin@gmail.com>
2024-01-23 10:34:39 +00:00
Gerwin Klein
cc3205ea48 aarch64/vspace: simplify check for page PTE
- directly test for page PTE types instead of testing for invalid etc.

- remove unnecessary condition `resolve_ret.ptBitsLeft > PAGE_BITS`
  (always true).

- reduce bitfield accesses via pointers to make verification easier.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2024-01-22 14:58:49 +11:00
Gerwin Klein
7f4662a791 Revert "aarch64/vspace: allow flushing larger .."
This reverts commit 494dd2dd96.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2024-01-22 14:58:49 +11:00
Gerwin Klein
494dd2dd96 aarch64/vspace: allow flushing larger pages
- The failure condition `resolve_ret.ptBitsLeft > PAGE_BITS` prevented
  larger page sizes from being flushed in VSpaceRoot invocations.

  Instead of testing for number of bits left to resolve, simply check
  the PTE whether it is a page or not.

- reduce bitfield accesses via pointers to make verification a bit
  easier.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2024-01-22 11:29:04 +11:00
Birg
0a0739074d manual: add bibliography to toc
Signed-off-by: Birg <bbrcknl@github.com>
2024-01-22 10:09:11 +11:00
bbrcknl
cbf25791b7 make method names consistent (#1144)
* make method names consistent; delete duplicates

Signed-off-by: Birg <bbrcknl@github.com>
2024-01-19 14:25:02 +11:00
Gerwin Klein
95cfd473e6 aarch64/vspace: adjust type for verification
Bring the type of `i` into line with what the other architectures do
in this function. This makes it easier to re-use those proofs.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2024-01-19 08:50:27 +11:00
Gerwin Klein
0398d34ad0 aarch64/vspace: avoid unnecessary casts
Type invLabel consistently as word_t, not sometimes as unsigned int.
This makes verification easier because it avoids unnecessary casts.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2024-01-16 12:39:13 +11:00
Gerwin Klein
2b29446484 aarch64/vspace: add performASIDControl annotations
Type and ghost state annotations for verification.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2024-01-16 10:55:41 +11:00
Gerwin Klein
5d1f3bc3ce tqma8xqp1gb: fix MAX_IRQ setting
The highest defined interrupt in the data sheet is 543 - 32 = 511.
This is important, because the code expects all IRQ numbers to fit into
9 bits (which 511 does, but 512 would not).

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2024-01-16 10:55:41 +11:00
Gerwin Klein
4a2f8e7a81 aarch64 structures: constrain irq_w field width
The rest of the code uses 9-bit irq width. Keep in sync here to ease
verification.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2024-01-16 10:55:41 +11:00
Gerwin Klein
2dec06fc4f aarch64: add verification retype annotations
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2024-01-16 10:55:41 +11:00
Gerwin Klein
836c180f0d aarch64: verification tweaks for getMapRefForASID
Refactor getMapRefForASID for verification into separate parts, because
the returned pointer doesn't exist as a concept in the executable spec.
Also avoid ptr_set functions to simplify heap reasoning.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2024-01-16 10:55:41 +11:00
Axel Heider
73553606f1 CI: update deploy workflow also
This is missing in commit e6fbbbb0

Signed-off-by: Axel Heider <axelheider@gmx.de>
2024-01-13 10:17:31 +11:00
Axel Heider
e6fbbbb065 CI: do simulation and HW build with LLVM on RISCV
Signed-off-by: Axel Heider <axelheider@gmx.de>
2024-01-12 07:50:50 +11:00
Axel Heider
454245febd CI: build standalone kernel for RISCV64 with LLVM
Signed-off-by: Axel Heider <axelheider@gmx.de>
2024-01-12 07:50:50 +11:00
Axel Heider
ed613d7d49 python: remove unused template parameter
Since commit cf8be663 this is no longer needed.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2024-01-02 10:55:45 +11:00
Cindy Liu
498fd84a55 use raise warining in version check
Signed-off-by: Cindy Liu <hcindyl@google.com>
2023-12-28 06:05:07 +07:00
Cindy Liu
807a42e91e Move the version check just before the usage
Signed-off-by: Cindy Liu <hcindyl@google.com>
2023-12-28 06:05:07 +07:00
Cindy Liu
04dc9675f3 Replace deprecated pkg_resources usage
Use importlib.metadata to check the jinja2 version

Signed-off-by: Cindy Liu <hcindyl@google.com>
2023-12-28 06:05:07 +07:00
Gerwin Klein
7bad3610f1 github: upload kernel.elf build artifact
The kernel.elf file is occasionally more useful for debugging than the
final board image.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-12-12 08:12:10 +01:00
Birg
9a532efc15 change CPTR to CPtr
Signed-off-by: Birg <bbrcknl@github.com>
2023-12-06 10:41:28 +00:00
Rafal Kolanski
d92c49ab9b arm hyp: avoid implicit downcast to local vars
lr_num is assigned to from word_t, so should also be word_t rather than
unsigned int.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-12-06 03:23:49 +11:00
Rafal Kolanski
55aee64707 arm hyp: gic_vcpu_num_list_regs should be word_t
On AArch64, if this is int, we encounter a situation where we can't
prove equivalence with the abstract spec without an extra invariant that
the number of these registers isn't zero (to satisfy 32<->64 bit casts).
Sticking with word size will make sense on both 32 and 64 bit.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-12-06 03:23:49 +11:00
Rafal Kolanski
66e5c79d06 Arm 64-bit: do not use unsigned int for arg length
Arch_decodeInvocation takes a word_t length and then passes it to
functions that take an unsigned int length. This was OK on 32-bit where
these types are the same, but on 64-bit this is a downcast without a
range check. It isn't clear why this doesn't trip a compiler warning.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-12-06 03:23:49 +11:00
Birg
391bfb15f8 update some manual todos
Signed-off-by: Birg <bbrcknl@github.com>
2023-11-29 10:21:32 +00:00
Axel Heider
94c5a0b53a cmake: show DTS name in error message
Signed-off-by: Axel Heider <axelheider@gmx.de>
2023-11-27 14:24:55 +00:00
Axel Heider
b59fa0ed20 riscv: use MAX_IRQ instead of PLIC_MAX_NUM_INT
Signed-off-by: Axel Heider <axelheider@gmx.de>
2023-11-24 09:57:46 +00:00
Axel Heider
a2cb6d0271 style: support property SMMU
Avoid the annoying style checker complaints.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2023-11-24 09:57:46 +00:00
Axel Heider
d2027a1fb9 cmake: rework macro declare_seL4_arch()
Support multiple architectures as parameter.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2023-11-23 11:53:46 +00:00
Axel Heider
7d93471e9c debug: use c99 standard instead of gcc extensions
Signed-off-by: Axel Heider <axelheider@gmx.de>
2023-11-16 12:09:52 +00:00
Axel Heider
7dbdbee05f exynos4: remove explicit TIMER_PRECISION setting
The default value is zero anyway.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2023-11-15 18:03:37 +00:00
Corey Lewis
155a5146bf mcs: change installTCBCap to not insert null caps
This insertion is not required, as the slot has just been cleared by
cteDelete. Avoiding the insertion simplifies verification.

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-11-15 15:53:14 +11:00
Corey Lewis
172d4c0f49 mcs: refactor validFaultHandler
This changes it to be a pure function, which eases verification

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-11-15 15:53:14 +11:00
Axel Heider
d7f2ba4aec remove useless assert
The assert() condition is checked two lines above

Signed-off-by: Axel Heider <axelheider@gmx.de>
2023-11-10 22:16:31 +11:00
Ivan-Velickovic
baacd4453a Add Pine64 Star64 support to CHANGES
Signed-off-by: Ivan-Velickovic <i.velickovic@unsw.edu.au>
2023-11-08 14:34:18 +00:00
Ivan-Velickovic
49e5f47041 Update PLIC handling for Star64/U74-MC
Similarly to the U54-MC, the U74-MC has a S-core that does not run in
supervisor mode.

Signed-off-by: Ivan-Velickovic <i.velickovic@unsw.edu.au>
2023-11-08 14:34:18 +00:00
Ivan-Velickovic
e959f83962 Add support for Star64 SBC
Signed-off-by: Ivan-Velickovic <i.velickovic@unsw.edu.au>
2023-11-08 14:34:18 +00:00
Gerwin Klein
4b8bed320d arm_global: document deadline assert
The comment that PRECISION is too low when the assert fails was wrong.
PRECISION should have no influence on it.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-11-08 11:01:00 +11:00
Gerwin Klein
14ff0c28ec x86 setDeadline: must set at least 1 tick
- make sure the tick count does not underflow
- make sure the tick count does not become 0 in the division, because
  a value of 0 stops the timer.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-11-08 11:01:00 +11:00
Gerwin Klein
dac2857229 mcs: move setDeadline assertions
Move the ksCurTime assertions out of setDeadline, because they are not
necessarily true there. Assert ksCurTime in setNextInterrupt instead.

We only know that the deadline being set is at least ksCurTime -
getTimerPrecision(), which can be slightly in the past (ksCurTime is
already slightly in the past, at kernel entry).

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-11-08 11:01:00 +11:00
Michael McInerney
521f7e3c19 mcs: remove getKernelWcetTicks from refill_ready
Previously, a refill would be ready if its head time
was at most getKernelWcetTicks after the current time.
This would mean that refill_unblock_check could
bring a refill's time forward, which violates an
invariant (namely that the time of the last refill
is at most the period from the time of the head refill).

Moreover, since the time to exit the kernel is always
less than the WCET, this might result in us running
a thread whose refill time is in the future, which
seems to violate the timing model.

Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-11-08 11:01:00 +11:00
Gerwin Klein
d8f4a95b72 manual: group invocations by MCS/non-MCS
Put MCS-only invocations into their own groups and files. This solves
the problem that doxygen gets confused by duplicate function names with
the same parameters.

MCS/non-MCS is distinguished by evaluating the <condition> field in the
API XML definition. If the condition evaluates to true when
CONFIG_KERNEL_MCS is set, it is an MCS-only method, otherwise it is
assumed to be non-MCS or present in both configs.

Fixes #558

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-11-07 16:13:28 +11:00
Gerwin Klein
355f9abc15 sel4.xml: mark Set Space as MCS in the manual
Disambiguate (for the reader) between normal and mcs versions of
SetSpace in the manual. This does not yet solve doxygen confusion.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-11-07 16:13:28 +11:00
Gerwin Klein
beb2c0d176 manual: remove obsolete doxygen settings
HTML_TIMESTAMP and LATEX_TIMESTAMP have been removed in more recent
doxygen versions. Since we are using the defaults, they are safe to
remove in our config file.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-11-07 16:13:27 +11:00
Gerwin Klein
9956101ba6 manual: handle name duplication between groups
Different API groups may contain the same function name, for instance
IRQ_Control GetTrigger for RISC-V vs the same for ARM. Duplicate
function names with identical parameter lists confuse doxygen, leading
it to generate a single merged xml entry for both, which means one of
the entires will be missing and the other will be potentially wrong.

When the functions are placed in different files and different groups
at the same time, doxygen no longer is confused in all cases.

Therefore:

- generate a separate file for each API group
- generate a separate file group_defs.h that contains group definitions
  and declares group nesting

Unfortunately, this does not seem to always work (e.g. the toplevel
MCS/non-MCS syscalls), so manual inspection is still necessary when
adding new calls and separate doxygen runs for duplicate function names
may be necessary. Generating separate files as above enables this
option, should it become necessary in the future.

Fixes #530

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-11-07 16:01:50 +11:00
Gerwin Klein
1de89ba1f2 trivial: spelling (sel4 -> seL4)
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-11-07 16:01:50 +11:00