On arm-none-elf-eabi-gcc, -fshort-enums is on by default and
is compatible with unsigned char (but not *signed* char) so we
need to add support for this to the test_op macros.
Also, _test_abort() when these type failures happen so that the
failure is more obviously an issue with the compiler/test setup,
not the tests themselves.
Signed-off-by: julia <git.ts@trainwit.ch>
This would previously fail at runtime, but we can fail the build
instead and catch this earlier.
In file included from /src/helpers.h:13,
from /src/tests/ipc.c:13:
/projects/sel4test/apps/sel4test-tests/src/tests/ipc.c:
In function ‘test_ipc_pair’:
/projects/seL4_libs/libsel4test/include/sel4test/test.h:243:10:
error: static assertion failed: "sizeof(res) does not match
sizeof(SUCCESS), use of test_eq incorrect"
243 | _Static_assert(sizeof(_a) == sizeof(_b), \
| ^~~~~~~~~~~~~~
/projects/seL4_libs/libsel4test/include/sel4test/test.h:270:24:
note: in expansion of macro ‘test_op’
270 | #define test_eq(a, b) test_op(a, b, ==)
| ^~~~~~~
/projects/sel4test/apps/sel4test-tests/src/tests/ipc.c:347:25:
note: in expansion of macro ‘test_eq’
347 | test_eq(res, SUCCESS);
| ^~~~~~~
Signed-off-by: julia <git.ts@trainwit.ch>
Because of GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99587
using has_attribute is not reliable and can give compile warnings
that will be turned into errors because of -Werror.
The retain atribute was added to support linking with LLVM's linker
by commit 12d0d9, as clang has LTO enabled by default, so limiting
it to CLang is fine until GCC enables LTO too.
Signed-off-by: Indan Zupancic <indan@nul.nu>
If there is no ltimer for a particular platform, then these functions
do not exist, so make the init_default_timer_ops() always return
errors.
The intended way to avoid this is to not use the timer when
CONFIG_LIB_PLAT_SUPPORT_NO_PLATFORM_LTIMER
is set.
Signed-off-by: julia <git.ts@trainwit.ch>
mmap is expected to return an error if a length of 0 is ever requested.
The caller is likely doing something wrong if a 0 length is requested
and it leads for hard to find bugs if we just return the current address
of the end of available memory.
Signed-off-by: Kent McLeod <1759184+kent-mcleod@users.noreply.github.com>
riscv32 linux abi doesn't define lseek. Instead llseek uses 2 32bit
arguments for a 64bit offset and returns the value via a pointer to
64bit value in user memory.
Instead of calling a syscall within a syscall, just make a shared
internal function to call for both lseek and llseek.
Signed-off-by: Kent McLeod <kent@kry10.com>
Compatibility with versions <3.10 is going away.
As it happens, we're not using any CMake features that
have changed between 3.7 and 3.16, so bump the lowest
version to 3.16.
Signed-off-by: Peter Chubb <Peter.Chubb@unsw.edu.au>
The same scenario as for aarch64: If the cycle counter is disabled
during a read, the operation can be preempted and lose the count of
cycles for the duration of the preemption.
Issue: #34
Signed-off-by: Szymon Duchniewicz <s.duchniewicz@unsw.edu.au>
unused attribute does not prevent the sections from being
garbage-collected during link-time optimisation. This may trigger
undefined references errors to [__start|__stop]_test_case symbols
that are expected to be emitted by the linker anyway.
Adding "retain" attribute makes sure that the section and its
associated symbols are kept regardless of linker's garbage
collection. Another fix could be adding "nostart-stop-gc" to the
linker flags, but since it is only one section (_test_case)
where its __start/__stop symbols are references, adding retain to
it makes more sense. This additional functionality requires
binutils version 2.36 or later.
Sponsored by: DARPA.
Signed-off-by: Hesham Almatary <hesham.almatary@cl.cam.ac.uk>
PT_PHDR is emitted by ld.lld but not ld.bfd. This segment should only
exist if the program header *is* part of the program memory image itself
(which is not the case in seL4, as it copies the program header in the
stack). This is important as muslc’s TLS init is relying on the existence
of PT_PHDR to get the base address of the image in memory and from that,
it calculates the TLS base for the source ELF. The calculation will be
wrong in seL4 as the program header is copied in the stack; thus it may
trigger a page fault if the new TLS base is not mapped, or affects the
integrity of programs relying on TLS variables (e.g., those with
__thread).
By setting PT_PHDR's segment to PT_NULL, muslc will skip this search and
won't do any relocations for the TLS segment which is part of the
loaded ELF image itself, thus getting the correct mapped address.
Sponsored by: DARPA.
Signed-off-by: Hesham Almatary <hesham.almatary@cl.cam.ac.uk>
Caused by recursive stdio function calling.
Just use seL4_DebugPutString() directly to avoid any problems.
Signed-off-by: Indan Zupancic <indan@nul.nu>
Make sure this macro is defined based on all possible configurations.
Also update simple_default_nth_cap() to skip based on all features
correctly.
Signed-off-by: Robbie VanVossen <robert.vanvossen@dornerworks.com>
The aarch64 vspace API is changed to only have a single pagetable object
and capability type for all intermediate page table levels. The root
vspace object is still a separate object and capability type.
Signed-off-by: Kent McLeod <kent@kry10.com>
Mis-configuring the watermark reserve pools can cause the allocator to
get stuck when needing to perform nested allocation and won't have
sufficient resources. It's a good idea to return an error when the
configuration API is misused causing a configuration request to be
ignored.
Signed-off-by: Kent McLeod <kent@kry10.com>
If either allocman_configure_mspace_reserve or
allocman_configure_utspace_reserve returns early it still needs to
end the started operation otherwise the allocator will be left in an
invalid state leading to it's watermarks never being refilled.
Signed-off-by: Kent McLeod <kent@kry10.com>
For some reason astyle wants to indent the second line of the comment
by always another increment if the line does not start with its own
comment start marker. This change avoids that trigger.
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
This commit registers a __NR_munmap call, which prevents the
"libsel4muslcsys: Error attempting syscall 215" error from printing.
This syscall is called when a large malloc'd region is freed, since mmap
uses a bump allocator where free is never expected to be called. Instead
of printing a generic warning, a descriptive error is printed which can
alert the user of any potential issues.
Signed-off-by: Chris Guikema <chris.guikema@dornerworks.com>
This commit matches the ifdefs around map_iospace_page. It also checks
for the presence of the IOMMU, SMMU, or TK1_SMMU instead of
checking against an architecture.
Signed-off-by: Chris Guikema <chris.guikema@dornerworks.com>
It's invalid to return regions that are not page aligned. We round
lengths up to the nearest page size. munmap and mremmap are not
supported with static mmap and so we don't need to track this rounding
difference anywhere.
Signed-off-by: Kent McLeod <kent@kry10.com>
mmap creates mappings in multiples of the page size which is always at
least 4096. Assert that the return value is at least page size aligned.
Callers of mmap are allowed to assume that the memory returned is 4k
aligned and this can lead to subtle errors if non-aligned values are
returned.
Signed-off-by: Kent McLeod <kent@kry10.com>
CPIO data cannot be modified, it's basically ROM. The CPIO APIs have
been changed some time back to use the const qualifier to properly
reflect this. Add the const qualifier here also to avoid compiler
warnings.
Signed-off-by: Axel Heider <axel.heider@hensoldt.net>
There we assert that the only file type admitted is FILE_TYPE_CPIO,
however libsel4camkes implements support to FILE_TYPE_SOCKET.
Signed-off-by: Carmelo Pintaudi <carmelo.pintaudi@hensoldt-cyber.de>
- Use seL4_Word printf modifier for seL4_CPtr type.
- Cast return value to (seL4_Error) as the API defines custom error
codes starting after the seL4_Error enum finishes.
Signed-off-by: Kent McLeod <kent@kry10.com>
Remove support for ARMv6 and the only CPU we support for that
architecture. This is because support is being removed from the kernel
after removal of the only ARMv6 platform, kzm/imx31.
Signed-off-by: Kent McLeod <kent@kry10.com>
This repository is not yet fully style-clean, and the policy is to
update files as we touch them, not in one big go. Until we have reached
a fully style-clean state, we should check only the diff on push, not
all files.
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>