Commit Graph
38309 Commits
Author SHA1 Message Date
Sebastian Huber 4f1d616340 bsps/x86_64/amd64: Implement tm27 support
The BSP used the default of <rtems/tm27-default.h>, where
Cause_tm27_intr() does nothing.  Every test which calls CallWithinISR()
waited forever for an interrupt which was never raised, which stopped
five test suites.

Use the software interrupt of the BSP.  Lower_tm27_intr() only has to
enable the interrupts, because the dispatch acknowledges the interrupt
before the handler runs.

Update #5692.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:42:07 -05:00
Sebastian Huber d2974ebefc bsps/x86_64/amd64: Add a software interrupt
The BSP had no interrupt which software can raise, so
rtems_interrupt_raise() was unsatisfied for every vector and there was
no vector available for tm27.

Add BSP_VECTOR_SOFTWARE with its own interrupt descriptor and prologue
and implement the raise, raise on, and pending status of the interrupt
controller with the Local APIC.  A vector is raised by an interprocessor
interrupt to self, which is maskable and stays in the interrupt request
register until the interrupts are enabled.  The Local APIC clears the
request when the processor acknowledges it, so the interrupt cannot be
cleared by software.

Update #5692.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:42:07 -05:00
Sebastian Huber d3b7547610 bsps/x86_64: Correct the vector count
BSP_IRQ_VECTOR_NUMBER is the number of vectors for which the BSP
provides an interrupt descriptor and a prologue.  The vector count was
one higher, so the highest vector passed the validity check of the
interrupt manager while its descriptor was never installed.  Raising it
did nothing and installing a handler for it could never be reached.

Update #5692.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:42:07 -05:00
Sebastian Huber f1adacb1ed bsps/x86_64/amd64: Acknowledge in the dispatch
Each interrupt handler of this BSP acknowledged the interrupt at the
Local APIC itself.  A handler which does not do it leaves the in service
bit set, so the processor priority stays at the level of the vector and
no further interrupt of that priority is ever delivered.  A shared
vector would acknowledge twice.

Acknowledge once in amd64_dispatch_isr() instead, before the handlers
run.  All interrupt sources of this BSP are edge triggered, so an early
acknowledge does not raise the request again, and it lets a handler
which enables interrupts take a nested interrupt of the same vector.

The vectors below the first Local APIC vector are raised by the
processor itself and must not be acknowledged.

Update #5692.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:42:07 -05:00
Sebastian Huber 8e0a5b6939 testsuites/sptests/sp20: Flush the report
The test prints through a stream and ends with fsync(), which makes the
console driver write out what it holds but does not move the buffer of
the stream into the driver first.  Where the standard output is line
buffered nothing is pending and the test passes.  On x86_64/amd64 it is
fully buffered, because the first output happens before there is a file
descriptor to inspect, so the last 721 bytes of the report never left
the buffer.  The test ran to the end and was reported as a failure for
want of its end of test line.

Close #5710.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:40:16 -05:00
Sebastian Huber c347dd177e testsuites/validation: Bound the ISR wait
CallWithinISR() raises an interrupt with Cause_tm27_intr() and then
waits for the handler to run.  The wait was an unbounded busy loop.

Not every BSP can raise an interrupt in software.  moxie, or1k and
x86_64 use the default of <rtems/tm27-default.h>, where
Cause_tm27_intr() does nothing, and the microblaze definition is empty
as well.  The wait spins forever there, so the test case never ends and
takes every later case of the test suite with it.  The unit test suite
produced no result at all on six of the eleven simulators of the
programme for this reason.

Give up after ten million iterations and fail the test case.  The
interrupt arrives a few instructions after it was raised, so the bound
is far out of the way where the mechanism works.  Do the check only
when the bound is reached, because an assertion in the loop would
record ten million test steps.

The unit test suite reports eight test cases and one failure now
instead of hanging, and the failure names Cause_tm27_intr().

Update #5710.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:40:16 -05:00
Sebastian Huber 453e920f88 testsuites/unit: Record fewer rbtree checks
The random operations part of the red-black tree test verifies the tree
after every single operation and the number of operations is cubic in
the tree size, so the check runs 495132 times.  Each one was recorded as
a test step, which is 99.95 percent of the steps of the whole unit test
suite.

Use a quiet check.  It still counts a failure and still reports the line
it happened on, so nothing is lost.  The suite reports 3100 steps
instead of 495367.

This does not make the suite faster.  The time is in the verification
walk itself, which is intended, and the run time on arm, riscv and sparc
is unchanged.

Update #5710.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:40:16 -05:00
Sebastian Huber 4db6143bd2 testsuites/sptests: Bound the timecounter error
The job runs for a number of clock ticks, so the measured duration is
quantised to the tick period.  The test required the difference from the
nominal one second to stay below a millisecond, which can only hold
where the clock tick is shorter than that.  With the default tick of ten
milliseconds it passes by luck.

It failed on the mips simulator.  Allow one clock tick and a millisecond
for the granularity of the loop which observes the stop condition.

Update #5710.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:40:16 -05:00
Sebastian Huber 262b9756c7 testsuites/sptests/sp69: Widen the time window
The wall time since the last period was required to be at least the
nominal 600 milliseconds and at most ten milliseconds more.  The lower
bound had no slack at all, although the measured interval is the sum of
a sleep which is quantised to the clock tick and a busy period which
ends when enough processor time was consumed.  Neither lands exactly on
the nominal value.

On the arm simulator the measurement came out 47 microseconds short and
the test failed about one run in three.  The processor time of the same
status is already checked with ten percent in both directions.

Allow the same ten milliseconds below the nominal value which the upper
bound allows above it.

Update #5710.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:40:16 -05:00
Sebastian Huber 823215560a testsuites/psxtests/psxclock: Add a tolerance
The test computed the number of clock ticks a sleep should consume and
required the measured count to match exactly.  It cannot.  The tick
counter is sampled before the sleep is entered, so a tick which elapses
in between is not part of the measured interval, and how much of the
first tick is left when the sleep starts is not under the control of the
test either.

The measured count came out one too low on i386, mips, moxie and x86_64,
where the emulated system is slow enough to hit the window every time.

Accept one tick in each direction.  A sleep which returns far too early
or far too late still fails.  The test passes on all eleven simulators
of the programme now instead of seven.

Update #5710.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:40:16 -05:00
Sebastian Huber 998f33a14f score: Recognize the clang analyzer
Define RTEMS_STATIC_ANALYSIS for the clang analyzer. For example, this
helps to reduce false positives related to dead branches.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 15:04:51 +00:00
Sebastian Huber 155de47f14 libtests/stringto01: Test the value range check
The test never gave a value outside the range of the value type but
inside the range of the conversion method type.  The range check of
rtems_string_to_int() and rtems_string_to_unsigned_int() had no
coverage.  The lower bound of that check had no coverage in any test.

Add a case for each bound.  The macros hold a value only where the
conversion method type is wider.  On a target where the two types have
the same width the test is unchanged.  Rename TEST_TOO_LARGE_FOR_UCHAR
to TEST_TOO_LARGE_FOR_TYPE, because every narrow type uses it.

Update #5708.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 03:24:52 +02:00
Sebastian Huber 6dca13d962 cpukit/libmisc: Remove the dead range checks
The string to integer template checked the range of the value in
every instantiation.  Six of the seven integer instantiations use a
conversion method whose type is not wider than the type of the value.
For those the two comparisons were constant and the code behind them
was dead.  Coverity reported this as CID 1700407 to CID 1700418.

Emit the range check only where the type of the conversion method is
wider than the type of the value.  Every instantiation which sets
STRING_TO_RESULT_TYPE gives the maximum of that type in
STRING_TO_RESULT_MAX.  The template compares the two maxima.  An
undefined macro drops the check without a diagnostic, so a missing
STRING_TO_RESULT_MAX is an error.

Behaviour is unchanged.  Where the two types have the same width, the
conversion method sets ERANGE.  The template already turns ERANGE into
RTEMS_INVALID_NUMBER.

Update #5708.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 03:21:55 +02:00
Shaunak Datar 3a1f6f9f60 bsps/aarch64/raspberrypi: Add sd card support
- Add the mmc node to the dts
- Regenerate rpi4b_dtb.c from the updated dts
2026-08-19 18:22:10 +00:00
Sebastian Huber 6f53982853 build: Fix the psxfenv01 test state
The tree wide expected-fail state of psxfenv01 carries no reason and
dates back to the commit which added the waf build system.  The test
passes on eight of the eleven architectures which run a full test suite
here, where the test runner reports it as an unexpected pass.

Drop the tree wide state.  State it once for the three architectures
which really fail.  On microblaze, moxie and or1k fesetenv() returns
-134, which is -ENOTSUP, because the C library declares the floating
point environment macros without implementing them.

Link the state from the microblaze and or1k architecture groups and from
the moxie BSP, so that it covers every BSP of those architectures rather
than the variants which run here.

Close #5711.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 13:18:07 -05:00
Sebastian Huber d92289d3fa build: Relink executables if a linkcmds changes
Some BSPs provide linker scripts which are generated during
`./waf configure`, for example the memory layout of
`spec/build/bsps/arm/fvp/linkcmds.yml`. The executable link tasks did not
depend on these generated files, so a reconfiguration which changed a linker
script did not trigger a relink of the test programs, leaving stale
executables.

Add the configuration files collected in env.cfg_files (which include the
generated linker scripts) as dependencies to all executable link tasks:

- the standard cprogram/cxxprogram links via process_start_files(),
- the custom link() task used by link_cc()/link_cxx(), and
- the gnatmake() task.

A change to any configuration file now relinks the executables.

Assisted-by: Claude:claude-opus-4-8 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 12:24:36 -05:00
Sebastian Huber 0788428d48 Revert "build: Add explicit dependencies"
This reverts commit 37163afc97.
2026-08-19 12:24:36 -05:00
Sebastian Huber 4564fe42dc build: Use compiler-generated deps for cc()/cxx()
The bld.cc() and bld.cxx() helper rules compiled sources through a raw
"rule=" command string.  The gccdeps.py plugin only wraps the asm, c,
and cxx task classes, so these rule-based tasks never had their
compiler-generated .d dependency files evaluated.  Header changes such
as a modified `cpukit/include/rtems/score/cpuopts.h` (for example after
toggling the RTEMS_SMP option) did not trigger a recompilation of the
affected objects, resulting in stale objects and linker errors.

Add c_explicit_target and cxx_explicit_target features, analogous to the
existing asm_explicit_target feature, which create genuine c and cxx
tasks with an explicit target node.  These tasks are wrapped by
gccdeps.py and thus honour the automatically generated dependency files.
Extra dependencies are attached as task dep_nodes to preserve the
build ordering for generated headers.

This makes the explicit cpuopts.h dependency workaround unnecessary.

Update #5482.

Assisted-by: Claude:claude-opus-4-8 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 12:24:36 -05:00
Sebastian Huber 1c8a6b8f60 bsps/x86_64/amd64: Add a timecounter
The timecounter of the BSP returned the clock tick counter, so the
uptime advanced once per clock tick and no time point inside a tick
could be expressed.  Tests which need a time source below the tick
resolution cannot work with it, among them the interrupt test
framework, which places its action a quarter of a tick before the tick
it wants the interrupt in.  spintrcritical08 ran into its iteration
limit for this reason.

Use the time stamp counter.  It is free running, so it needs no
interrupt to carry a period and a reader never sees it go backwards.
The local APIC timer offers the same resolution, but its count restarts
with every clock tick and the acknowledge of the tick happens before
the handlers run, so a reader between the restart and the tick handler
cannot tell whether a period has to be added.  Calibrate it in the PIT
window which already calibrates the APIC timer.

Close #5693.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 11:48:54 -05:00
Sebastian Huber f0acecec2a bsps/aarch64/a53: Enable the MMU and the caches
The BSP used the MMU stub, so the MMU stayed off and all memory was
Device-nGnRnE.  Unaligned accesses and DC ZVA are not permitted for
this memory type.  The memset() of the C library uses both, so
bsp_start_clear_bss() raised an alignment fault whenever the size of
the .bss section was not a multiple of 16 bytes.  That is the case for
almost every executable, so no test could run.

The memcpy() of the C library has the same problem.  It is latent
because bsp_start_copy_sections() skips a copy if the load address
equals the run address, which holds for this BSP.

Set up the translation table and enable the MMU and the caches before
the .bss section is cleared, like the other AArch64 BSPs do.

Close #5704.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 11:45:04 -05:00
Sebastian Huber 3503095458 bsps/m68k: Keep the exception frames
These linker command files collect the exception frames without KEEP(),
so --gc-sections removes the terminating zero word which crtend.o
contributes.  crtbegin.o gives __register_frame_info() the start of the
table, and the unwinder walks the entries until it finds a zero length.
It never finds one, walks past the end and reads whatever follows, so
every throw ends in a fatal exception.

Built for the three affected BSPs.  Without the change __FRAME_END__ is
absent from cdtest of each of them.  None of them runs on a simulator
here, so the link verifies the change and not a test run.

Close #5703.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 11:43:52 -05:00
Sebastian Huber 3e99343378 cpukit/libdl: Fix the RAP self-deadlocks
rtems_rap_load() and rtems_rap_unload() take the RAP lock and then call
rtems_rap_find(), which takes it again.  The lock is an ordinary
rtems_mutex, so the second acquisition is a self-deadlock and the system
terminates with INTERNAL_ERROR_THREAD_QUEUE_DEADLOCK.  The error paths
of both functions call rtems_rap_set_error(), which took the lock a
second time as well.

Add rtems_rap_find_unprotected() for callers which already hold the lock
and let rtems_rap_find() wrap it.  Drop the locking from
rtems_rap_set_error(), because all five of its call sites hold the lock
already.

This affected every call to rtems_rap_unload() and every call to
rtems_rap_load() which does not find the application already loaded.
The test dl14 exercises the failing load path and terminated the system
instead of reporting ENOMEM.

Close #5706.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 11:41:35 -05:00
Sebastian Huber 0462fa6b60 cpukit/libmisc: Align the device tree blob
A flattened device tree blob must start at an address which is a
multiple of eight, otherwise libfdt rejects it with FDT_ERR_ALIGNMENT.
The blob was allocated by rtems_malloc(), which provides the heap
alignment of the target.  That is four bytes on MicroBlaze, so no blob
could be loaded there at all.

Close #5708.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 11:40:04 -05:00
Sebastian Huber a2103e0ece cpukit/libmisc: Fix the string to integer overflow
The conversion method returns a type which can be wider than the type
of the value.  The result was stored in the type of the value before
the range was checked, so the check saw a truncated value.  On a 64
bit target rtems_string_to_int() returned success for a value outside
the range of an int.

Keep the result in the type of the conversion method and check its
range before it is narrowed.  Report every range error of the method
and not only the one which saturates to the limit.

Update #5708.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 11:40:04 -05:00
Sebastian Huber 4c864bd4ef cpukit/libdl: Fix unaligned MIPS relocation
rtems_rtl_elf_relocate_rel() read the addend of every relocation with an
aligned load before it knew the type.  R_MIPS_32 is the only data
relocation of this file and may target any byte offset, while every
other one targets an instruction and is aligned by construction.  The
processor takes an address error exception for an unaligned load, so
loading an object with such a relocation failed.

The .eh_frame of a C++ object has two of them, the personality routine
of the common information entry and the language specific data area of
the frame description entry.  Both sit behind a string and neither is
aligned, so dl05 could never load its module.

Use memcpy() for the read and for the R_MIPS_32 write.

Close #5714.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 11:36:14 -05:00
Sebastian Huber c0414b6f37 testsuites/libtests/dl14: Add the FP attribute
The init task loads a RAP application, which formats an error message
with vsnprintf() when the load fails.  On SPARC that uses the floating
point unit, so the system terminated with
INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT.

Every other test of the libdl test suite gives its init task the
RTEMS_FLOATING_POINT attribute.  Do the same here.

Close #5716.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 11:35:49 -05:00
Sebastian Huber aa4eaaceed testsuites/fstests: Fix the tftpfs read loop
The read loop is bounded by a byte budget of type size_t.  Every test
passes SIZE_MAX to say that there is no budget.  Commit bd2055cf5a
cast the budget to ssize_t to silence a sign compare warning, which
turned SIZE_MAX into -1, so the loop condition was false right away
and read() was never called.

Cast the loop variable instead.  It is positive by the first operand
of the condition, so the cast preserves its value.

Close #5713.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 15:03:24 +00:00
Sebastian Huber 330abdc6a8 testsuites/libtests/ttest01: Quote the report
The test runs the test framework on itself, so its output contains a
report of a test suite which fails on purpose: 344 test cases, 1339 test
steps and 795 of them failing.  Every tool which reads the output of a
test executable takes that report for the report of this test and the
deliberate failures for failures of this test.

Quote the output of the self test with a prefix so that it is no longer
a report.  The prefix is added after the report hash is taken and after
the expected output is checked, so neither changes.

The test then has no report of its own and the begin and end of test
messages state its result, which is what it always meant.

Close #5709.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 13:29:54 +00:00
Sebastian Huber 32310c14ac testsuites/libtests: Fix the ttest01 expectations
The test compares the report of the test framework byte by byte
against expectations which contain the file and line of every check.
Commit 4d1604efb6 reformatted the test sources and moved the checks
without updating the expectations, so the test stopped at the first
difference.

Correct the line numbers, the stringified expressions and the hash of
the report.  The test case, check and failure counts are unchanged.

Update #5709.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 13:29:54 +00:00
Vijay Banerjee aa9699509b powerpc/shared/console: Fix uart build for beatnik
This commit fixes implicit declaration error with "BSP_REG_OFF"
2026-08-19 00:03:31 +00:00
Vijay Banerjee 7690646ff5 spec: Add strict align flag for mvme5100
This BSP does not allow unaligned access
2026-08-18 19:28:51 +00:00
Mazen Adel Elmessady b7233f9f03 cpukit: fix compilation error for BSPs that use wkspaceinitmulti.h
fix compilation error for BSPs that use wkspaceinitmulti.h
like the arm/altcycv_devkit
2026-08-18 21:40:08 +03:00
Mazen Adel Elmessady 1be9a4d989 cpukit/include: Refactor heapimpl.h
This commit splits heapimpl.h
to heapimpl.h and heapfirstfitimpl.h.
By moving first-fit-specific definitions into
heapfirstfitimpl.h and keeping only generic
heap helper definitions in heapimpl.h.

Updates:
rtems/rtos/rtems#5620
2026-08-15 20:52:02 +03:00
Yang Zhang 687e15cfac dosfs: Avoid FAT file cache update after failed write
Signed-off-by: Yang Zhang <zhangyang03@kylinos.cn>
2026-08-14 21:20:42 -04:00
Gedare Bloom ddd3c0f885 bsps/riscv: add support for SV48 and SV57
Allow using 48-bit and 57-bit virtual addresses in s-mode with RISC-V.

Also fixes a few formatting issues in mmu-setup.c

Updates #5630

Updates #3337
2026-08-14 12:21:38 -06:00
Gedare Bloom 76962d9a2a bsps/riscv: initialize page tables to 0
Updates #3337
2026-08-14 12:21:38 -06:00
Gedare Bloom bb90ebe84f bsps/riscv: refactor riscv_create_pte
simplify the translation of a page to the ppn
2026-08-14 12:21:38 -06:00
Gedare Bloom f29da813de riscv: set defaults for RISCV_MMU_VIRTUAL_ADDRESS_BITS
Use 32 for rv32 ABI and otherwise use 39 bit virtual addresses.

Fixes #5630
2026-08-14 12:21:38 -06:00
Samuel Viegas 2aca6495ae score: Use uintptr_t type for TLS DTV generation number
- Change TLS_Dynamic_thread_vector
generation_number from uint32_t to uintptr_t.

- Using a machine-word type resolves the FIXME concern
about correctness across architectures, since uintptr_t
is guaranteed to match size on both 32-bit and 64-bit
targets.

Updates #4827
2026-08-13 18:21:38 -05:00
Samuel Viegas 05bd049a02 rtems/msgq: Reject oversized MP queues and add mp11 coverage
- Removed #if 1 clause and error comment section.

- Updated the RTEMS_INVALID_SIZE doxygen comments for
queue create and construct directives.

- Added mp11 checks for oversized global message
queues to verify both rtems_message_queue_create()
and rtems_message_queue_construct() return
RTEMS_INVALID_SIZE when size is
max_packet_payload_size + 1.

- Updated mp11 documentation and expected output
to include these checks.

Updates #4819.
2026-08-13 18:17:41 -05:00
Samuel Viegas 9b8e36803b cpukit/include/rtems/confdefs: Improved comments on #pragmas section
- Added a description to the _CONFIGURE_ASSERT_NOT_NULL() macro
definition in doxygen format.

- Improved comment section above the #pragmas to ignore warnings.

Updates #4831.
2026-08-13 18:12:26 -05:00
Yang Zhang 4400e4521f libcsupport: Fix return value and errno on duplicate open failure
In duplicate_iop() and duplicate2_iop(), when the open handler
(open_h) returns a non-zero status (e.g. positive errno), the
open descriptor was freed via rtems_libio_free(), but the non-zero
status value was returned directly to fcntl()/dup2().

If open_h returned a positive errno value, fcntl()/dup2() would
return it as a positive file descriptor even though the descriptor
had been freed, leading to Use-After-Free (UAF) vulnerabilities.

Fix this by setting errno if rv > 0 and ensuring rv = -1 is
returned on error, satisfying POSIX compliance.
2026-08-13 17:59:57 -05:00
Matteo Concas 0c339acf22 bsps/leon3: Add support for IRQMP IRQMAP
This support is added in the form of two public functions,
`leon3_irqmap_get_unchecked()` that will directly return the mapped
interrupt and `leon3_irqmap_get()` that will perform a check (<63) before
reading the mapping.
2026-08-13 17:55:57 -05:00
Matteo Concas 021d96b86e bsps/irq: Add bsp_interrupt_vector_modify function 2026-08-13 17:55:57 -05:00
Matteo Concas 9a94009a81 bsps/leon3: Check IPI is valid 2026-08-13 17:55:57 -05:00
Matteo Concas 45ff833caa grlib/ambapp: Add support for >31 IRQ PnP info
The second piece of the IRQ number is contained in bits 10
and 11 of the Identification Register
2026-08-13 17:55:57 -05:00
Sebastian Huber 827861d9c1 libtest: Sweep the time point when search stalls
T_interrupt_test() bisects a busy wait to place an interrupt inside the
action of a test.  It adjusts the bracket on an early and on a late
interrupt, but T_INTERRUPT_TEST_CONTINUE fell through both cases: the
bounds stayed as they were, the sample index did not advance, and the
next iteration used the very same busy count.  A test whose interrupt
reliably lands inside the action, yet which is not satisfied by that
particular time point, therefore repeated one time point until it ran
out of iterations.

A continue says the interrupt hit the action but reports nothing about
early or late, so there is no gradient to bisect on.  Count them, and
once the search has produced nothing else for a while, step the time
point through the bracket instead of using its middle.  A stepped time
point which leaves the action yields an early or a late result again,
which clears the counter and lets the bisection narrow the bracket
around the action.  A search which does make progress never reaches the
counter and keeps the behaviour it had.

The bracket is covered in a fixed number of steps rather than in steps
of one busy count.  This is not needed to make the search converge, it
keeps the sweep predictable: the step follows the width of the bracket,
a bracket narrower than the step count degrades to a step of one, and
there is no division by a width which may be zero.  The last point
needs the lower bound to stay below the upper bound.  The bisection did
not guarantee this, since a busy count taken from the bracket of all
samples is accounted to one sample only.  Pull the opposite bound along
in this case.

spintrcritical20 on the erc32 BSP hit exactly this.  It reported
T_INTERRUPT_TEST_TIMEOUT with 9997 of its 10000 iterations landing
inside the action and none of them satisfying the test.  It now
completes.  All twenty spintrcritical tests pass on erc32, leon2,
gr712rc, gr740 and gr740 in SMP configuration.

The simulator is deterministic, so repeating a test under it adds no
information.  A host simulation of the search over randomised action
windows, satisfied only after three distinct outcomes, completes in 200
of 200 runs with the sweep and in 1 of 200 without it.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-13 17:55:06 -05:00
Sebastian Huber 3c8572d74f spintrcritical21: Fix sporadic test failures
The interrupt handler runs on every clock tick, also between the test
iterations.  Sending the event outside of the action left it pending, so
the event receive of the next action returned immediately instead of
blocking and the interrupt could no longer hit the critical section.
Send the event only if the action is in progress.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-13 17:55:06 -05:00
Sebastian Huber f8d6c05397 spintrcritical0[1-5]: Fix sporadic test failures
The interrupt handler runs on every clock tick, also between the test
iterations.  Releasing the semaphore outside of the action left a count
behind, so the semaphore obtain of the next action returned immediately
instead of blocking and the interrupt could no longer hit the critical
section.  Release the semaphore only if the action is in progress.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-13 17:55:06 -05:00
Sebastian Huber 6aced47117 libtest: Use spaces for comment indentation
Several comments in this file were indented with tabs while the rest of
the file uses spaces.  Convert them.  This is a whitespace only change.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-13 17:55:06 -05:00