Commit Graph
38364 Commits
Author SHA1 Message Date
Sebastian Huber 5a96cb0f20 testsuites/psxtests: Fix the psx13 mode restore
FutimensTest() restored the mode of its test file with a chmod() call
which read fstat.st_mode before it ever called stat().  The structure
held whatever the stack slot contained, so the file received a mode
decided by the previous frame.  On or1k that mode denied write access
to the owner, and futimens( fd, NULL ) failed with EACCES.  The other
architectures passed because their stack held a usable mode.

Read the mode with stat() right after the test opens the file.  This
follows UtimensatTest() in the same file.

Built and run for or1k/generic_or1k on Qemu.  psx13 passes with the
change and fails without it.

Close #5724.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-31 15:30:48 +00:00
Sebastian Huber ebcb51aadb bsps/powerpc/psim: Fix the counter frequency
bsp_clicks_per_usec held the value of BSP_bus_frequency, which this BSP
states in kHz.  _CPU_Counter_frequency() multiplies it by 1000000, so
the product was 10^10 and did not fit in the uint32_t return type.  It
wrapped to 1410065408.  The clock driver installs the same time base
register as a timecounter of 10 MHz, so the two disagreed by a factor
of 141.  ttest01 compared a tick to time round trip and saw
1.099999999 where it expects 1.100000000.

rtems_bsp_delay() reads the same variable and therefore spun 1000 times
too long.

Derive the clicks per microsecond from the bus frequency and the time
base divisor, as mvme3100 does.  The counter frequency then equals the
frequency of the timecounter.

Built and run for powerpc/psim on the GDB simulator.  ttest01 passes
with the change and fails without it.

Close #5725.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-31 15:18:44 +00:00
Chris Johns 3a30552451 cpukit/shell: Add prio command to print all priorities for all threads
This command is useful on system that have POSIX and classic threads
running together.

Closes #5732
2026-08-27 12:14:28 +10:00
Mohamed Ayman 181e86a199 Fix_Issue_1828: Respect forever flag on failed login
The shell main loop used a single result variable both to record whether
the previous login/command attempt succeeded and to decide whether
the loop should continue.

When the login function failed after repeated incorrect passwords,
result became false, and the loop condition then exited the shell
regardless of the forever flag being set.

Track login failures separately with a new login_failed flag,
and use it alongside result in the loop condition so that
a failed login correctly falls through to a new login attempt when
forever is set, matching the documented behavior of that flag.
Other exit paths EOF, explicit logout and exit are unaffected.
2026-08-20 18:32:26 -05:00
Yang Zhang f5ced1f843 dosfs: Fix dangling fs_info pointer on initialization error
In msdos_initialize_support(), temp_mt_entry->fs_info was
assigned the allocated fs_info structure before volume initialization.
If subsequent steps failed (such as volume init, root directory
open, or cluster buffer allocation), fs_info was freed, but
temp_mt_entry->fs_info was left pointing to freed memory.

This created a dangling pointer in the mount table entry, which
could lead to use-after-free or double-free errors during cleanup.

Fix this by delaying the assignment of temp_mt_entry->fs_info until
all initialization steps have successfully completed.
2026-08-20 18:28:43 -05:00
Sebastian Huber 62c5b37a62 bsps/mips/jmr3904: Raise tm27 with a software int
Cause_tm27_intr() reprogrammed timer 0 of the TX3904 to fire after 20
clicks.  That timer is the clock tick, so the macro left its compare
register at 20 instead of the clicks per tick, and Clear_tm27_intr() did
not restore it.  It also made the interrupt arrive 20 clicks later
rather than at once.

The validation tests which run code from an interrupt depend on the
arrival being immediate.  They hook the block operation of the scheduler
and submit the request from there, so the interrupt has to reach the
thread while it intends to block.  With the delay the thread was blocked
long before, and 245 test steps of ts-validation-no-clock-0 and one of
ts-validation-one-cpu-0 checked a state which had already passed.

The processor has two software interrupts and the BSP drives them
through rtems_interrupt_raise() already, so use one of them.  It is
pending from the write on, it needs no timer, and it leaves the clock
tick alone.  Both test suites report no failed step now.

The entry overhead which tm27 reports falls from 26 to 7, because the
measured path no longer contains the five register writes which armed
the timer.

Close #5688.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:23:09 -05:00
Sebastian Huber a57578d817 bsps/mips/jmr3904: Mask the processor sources
The sources which the interrupt controller does not level are masked in
the status register of the processor: the first external interrupt and
the two software interrupts.  They reported that they can neither be
enabled nor disabled and the operations were unsatisfied, although the
mask is global state now.

Drive that mask, and report the attributes of the vectors which the
controller levels completely: a vector which can be enabled may also be
enabled, which is the attribute the validation tests read.

Update #5688.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:23:09 -05:00
Sebastian Huber 20d5fc24f2 bsps/mips, cpukit: Make the interrupt mask global
The context switch restored the interrupt mask of the status register
from the context of the incoming thread, and _CPU_Context_Initialize()
put every source into the context of every thread.  The mask is the
enable of each interrupt source, which rtems_interrupt_vector_enable()
and its counterpart own, so a disable did not survive the next context
switch and could not be offered at all.

Keep only the coprocessor enable and the interrupt enable per thread.
The interrupt enable is the interrupt level of this port.  The mask
becomes global state which the BSP establishes once, with the value the
context of a thread carried before, so that the sources a board enables
do not change.

Update #5688.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:23:09 -05:00
Sebastian Huber 397d729f22 cpukit/score/cpu/mips: Fix the vector base
MIPS_INTERRUPT_BASE expanded to MIPS_EXCEPTION_BASE+32 without
parentheses, so subtracting it added 32 instead of subtracting it.  The
only subtraction in the tree is the source number of the TX3904
interrupt controller, which therefore computed 64 for the first source
and no source ever fell into the range of the controller.  Not one
vector reported that it can be enabled or disabled, so the validation
tests found no testable vector, used an invalid one, and
ts-validation-intr stopped before its end.

Every other use adds to the base and is unchanged by the parentheses.

Update #5688.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:23:09 -05:00
Sebastian Huber d869458bbc bsps/mips/jmr3904: Add the interrupt controller
The interrupt controller operations were not implemented.  Every one of
them returned RTEMS_UNSATISFIED, so ts-validation-intr reported 2511
failures, most of them because rtems_interrupt_vector_is_enabled() must
work for every valid vector.

Drive the controller of the TX3904.  A source passes when its level in
the interrupt level registers is greater than the level in the interrupt
mask register, so the level is both the priority and the enable, and the
vector numbers of the BSP are the source numbers of the controller.  A
bit of the interrupt status register reads as zero while its source is
asserted.  The two software interrupts of the processor are raised and
cleared in the cause register and are the only sources this board can
raise.

The sources which do not pass the controller are masked in the status
register, which the context of every thread enables completely, so they
report as enabled and nothing disables them.

The other BSPs of the architecture keep the operations which are not
implemented, now in their own file.

Thirteen failures remain.  They need a vector which the validation tests
can raise and also enable and disable, and this board has none: the
status register belongs to the context of a thread, so a disable of a
software interrupt would not survive a context switch.

Update #5688.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:23:09 -05:00
Sebastian Huber 94084e707c cpukit/score/cpu/mips: Fix the interrupt level
The processor has one interrupt enable bit.  The interrupt mask of the
status register is a set of independent enables of the interrupt
sources, not a level, which is what the comment above the declarations
already said: only the enable bit belongs to the level.

The implementation put the mask bits into the level instead.  Level zero
enables every source, which is the same status register content as the
level whose bits are all set, so those two levels could not be told
apart and _CPU_ISR_Get_level() could not invert _CPU_ISR_Set_level() for
both.  sp37 sets every level from zero up to the mask and requires the
value to come back, so it could not pass.

Report the enable bit as the level and make the mask of the task mode
name that one bit, as the ports of the processors with one enable bit
do.  The context of a thread now enables every source of the status
register, so a source disabled at the interrupt controller stays
disabled across a context switch.

Update #5688.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:23:09 -05:00
Sebastian Huber fe373582e7 cpukit/score/cpu/mips: Fix ISR level zero
_CPU_ISR_Set_level() enables every interrupt source for level zero,
which writes the same status register content as the highest level of
this encoding.  _CPU_ISR_Get_level() mapped that content back to the
highest level, so a thread which never changed its level reported 127
instead of 0.

The validation test framework checks the level after every test case and
reported hundreds of "Wrong ISR level (127)" failures.  A caller uses a
non-zero level to mean that interrupts are disabled, so report the
canonical value for the state in which none is.

Update #5688.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:23:09 -05:00
Vijay Banerjee 6cd5277f92 bsps/powerpc/motorola_powerpc: Use page tables for MVME5100 VME init
The number of DBATs are limited to 4 for most mvme boards, and page table
allows vme users to configure larger vme windows.

This commit also adds a CSR window for MVME5100
2026-08-20 18:21:33 -05:00
Sebastian Huber 55f0bb55fe cpukit/score/cpu/or1k: Implement TLS
The port declared a thread-local storage variant and implemented none
of it.  _CPU_Context_Initialize() discarded the thread-local storage
area, _CPU_Get_TLS_thread_pointer() returned NULL, and the context
switch skipped r10, so every thread shared whatever value that register
held.

r10 is the thread pointer of the OpenRISC ABI.  The compiler emits an
access as an offset added to it and treats it as a fixed register, so a
register variable cannot name it.

Initialize it from _TLS_Initialize_area(), restore it in the context
switch, return it from _CPU_Get_TLS_thread_pointer(), and set it in
_CPU_Use_thread_local_storage().  The storage then also works during
system initialization, before the first context is restored.

The linker computes the offsets relative to a 16 byte thread control
block and reserves an aligned block of that size before the data:

  base = align_power( TCB_SIZE, alignment ) - TCB_SIZE

See tpoff() in bfd/elf32-or1k.c.  Variant 10 places the data right
after the block and hands out its address as the thread pointer, so
every offset is too large by the padding, and an object with an
alignment above 16 bytes reads as zero.  Use variant 11, which reserves
an aligned block, and point the thread pointer at the first byte after
the block.  Give the block the 16 bytes which the linker of this
architecture assumes.  It is 8 on a 32 bit target otherwise.

sptls01, sptls02, sptls04, ts-validation-tls-0 and ts-validation-tls-1
pass with this change.

Close #5685.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:14:29 -05:00
Sebastian Huber a36e3a39ab cpukit/score/cpu/or1k: Fix the context validation
_CPU_Context_validate() ignored its pattern and filled the registers
with a counter, so the three tasks of spcontext01 wrote the same values
and a leak between them could not be seen.  It kept the entry stack
pointer in r31 and then filled r31 with that counter, so the comparison
of the stack pointer could not hold and the routine returned on its
first pass, which hung the test.  _CPU_Context_volatile_clobber()
covered eight of the volatile registers.

The stack pointer is compared through the frame, since no register is
left for it.

Close #5686.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-21 09:13:33 +10:00
Sebastian Huber 4167862e70 cpukit/score/cpu/or1k: Use a reserved opcode
A ".word 0" is an "l.j 0" on this architecture, a branch to its own
address, so spfatal26 spun until its timeout instead of raising the
illegal instruction exception.

Update #5686.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-21 09:13:33 +10:00
Sebastian Huber 7c37d17e4a bsps/or1k: Keep the exception vector table
The linker script matched the .vector input section without KEEP.  That
section is reached only through the hardware exception vectors, so no
symbol references it and --gc-sections removed it.  The executables ended
up with an empty .vector section and no exception was ever delivered.

This includes the tick timer exception, so the clock tick never fired and
every test which waits for a tick ran until the test runner killed it.
Only the tests which need no tick produced a result at all.

The ticker sample completes in about a second now instead of hitting its
timeout.

Update #5686.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-21 09:13:33 +10:00
Sebastian Huber 5942900744 bsps/or1k: Sort the destructors
The script matched .fini_array before its sorted input sections, which
is the reverse of every other script in the tree, so the destructors
with a priority ran before the one without and spglobalcon02 failed.

Close #5687.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:12:10 -05:00
Sebastian Huber e724843952 bsps/or1k/generic_or1k: Stop Qemu on reset
The BSP used the shared reset loop, so Qemu kept running after the
system terminated.  An automated test never ended and every test of the
suite hit its timeout.

The virtual machine of Qemu provides a SiFive test finisher.  Write the
pass or fail value to it in bsp_reset() and keep the loop for the
or1k-sim machine, which has no such device.

Update #5687.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:12:10 -05:00
Sebastian Huber e208634ac3 bsps/or1k/generic_or1k: Fix the include guard
The bsp.h and bsp/generic_or1k.h headers both used
LIBBSP_GENERIC_OR1K_H, so whichever was included first suppressed the
other.  Since bsp.h includes bsp/generic_or1k.h, every file which
included bsp.h first saw none of the register definitions.

Use the LIBBSP_<arch>_<bsp>_BSP_H form of the other BSPs for bsp.h and
leave the register header with the name it owns.

Update #5687.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:12:10 -05:00
Sebastian Huber c6666a5a53 cpukit/score/cpu/mips: Validate the context
The two routines were empty, so the validation task of spcontext01 spun
in a loop which checked nothing.

The zero register, the stack pointer, the global pointer and the k0 and
k1 of the exception handler stay out of the pattern, and so do the
registers of the FPU, which need it enabled in the status register of
the coprocessor.

Close #5691.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:07:36 -05:00
Sebastian Huber 2798059616 bsps/mips/jmr3904: Run spfatal26
The test was excluded with a null reason.  It executes
_CPU_Instruction_illegal() and needs the port to trap it and report
RTEMS_FATAL_SOURCE_EXCEPTION with a printable exception frame, which the
port did not do until the exception reporting was fixed.  It passes now.

Update #5691.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:07:36 -05:00
Sebastian Huber 7ec23f42d6 bsps/mips: Report an exception as one
An exception which no handler consumed ended in
rtems_fatal_error_occurred(1), which is INTERNAL_ERROR_RTEMS_API, where
every other port reports RTEMS_FATAL_SOURCE_EXCEPTION with the exception
frame as the code.  A fatal error extension cannot recognise the former,
so a test which expects an exception and returns from its extension with
longjmp() could not resume.  That pattern is how tc-compiler-builtins.c
checks the break which the compiler emits for a division by zero, and it
stopped ts-unit-no-clock-0.

The exception vectors are dispatched like interrupt vectors and the GDB
stub installs handlers on several of them, so the dispatch stays and the
frame of the exception being vectored is published for the default
handler to recognise.  Report a vector without a frame as a spurious
interrupt, which is what the shared default handler does.

Do not print here.  The fatal error extension prints the frame when the
system really terminates, so a recovered exception stays silent instead
of writing two lines into the test output on every recovery.  The cause
table moves next to _CPU_Exception_frame_print(), which gains the cause
of the exception it prints.

Update #5691.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:07:36 -05:00
Sebastian Huber b28d2837a5 bsps/mips: Keep the exception frames
The 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 found one, walked past the end and read whatever followed, so
every throw ended in a fatal exception.

cdtest and dl05 died in strlen() on the augmentation string of a common
information entry which was not one.  The other BSPs of the
architecture have the same defect and are changed as well.  Only
jmr3904 of them runs on a simulator here, where cdtest now passes, and
dl05 throws and catches across the boundary of a loaded object.

Update #5691.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:07:36 -05:00
Sebastian Huber 662c987769 cpukit/score/cpu/i386: Save the TLS segment
_CPU_Context_switch() installed the descriptor of GS of the heir in the
descriptor table and loaded the segment register from it, but never
saved the descriptor of the running thread.  A context which was not
built by _CPU_Context_Initialize() therefore held a descriptor which is
not present, and loading the segment register from it raised a general
protection exception.  tmcontext01 switches to such a context to time a
switch.

Close #5695.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:06:12 -05:00
Sebastian Huber c7ea9ed510 cpukit/score/cpu/i386: Get the thread pointer
The thread pointer of this port is the base address of the segment
which _CPU_Use_thread_local_storage() installs in the descriptor of GS.
_CPU_Get_TLS_thread_pointer() returned the address of the descriptor in
the context instead, so the offset which sptls01 computes from it was
meaningless.

Update #5695.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:06:12 -05:00
Sebastian Huber 89ec93b6ef bsps/i386/pc386: Implement tm27 support
Cause_tm27_intr() executed an INT instruction for a vector which had no
handler and Install_tm27_vector() did nothing, so every test which calls
CallWithinISR() waited forever for a handler which could not run.  An
INT instruction is also executed while the interrupts are disabled,
which the tests do not expect of an interrupt.

Use the software interrupt of the BSP instead.

Close #5696.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:04:24 -05:00
Sebastian Huber f0a0d3774c bsps/i386: Add a software interrupt
The BSP had no interrupt which software can raise.  The 8259A has no
software trigger, so rtems_interrupt_raise() was unsatisfied for every
vector and there was no vector available for tm27.

Add BSP_SOFTWARE_IRQ with its own interrupt descriptor and prologue and
raise it by an interprocessor interrupt to self at the Local APIC.  A
processor which has one is detected through the identification flag, so
the processors this BSP started out with keep the previous behaviour.

Enabling the Local APIC takes the 8259A off the interrupt line of the
processor, so the first local vector table entry passes it through.  The
Local APIC clears the request when the processor acknowledges it, so the
interrupt cannot be cleared by software.  The dispatch acknowledges
before the handlers run, which lets a handler which enables the
interrupts take a nested interrupt of the same vector.

Update #5696.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:04:24 -05:00
Sebastian Huber c55cbcfb63 bsps/i386: Do not mask non 8259A vectors
Enabling or disabling a vector went to the 8259A for every vector.  The
BSP has a vector above the 8259A lines for the interprocessor interrupt,
so the calls wrote a mask bit which does not exist and reported success
for a vector the 8259A does not control.

Update #5696.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:04:24 -05:00
Sebastian Huber 232ddda74e bsps/i386: Align the interrupt frame for fxsave
The SSE part of the interrupt prologue saves the unit state with
fxsave, which faults with a general protection exception unless its
operand is 16 byte aligned.  FRM_SIZ is a multiple of 16, so subtracting
it keeps the alignment of the interrupted stack pointer without
establishing it, and the stack pointer of an interrupted context is not
necessarily aligned.  The stack is aligned further down for the C calls,
which is after the fxsave.

Align the frame right after it is allocated.  The original stack pointer
is already in eax at that point and is stored to ESP_OFF as before, so
the epilogue is unchanged.

This affects the BSP variants built with SSE.  Without it psxfenv01
terminates with an exception on pc586-sse as soon as it raises a
floating point exception.

Update #5696.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:04:24 -05:00
Sebastian Huber e37b4262bb cpukit/score/cpu/i386: Validate the context
The two routines were empty, so the validation task of spcontext01 spun
in a loop which checked nothing.

The floating point context of this port is the control word of the x87
unit and the control and status register of the SSE unit, and it exists
only in an SSE build.  Only their rounding mode carries the pattern, so
that no exception is unmasked and the precision does not change.

Close #5697.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:02:47 -05:00
Sebastian Huber 4c964ba634 cpukit/score/cpu/i386: Use the ud2 instruction
_CPU_Instruction_illegal() emitted a ".word 0".  The two zero bytes are
the encoding of an add instruction on x86, so nothing was raised and the
caller ran on.  spfatal26 asserted right behind the call.

Use the undefined instruction, which is the architected way to raise the
invalid opcode exception.

Update #5697.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 18:02:47 -05:00
Sebastian Huber 9361427b18 bsps/microblaze/microblaze_fpga: Add tm27 support
Cause_tm27_intr() was empty, so every test which calls CallWithinISR()
waited forever and five test suites never finished.

The AXI interrupt controller accepts software writes to its status
register only while the hardware interrupt inputs are disabled, which
the clock needs enabled, so the controller cannot raise an interrupt.
Use the second counter of the AXI timer instead.  It shares the
interrupt of the counter used by the clock, so the interrupt is shared
and each handler checks its own interrupt bit.

The dispatch acknowledges the interrupt controller only after the
handler returned, so Lower_tm27_intr() acknowledges by itself to let the
interrupt raised next arrive as a nested interrupt.

Close #5699.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-21 09:01:19 +10:00
Sebastian Huber 4d862841cc bsps/microblaze: Fix the interrupt attributes
The interrupt enable register holds one bit per vector, so a vector
can be enabled and disabled.  The attributes claimed only that this
may be possible, so the validation test found no testable vector.

The interrupt status register holds the pending state of each source,
so report it instead of an unsatisfied request.

Update #5699.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-21 09:01:19 +10:00
Sebastian Huber 2b050c1951 bsps/microblaze: Fix the benchmark timer
The timer is loaded with a value derived from the clock frequency and
the tick interval, but the read used the literal reload value of one
BSP variant and the frequency of the build time option.  On a variant
with another frequency every read returned the same wrong value and
tmck never finished.

Record the reload value and the frequency used by the initialization.

Update #5699.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-21 09:01:19 +10:00
Sebastian Huber 6532ddc955 bsps/microblaze: Do not translate the newline
rtems_putc() emits the carriage return before the newline, so the
console driver must not do it again.  Every line left the UART as
CR CR LF.  The test runner strips one CR and the parser of the test
output anchors five expressions at the end of the line, which the
remaining CR prevented from matching.  The parser stopped at the sixth
line of the report, so no test case of a report based test was ever
recorded and 42 tests were judged incomplete.

Update #5699.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-21 09:01:19 +10:00
Sebastian Huber 43d18c66fe bsps/shared/acpi: Allow use before the subsystem
AcpiInitializeTables() runs from bsp_start(), long before there is a
heap for AcpiInitializeSubsystem() to create the mutex objects from.
The handle of a predefined mutex is a null pointer until then, so every
table which the table manager installs early reported that it could not
acquire the table mutex and then that it could not release it.

Treat a null handle as done rather than as a bad parameter.  There is a
single thread of execution at that point and nothing to serialize.

The errors were not visible so far because the ACPICA output goes to the
standard output, whose buffer is discarded at the end of a test run.
Routing it to printk() makes them appear, 19001 lines in one suite run.

Close #5705.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-21 09:00:39 +10:00
Sebastian Huber e19acd2a68 cpukit/libdl: Fix the RISC-V relocations
The RISC-V backend had four defects, each of which alone prevented a
module from loading.

R_RISCV_RELAX, the four thread local storage types and the two
ULEB128 types had no case and failed the load.  The addend of the
relocation was never applied.  Relocations against a section symbol
were skipped, which left the C++ unwind tables unrelocated.

R_RISCV_PCREL_LO12_I and R_RISCV_PCREL_LO12_S used the symbol of
their own record.  The psABI defines this symbol as a label on the
AUIPC instruction and the value as the low twelve bits of the value
computed by the paired R_RISCV_PCREL_HI20.  Take the value from the
paired relocation and defer it if that one is not yet applied.

Close #5707.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:59:08 -05:00
Sebastian Huber 70d9de174e cpukit/score/cpu/riscv: Add relocation types
Add R_RISCV_IRELATIVE, R_RISCV_PLT32, R_RISCV_SET_ULEB128 and
R_RISCV_SUB_ULEB128 of the RISC-V psABI.  The dynamic loader needs the
last two to process objects produced by recent tool chains.

Update #5707.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:59:08 -05:00
Sebastian Huber d0545d272c testsuites/validation: Take the interrupted stack
ScoreIsrValIsr checks that the context which an interrupt during the
multitasking start interrupted ran on the stack of the thread which was
running.  A wrapper of the interrupt dispatch of the architecture takes
the address of that stack, and there is one for six architectures only.
Everywhere else the address stays zero, the check cannot pass, and it
reports nothing but a line number, which says neither that the
architecture is unsupported nor what was expected.

Add the wrapper for mips, i386 and x86_64, and say in the check what a
zero address means, so that the next port is told why it fails rather
than left to find out.

The frame which the mips dispatch receives is built on the stack of the
interrupted context, so the address of the frame is an address within
that stack.  Its stack pointer member is not used.  Only the path which
the debugger stub takes fills it, and the interrupt path leaves it zero.

The two x86 ports keep the frame base of the interrupted context in the
frame pointer register and may then switch to the interrupt stack, so
the wrapper has to take the value before the compiler establishes a
frame of its own.  A register variable does not do that, because the
compiler emits its prologue first and the wrapper then reads its own
frame.  They get the same treatment as sparc, which has the problem for
the same reason.

Close #5712.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:56:47 -05:00
Sebastian Huber ccc830b004 cpukit/score/cpu/moxie: Validate the context
The two routines were empty, so the validation task of spcontext01 spun
in a loop which checked nothing.

The frame pointer stays out of the pattern, since the return
instruction of this architecture unwinds through it.

Close #5701.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:55:30 -05:00
Sebastian Huber e848c24981 bsps/moxie/moxiesim: Exclude the failing tests
The BSP has neither a clock driver nor interrupt support.  Its clock is
the idle thread, which calls rtems_clock_tick() in a loop, so time only
advances while the system is idle.  The CPU port leaves the interrupt
disable, enable and level routines empty.  Fifty three tests fail as a
result or for reasons of their own, thread local storage among them.

Exclude them with the reason recorded, so that the results of this BSP
show what the target can do rather than a list nobody reads.  The run
reports no regression afterwards.

Update #5701.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:55:30 -05:00
Sebastian Huber cf5c60a725 bsps/moxie/moxiesim: Exit the simulator on reset
The BSP used the reset loop, so the simulator never stopped.  Every
test ran to completion and then spun until the test runner killed it.
The output was lost, because the standard output of the simulator is
buffered and is flushed by the exit of its process.

The simulator stops if the application issues the exit system call.
Use it and pass a status which tells a successful run from a fatal
error.

Update #5701.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:55:30 -05:00
Sebastian Huber db08506d40 bsps/x86_64/amd64: Add a PVH boot entry
The BSP is booted by the FreeBSD loader, which hands over in long
mode.  Qemu cannot load such an image with -kernel.  It supports the
x86/HVM direct boot ABI instead, which selects its entry through a
note of the ELF file and enters in 32 bit protected mode.

Add the note and an entry which builds the identity mapping, switches
to long mode and enables the floating point unit, then joins the
existing start code.  Qemu does not provide the location of the ACPI
tables on this path, so search for them if the boot information has
none.

This makes every test executable bootable by a plain Qemu command
line.  A boot image would have to be built for each of the roughly
700 executables otherwise, which needs tools outside the tool chain
and costs seconds per test.

Close #5694.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:50:50 -05:00
Sebastian Huber 8008d814b0 bsps/i386/pc386: Be quiet at startup
The four fatal validation suites open their test report at
RTEMS_SYSINIT_BSP_EARLY, so the report spans the whole system
initialization and every line the BSP prints during it lands inside the
report and breaks its hash.

Seven messages did, and each of them announces a normal outcome: no
video mode was requested, the interrupt controller has an ELCR, the PCI
BIOS interface works, the legacy UART ports exist, the machine has no
PCI to PCI bridge, and the console is the one which the command line
asked for.  The messages for a failure stay.

The last one read the in service and the interrupt request register of
the 8259A and printed both when they disagreed about the line being
unmasked.  A line which requests service and is not yet in service is
the normal state of a device with work pending, so it fired on the
clock and the console at every boot.

bootverbose is what a FreeBSD driver consults when the user asks for a
verbose boot.  The copy here defined it as one.

Close #5698.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:47:07 -05:00
Sebastian Huber b8b572abb0 bsps/i386/pc386: Drop stale expected failures
The five tests pass on this BSP.

Update #5698.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:47:07 -05:00
Sebastian Huber 051b8400e5 bsps/i386/pc386: Print before the console driver
The BSP selects the port of printk() from the boot command line in
bsp_start().  Until then BSPPrintkPort is the VGA console, so a board
without a monitor loses everything printed before it, and a system
which terminates in an early system initialization item prints nothing
at all.  Nothing of the console driver helps there: it builds its port
tables with a memory allocation, and every function of the libchip
drivers indexes them, so a build with BSP_ENABLE_VGA disabled
dereferenced a null table pointer.

Resolve a minor number through the statically defined ports while the
tables do not exist yet and drive the port of the boot console directly
with a polled write in that window.  It keeps the settings of the
firmware, since programming it needs the same tables.

USE_COM1_AS_CONSOLE selects COM1 as the console and the printk port
from reset.  The README of the BSP documents that option and nothing
implemented it.

Update #5698.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:47:07 -05:00
Sebastian Huber ef6f279569 bsps/microblaze: Add petalogix_s3adsp1800 BSP
Upstream Qemu has a petalogix-s3adsp1800 machine.  Its UART, interrupt
controller and timer are the peripherals the microblaze_fpga family
drives, so the family needs only a new variant to run on it.  The
existing kcu105_qemu variant needs the microblaze-fdt-plnx machine of
the Xilinx fork.

The peripheral addresses are taken from the machine definition in
hw/microblaze/petalogix_s3adsp1800_mmu.c of Qemu.

Close #5700.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:45:25 -05:00
Sebastian Huber 91401c423f bsps/microblaze: Fix build without FDT
The two parameters of try_get_prop_from_device_tree() are unused if
BSP_MICROBLAZE_FPGA_USE_FDT is not defined.  Both existing BSP
variants define it, so this path was never compiled.

Update #5700.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:45:25 -05:00
Sebastian Huber c7cfd1db3a build: Mark dl06 expected-fail for all BSPs
The test fails because rtems-ld and the RAP format have no TLS
support.  That is a property of the linker and not of a BSP, so the
test fails wherever libdl is built.  Four BSPs stated it individually
through a link to tst-xfail-dl06 while every other BSP reported a
failure.

Move the state into the general test states and drop the item.

Close #5715.

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