- Make assignments an atom, the compiler can handle the details.
- Define variables when they are needed.
Signed-off-by: Axel Heider <axelheider@gmx.de>
Moving the type checks avoid the need for conditional compilation. This
also allows simplifying some include file dependencies.
Signed-off-by: Axel Heider <axelheider@gmx.de>
- Provide a nicer string for debugging purposes.
- improve comments about the purpose of __repr__() and __str__()
Signed-off-by: Axel Heider <axelheider@gmx.de>
- A region can't be created from an invalid range
- A region might be too small to support the change. There is no trivial
way to fix this.
Signed-off-by: Axel Heider <axelheider@gmx.de>
Previously, the case where there was no memory region large enough for
the root server objects was unhandled. The loop termination condition
(i>=0) was trivially true for all values of the loop variable. This
commit fixes the issue by making the loop variable signed, and adding a
failure case.
It also:
- adds a check for underflow in the calculation of the address to begin
allocating root server objects,
- removes two redundant checks that were guaranteed to be true, and
- adds some clarifying comments.
Co-authored-by: Axel Heider <axelheider@gmx.de>
Signed-off-by: Matthew Brecknell <matthew@brecknell.net>
The function plic_init_hart() is part of the internal kernel API, so
every SOC's PLIC implementation has to provide it, even if it is
empty.
Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
- Use SMP_TERNARY() macro.
- Rename get_hart_id() to plic_get_current_hart_id(), as this is just a
helper function for the other PLIC code in this file.
Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
RISC-V defines the concept of a PLIC, but leaves the details open. The
driver is for the PLIC of the SiFive U54/U74 SOC, which is used on
the HiFive Unleashed/Unmatched and Polarfire board.
Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
Both Ariane and Rocketchip are experimental platforms that support
accessing peripherals, but the status of support for external interrupts
via a PLIC is unclear and my differ depending on the version that is
synthesized. Using the dummy PLIC driver seems the better option for now
to avoid confusion or even crashes.
Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
- describe PLIC behavior and corner cases.
- provide a common header file for the API.
- add a dummy PLIC driver for spike.
Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
- Move CSR SIE access wrappers to generic code.
- Move CSR SIE/SIP bit constants to header file.
- Rename CSR SIE/SIP bit constants to use the names from the RISC-V
specification.
Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
INTERRUPT_CORE_TIMER is just an alias for KERNEL_TIMER_IRQ. There is
no need for this indirection, KERNEL_TIMER_IRQ can be used directly.
Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
- Initialize all elements active_irq during PLIC init and done't assume
implicitly that irqInvalid is zero.
- make active_irq hold elements of the type irq_t and not uint32_t.
Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
MODE_RESERVED is unused on RISC-V, so remove it from the code base. It
can be brought back when needed based on the state of the ARM
implementation, which has been clean up to remove global dependencies.
Signed-off-by: Axel Heider <axelheider@gmx.de>
- define NUM_RESERVED_REGIONS to align ARM and RSIC-V code
- add runtime checks to catch errors. These checks can't be static or
use assert(), as the parameters are passed by a kernel loader. They
must be considered dynamic and can potentially change any time out
of the kernel's control.
Signed-off-by: Axel Heider <axelheider@gmx.de>
Low version QEMU dump dts not have intc location information
and make subsequent generate dtb failed.
Error information:
Reference to non-existent node or label "/intc@8000000"
So when the QEMU version does not meet the requirements there
should be FATAL_ERROR to notice user early and immediately exit
Signed-off-by: Qiao Yongchang <qiaoyongchang@gmail.com>
In x86/boot_sys.c, we output a warning when `multiboot_mmap_length`
exceed limit. So we should correct its value after the `printf`.
close: #177
Signed-off-by: laokz <laokz@foxmail.com>
Print the available physical memory regions before printing the reserved
virtual memory regions, because as this order is more intuitive. For the
checks the order does not make any difference. Factor out the checks
into separate function to improve code readability.
Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
python2 is not used in the kernel build anymore so the tool
definition is unnecessary.
python2 is also end-of-line so there is no reason to think
we would ever depend on it again.
Signed-off-by: Ben Leslie <benno@brkawy.com>
Check the return value from execute_process calls and fail
with an appropriate message.
This makes debugging of cmake failures much easier.
Signed-off-by: Ben Leslie <benno@brkawy.com>
Ensure the primary core grabs the BKL once the generic kernel init is
done and the secondary cores are running. Improve the comments to
clarify that this is done to play safe.
Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
Since the build system defaults to python3 now, these have not worked
as advertised in a while now (they have test py3 twice).
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
Before, binding a scheduling context to a TCB was not allowed if the
SC was bound to a notification object. Also, binding a SC to a NF was
not allowed if that scheduling context was already bound to a TCB.
Without these restriction it is much easier to move scheduling contexts
around: In effect having a SC bound on both the TCB and a NF acts as if
the thread is running on a donated SC which will be returned when the
tasks calls Recv/Wait, which is done by maybeReturnSchedContext().
This greatly simplifies startup and time-out exception handling for
passive threads having a NF with a SC bound to it.
Signed-off-by: Indan Zupancic <Indan.Zupancic@mep-info.com>
Merge memory regions before checking for reserved areas
Co-authored-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
Signed-off-by: Bertrand Virfollet <bvirfollet@silicom.fr>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
Unify ARM and RISC-V behavior for insert_region(). Print a message and
return an error in release builds, so the caller must decide what to do.
Debug build trigger an assert(), because this is usually something that
should not happen.
Signed-off-by: Axel Heider <axelheider@gmx.de>
- On ARM systems, the UART must be set up first before any error
messages are visible. Move the user image location check after
the platform init that brings up the UART.
- Add the user image location check on RISC-V systems also.
- Make the error message more verbose to clearly show the problem.
Signed-off-by: Axel Heider <axel.heider@hensoldt-cyber.de>
The whole reason we have this comparison is that the user input has
not been checked yet when we get here.
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
In x86, EPT and normal mappings have different cache attributes. This
commit adds an enum for the EPT attributes.
Signed-off-by: Chris Guikema <chris.guikema@dornerworks.com>
Verify that KernelArch and KernelWordSize have been correctly
set after including the platform cmake files.
Signed-off-by: Ben Leslie <benno@brkawy.com>
When using CMake to only build the kernel, an install target is now
provided to copy important outputs into an installation directory.
Currently only the following files are installed:
- ./bin/kernel.elf: Location of kernel.elf binary
- ./libsel4/include: The include root for libsel4
- ./libsel4/src: The c source files for the libsel4 library
To build and install this project to an installation directory should
now only require the following from a clean build directory:
```
export CMAKE_GENERATOR=Ninja
cmake -DCMAKE_INSTALL_PREFIX=<path-to-install> -DOption=Val <src-dir>;
cmake --build .;
cmake --install .;
```
Signed-off-by: Kent McLeod <kent@kry10.com>
This path variable overrides the destination that installation files are
copied to. It was set according to an example CMake toolchain file.
Instead it would be better to allow it to be optionally set by some
caller.
Signed-off-by: Kent McLeod <kent@kry10.com>