Commit Graph
38499 Commits
Author SHA1 Message Date
Sebastian Huber 0e1a26fc0a score: Inhibit a scheduler change without SMP
The POSIX sporadic server takes the real priority node of a thread out
of the priority aggregation while the thread runs at the low priority.
_Scheduler_Set() extracts that node without a check.  It skips the
extract where a scheduler change inhibitor is present, and only an SMP
build had one.  A uniprocessor build with the POSIX API therefore
extracted a node which sits in no tree.  A debug build ended psx09 with
a failed assertion in _RBTree_Extract() and a release build broke the
priority aggregation of the thread.

The sporadic server is a property of the POSIX API alone.  Enable the
scheduler change inhibitors wherever the POSIX API is enabled.
rtems_task_set_scheduler() then returns RTEMS_RESOURCE_IN_USE for a
sporadic server thread at both priorities, as it does in an SMP build.

Closes #5745.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-29 14:53:50 +02:00
Sharvin Neve 338bab40ec score: Fix TOD_LATEST_YEAR and watchdog overflow beyond 2400
rtems_clock_set() accepted years up to TOD_LATEST_YEAR defined as 4095.
However, realtime watchdogs represent timestamps using 34 bits for
seconds since the UNIX Epoch (WATCHDOG_MAX_SECONDS), which wraps around
year 2514. Setting CLOCK_REALTIME beyond year 2514 breaks every subsequent
tick: in debug builds _Watchdog_Ticks_from_timespec() asserts that the
timestamp is not far future, while in release builds the realtime watchdog
collection is tickled with wrapped values.

As discussed in the Year 4000 (Y4K) problem topic on the RTEMS forum,
extending the calendar to year 4095 is prevented by this 34-bit watchdog
seconds limit.

Furthermore, _TOD_Validate() checked year bounds while
_TOD_Is_valid_new_time_of_day() checked seconds against
TOD_SECONDS_1970_THROUGH_2400, leaving a boundary mismatch between
rtems_clock_set() and POSIX clock_settime().

Bound TOD_LATEST_YEAR to 2400 and align TOD_SECONDS_1970_THROUGH_2400
as an exclusive upper limit in _TOD_Is_valid_new_time_of_day(). Both
rtems_clock_set() and clock_settime() now consistently accept times up
to 2400-12-31T23:59:59.999999999Z and reject later values, leaving over
113 years of system uptime headroom before watchdog overflow. Synchronize
documentation and update psxclock, spclock_err02, and clock validation
test suites accordingly.

Closes #5749.
2026-09-29 03:34:07 +00:00
Samuel Price 75adf35e31 termios: Sort B28800 into the baud table's ascending order
rtems_termios_baud_table listed B28800 after B38400, but
rtems_termios_set_best_baud() scans forward to the first entry at or
above the request and so assumes ascending order.  The two rates around
the out-of-place row came back wrong: 28800 returned B19200, and 40000
returned B28800.

Move the row between B19200 and B38400.  Nothing else depends on the
order: rtems_termios_baud_to_index() is a self-contained switch and the
num/baud conversions search by value.  test_set_best_baud() had skipped
every extension rate, which is the region where the table was out of
order, so add 28800, 38400 and 40000.

Signed-off-by: Samuel Price <thesamprice@gmail.com>
Assisted-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-28 13:48:42 +00:00
Matteo Concas 0e7b526837 bsps/sparc: Add GR765 BSP 2026-09-28 09:48:59 +02:00
Aaron Nyholm 51dd2cc3ad dev/io/iodev.c: Fix lock held while waiting on event
iodev lock is now released when waiting on an event. This
allows other IOCTL calls to be made while a thread is waiting
on an event.
2026-09-28 02:02:56 +00:00
Matteo Concas e9d427c097 bsps/griscv: Use proper IRQ(A)MP member names
Closes #5784
2026-09-25 09:30:49 +02:00
shuhua hua 124690270d shell: flashdev: close fds on allocation failure 2026-09-25 02:05:33 +00:00
Matteo Concas 05bab5136d grlib/ambapp: Use correct member offset
On 64-bit platforms, `struct ambapp_dev` is 36 bytes which get padded to 40
bytes.
In that scenario, substracting the size of the struct to get the address of the
parent struct yields incorrect results.

We instead use `RTEMS_CONTAINER_OF()` which will always give the correct parent
no matter the padding.
2026-09-24 05:37:03 +00:00
Matteo Concas 212057c72e drvmgr: Fix driver manager linking issues
This would lead to a `LEON3_FATAL_CLOCK_INITIALIZATION` as no PnP scan was run
and no timer was found in the process.
2026-09-22 17:56:34 +02:00
Matteo Concas a93897b428 drvmgr: Add DRVMGR prefix to list macros
This could cause conflicts when used with other libraries
2026-09-22 11:47:24 +02:00
Sebastian Huber 62598e8db1 bsps/mips: Build the libdl tests of three BSPs
The hurricane, rbtx4925 and rbtx4938 BSPs excluded dl01 to dl13.  The
exclusion dates from 2015 and answers a link failure of dl01.  The
build of that era passed the compiler flags to rtems-syms as a string
and let the tool call the compiler.  The string lost -EL, so the tool
built a big endian object for a little endian target and the link
rejected it.

The waf build runs rtems-syms with -S, which writes a C source file,
and compiles that file itself with the flags of the BSP.  The flag
cannot get lost.

Drop the exclusion of the three BSPs.  Twelve tests return, because
dl13 belongs to arm.  The other users of the item keep it.

No simulator runs these three BSPs, so the link is the only evidence
available.  The link is what the report named.

Update #2279.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00
Sebastian Huber ced6d1fa36 testsuites/validation: Check the MIPS registers
Nothing checked that the context switch, interrupt processing and the
exception resume of the MIPS port keep the register sets which the ABI
requires.  Three defects of the port reached the test suite unseen.
The interrupt return dropped the status register.  The exception path
saved a floating point data register in place of the control register.
The exception resume left the call-saved registers as the fatal error
chain left them.

Add three test cases from the specification items
spec/score/cpu/mips/val/context, spec/score/cpu/mips/val/interrupt and
spec/score/cpu/mips/val/resume.  Each case loads a distinct pattern
into every register of its set, runs the operation and takes a trap.
The frame of that trap reports what the operation left behind.  So no
register under test carries the address of the store-out.

The cases join ts-validation-no-clock-0.  That suite needs no clock
driver, and the interrupt case raises the software interrupt of the
processor through the TM27 support.

Update #5754.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00
Sebastian Huber ea80e1d7ba cpukit/score/cpu/mips: Save fcr31 through cfc1
The exception path of _ISR_Handler() read the control and status
register of coprocessor 1 with mfc1 and wrote it back with mtc1.
Those instructions address a floating point data register.  cfc1 and
ctc1 address a control register.

So the save put the bits of $f31 into the frame at R_FCSR, over the
value which the prologue stored there.  The restore put the slot into
$f31 and destroyed that register.  The same pair used C1_REVISION,
which is $f0 and which holds the identity of the unit rather than
state of a context.

Drop both accesses.  The prologue stores the register through the
two-read idiom of the port and the exit restores it with ctc1, so the
exception path needs neither.  Nothing fills R_FEIR, because no MIPS32
processor carries that register.

Update #5769.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00
Sebastian Huber a29441c5f6 cpukit/score/cpu/mips: Add the exception resume
The port had no _CPU_Exception_resume().  A fatal error extension
which inspects an exception frame could not continue the interrupted
context.  Every exception therefore ended the system.

The chain which reaches such an extension ends in a fatal error.  No
function of that chain returns, so no function of it puts a call-saved
register back.  _Terminate() also clears the interrupt enable before
it calls the extensions.  The frame is the only source of s0 to s7 and
of the interrupt level.

Add the routine.  It restores the registers which the interrupted
context owns and continues at the exception program counter of the
frame.  The header comment of the file names the registers which it
leaves out and the reason for each.

Update #5754.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00
Sebastian Huber a8a7319a1d cpukit/score/cpu/mips: Restore the status register
_ISR_Handler saved the status register of the interrupted context into
the frame at R_SR.  The common exit never restored it.  Only the path
which calls _Thread_Dispatch() built a status register of its own.

A handler which changed the register therefore kept the change after
the return.  _Terminate() clears the interrupt enable before it calls
the fatal error extensions, because it does not expect to return.  An
extension which leaves a fatal error with a longjmp() escaped with the
interrupts of the processor disabled, and the interrupt return left
them so.

ts-validation-intr does that.
BspReqInterruptHandlerDispatchUnchecked wraps
bsp_interrupt_handler_default(), takes the fatal error of a vector
with no entry and returns through longjmp().  The first action reached
the wrapped handler.  Every later action waited for a software
interrupt which stayed pending and unmasked, because the enable of the
processor was off.

Restore the status register of the frame in _ISR_Handler_exit, beside
the exception program counter.  Force the exception level, which the
eret clears again.

The case runs to its end, and the suite reports no failure.

Update #5768.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00
Sebastian Huber 1d8ee20742 bsps/mips/malta: Do not block in BSP_poll_char
BSP_com_inch() polled the device in a loop until it read a character.
BSP_poll_char references that function.

The specification of BSP_poll_char states the opposite.  A referenced
function dequeues the least recently received character of the device.
Where the device holds none, the function returns minus one at once.

ts-validation-io-kernel calls getchark() while the device holds no
character.  The loop never ended, so the suite made no progress on
mips/malta.  It printed nothing and the runner ended it on a timeout.

Return the result of the polled read.  ns16550_inch_polled() already
gives minus one for an empty device.

Update #5767.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00
Sebastian Huber c4210fd3f0 bsps/mips/malta: Pass no boot command line
The init code of start.S puts the instruction which clears a0 into the
delay slot of the jal to init_tlb.  The zero therefore reaches
init_tlb and not boot_card.  init_tlb() leaves the counter of its loop
in a0, which is N_TLB_ENTRIES.  boot_card() takes 16 as the address of
the command line and stores it in bsp_boot_cmdline.

Init() of cpukit/libmisc/dummy/default-configuration.c reads that
pointer and counts the arguments of the string.  defaultconfig01
therefore took a TLB load exception in strlen() at address 16.
bspcmdline01 reads the same variable and failed as well.

Put the instruction which clears a0 into the delay slot of the jal to
boot_card.  The board takes no command line from its boot loader.

Update #5766.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00
Sebastian Huber 23f517900f cpukit/score/cpu/mips: Restore the exception PC
_ISR_Handler wrote the exception program counter of the frame back to
coprocessor 0 register 14 on one path alone.  That path follows the
call of _Thread_Dispatch().  The common exit reached eret with the
register unchanged.  A handler which changed the counter of the frame
therefore had no effect on MIPS III and MIPS32.  The mips1 multilib
hid the defect, because its exit returns with j k1 and takes the
address from the frame.

mips_emulate_rdhwr_ulr() depends on that change.  The 24Kf of Qemu
leaves Config3.ULRI clear, so rdhwr raises a reserved instruction
exception.  The handler supplies the thread pointer and advances the
counter by four.  On mips/malta the advance was lost and the
instruction ran again.  A trace of Qemu showed the same exception
11545896 times in eight seconds.  sptls01, sptls02, sptls04,
ts-validation-tls-0, ts-validation-tls-1, ts-validation-1 and
ts-validation-one-cpu-1 failed.

Write the counter of the frame back in _ISR_Handler_exit.  Set the
exception level first, which the eret clears again.

Update #5765.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00
Sebastian Huber fc41da6325 cpukit/score/cpu/mips: Switch the FPU context
The port gave the floating point unit a context of its own.
CPU_HARDWARE_FP was true and CPU_ALL_TASKS_ARE_FP followed it.
CPU_USE_DEFERRED_FP_SWITCH was true.  cpu.h declared a
Context_Control_fp with a save and a restore function for it.

The context switch kept the coprocessor enable as a bit of the task.
setjmp() of a hard float ABI saves the call-saved registers of the
unit, so a task without the floating point attribute reached it.  Such
a task took a coprocessor unusable exception inside setjmp().
spfatal31, ts-fatal-extension and ts-validation-acfg-0 ended that way
on mips/malta.

Interrupt processing saved no floating point register and left
coprocessor 1 enabled.  A handler which used the unit changed $f0 to
$f19 of the interrupted context.

Move the call-saved registers $f20 to $f31 and the control register
fcr31 into Context_Control and switch them in _CPU_Context_switch().
fcr31 holds the floating point environment, which has thread storage
duration.  Save the call-used registers $f0 to $f19 on the interrupt
path.  Make the coprocessor enable global state, which every BSP of
this architecture already sets in its start code.  The exception path
then needs no test of the bit, so drop the two tests it carried.

The initial fcr31 keeps the FS flag.  A denormalised result still
flushes to zero.

Update #5764.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00
Sebastian Huber f9b2069a51 cpukit/score/cpu/mips: Fix the frame indices
iregdef.h gives the position of every register in the interrupt frame
and the exception frame.  R_F13 to R_F17 read 41 to 45, where the run of
the floating point registers wants 51 to 55.  R_F18 continues at 56, so
the five values alias R_F3 to R_F7.

No assembly of the tree uses them today, so nothing is broken yet.  A
save or a restore of the floating point registers through these names
would overwrite five integer slots and lose five floating point ones.

Give the five names the position which the run wants.

Update #5754.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00
Sebastian Huber ff6d3df84a bsps/mips: Add the exception handler registration
The exception codes occupied the interrupt vectors below
MIPS_INTERRUPT_BASE.  A handler reached them through
rtems_interrupt_handler_install(), which passes a vector number and no
frame.  mips_vector_exceptions() therefore stored the frame in the
global mips_exception_frame around the dispatch, and
bsp_interrupt_handler_default() read it back.  That global is a hidden
argument of the dispatch.  Two processors which take an exception at
the same time overwrite it, so the port cannot support SMP in that
form.

Give the port its own registration.  mips_exc_set_handler() installs
the handler of one exception code and the handler takes a
CPU_Exception_frame pointer.  ppc_exc_set_handler() of the PowerPC
port is the model.  The default handler calls rtems_fatal() with
RTEMS_FATAL_SOURCE_EXCEPTION and the frame.
bsp_interrupt_is_valid_vector() rejects every vector below
MIPS_INTERRUPT_BASE, so the interrupt manager owns none of them.

An application which installed a handler on an exception vector with
rtems_interrupt_handler_install() moves to the new call.

MIPS_INTERRUPT_BASE keeps its value.  No BSP renumbers its interrupt
vectors.

Update #5752.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00
Sebastian Huber 382be2ca57 mips: Remove the GDB stub
bsps/mips/shared/gdbstub/ holds a GDB stub of 2001 in five files.  No
build item names any of them, so no BSP compiles the stub and
mips_gdb_stub_install() has no caller.

The stub could not link in any case.  It installed its handler with
rtems_interrupt_catch(), a simple vectored directive which the tree
does not have.  It calls rtems_gdb_stub_get_current_thread() and two
more functions which gdb_if.h declares and no source defines.  It
declares mips_register_t for __mips 1 and __mips 3 alone, so the
preprocessor raises an error for the malta and the csb350 BSP.  Its
README names the MongooseV BSP, which the tree dropped.

cpu_asm.S carries the support of the stub.  mips_break() is the
breakpoint trampoline and the exception return steps over the break of
it.  Nothing else calls either one.  A commented-out block of the
R3000 return logic states that the stub does that work instead.  Five
comments name the stub.

Remove the directory and that support.

A back end of cpukit/libdebugger/ will serve the MIPS port.  The
library carries one for aarch64, arm, i386, microblaze and powerpc
today.

Update #5752.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00
Sebastian Huber 710d341453 bsps/mips/malta: Let a test interrupt nest
Lower_tm27_intr() set the interrupt level to zero, which sets the
interrupt enable of the status register.  The entry of an exception
also sets the exception level, and that bit holds off every interrupt
of the processor on its own.  The interrupt which tm27 raises inside
its handler therefore never arrived, and the test spun on the flag of
the nested handler forever.

Clear the exception level as well.  The frame of the handler holds the
exception program counter and the exit restores it.  A nested
exception which overwrites the register therefore does no harm.

tm27 now reports all four of its measurements.

Update #5742.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00
Sebastian Huber 4a5522cc1b bsps/mips/malta: Add the tm27 support
tm27.h of the BSP was the default header, which raises no interrupt.
Every test which drives an interrupt through CallWithinISR() failed
with "the interrupt raised by Cause_tm27_intr() was not delivered".
ts-unit-no-clock-0 and ts-performance-no-clock-0 are two of them.

The preceding commit raises and clears the two software interrupts of
the processor.  Take the first of them as the test interrupt and the
second as TM27_INTERRUPT_VECTOR_ALTERNATIVE, so a test which needs two
vectors has one of each.

Update #5742.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00
Sebastian Huber 9fbe0c70e8 bsps/mips: Add the Malta interrupt controller
The BSP linked the stubs of bsps/mips/shared/irq/irqstubs.c, so
rtems_interrupt_raise(), rtems_interrupt_clear(),
rtems_interrupt_is_pending() and rtems_interrupt_vector_enable()
returned RTEMS_UNSATISFIED or did nothing for every vector.
RtemsIntrReqEntryInstall scanned for a vector which it can raise,
found none and used the vector count as a vector.  Every directive
then returned RTEMS_INVALID_ID.  ts-validation-intr reported 638
failed steps from this alone.

The dispatcher of the BSP printed a line for six of the eight sources
of the processor.  It did not pass them to the interrupt manager, so a
handler of them was never called.

Give the BSP its own implementation.  The two software interrupts of
the processor carry raise and clear through the cause register.  The
mask of the status register carries enable and disable of the sources
of the processor.  The cascade of the south bridge carries them for
its own lines.  The dispatcher passes every source of the processor to
the interrupt manager and keeps the decode of the south bridge.

The base of that implementation needs three repairs.  Each vector
number expands to a sum with no brackets around it.  A subtraction of
one therefore adds the terms of the sum.
BSP_irq_enabled_at_i8259s() returns a bitwise complement which is
never zero.  Eight vectors name address and data lines of the PCI
bus.  Such a line reaches the processor through the south bridge.

Bracket every vector number.  Return whether the cache bit is clear.
Remove the eight vectors of the PCI bus and the four aliases which
name them.  Replace the note which describes the interrupt controller
of another board with the order of the vectors.

Update #5742.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00
Sebastian Huber d2600e03f2 bsps/mips/malta: Advance the compare register
Clock_driver_support_at_tick() set the compare register ahead of the
count register, so every period gained the latency of the interrupt.
Measured over 100 ticks, a period of 100000 counts took 100277, which
is 0.278 percent long.  sptimecounter02 measured a job of a fixed
number of clock ticks against the timecounter and failed with that
drift.  spintrcritical24 failed with it as well.  The dummy
timecounter hid the drift, because it took the uptime from the count
of ticks rather than from a counter.

Advance the compare register by the period.  A handler which runs late
computes a value which the counter already passed.  The comparison
then waits for the counter to run through its whole width.  That is 27
seconds at the frequency of this BSP.  Take the counter as the base of
the next period in that case, as the or1k clock driver does.

The period now measures 100000.08 counts.

Update #5742.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00
Sebastian Huber d0acc2adcd bsps/mips/malta: Mask the timer interrupt
mips_interrupt_mask() returned 0x0000ff00, which enables all eight
interrupt lines of the processor.  Line 7 is the compare register of
the coprocessor, which the clock driver owns.  The count and compare
registers are both zero after a reset.  That line is asserted from the
first instruction.  It stays asserted until the clock driver writes
the compare register.

An executable which needs no clock driver never writes it.  It took
the interrupt as soon as it enabled interrupts, found no handler and
terminated with RTEMS_FATAL_SOURCE_SPURIOUS_INTERRUPT and vector 39.
Every test of this BSP without a clock driver ended that way.

Leave line 7 out of the mask.  The clock driver enables it through
mips_enable_in_interrupt_mask() when it installs its handler.

Update #5742.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00
Sebastian Huber c839361844 bsps/mips/malta: Fix the FPU register mode
bsp_start() set the status register of the processor to
SR_FR | SR_PE.  SR_FR selects the 64 bit floating point registers,
while the ABI of this BSP holds a double in a pair of the 32 bit
registers.  The ELF attributes of every executable state a CPR1 size
of 32.  A double therefore lost half of its bits on the way to memory
and back.  The value 0.0 survived that, because all of its bits are
zero, and every other value did not.  math reported nan for asin,
asinh, atan, atan2 and atanh, and complex, linpack, mathf, paranoia
and sp19 failed with it.

The write also cleared SR_CU1, which disables the coprocessor of the
floating point unit.  SR_PE is a bit of the R3000 which the MIPS32
status register does not carry.

Set SR_CU1 alone.  start.S sets the same status, so drop SR_FR there
as well.

Update #5742.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00
Sebastian Huber 89dcd8d638 bsps/mips/malta: Use the count register for time
The BSP linked the software CPU counter of bsps/shared and the clock
driver set CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER.  The counter counted
the calls to _CPU_Counter_read() and not the time.
rtems_counter_delay_nanoseconds() therefore delayed by a count of
calls.  getentropy() took no entropy from the time.  The uptime
advanced once per clock tick, so nothing resolved an interval below
the tick and spintrcritical08 never reached the window it aims at.

The count register of the coprocessor is a free running up counter of
the full width.  The clock driver already takes the tick from the
compare register beside it.  Read that register as the CPU counter and
install it as the timecounter.  It runs from the reset of the
processor.  A reader therefore needs no initialization of it, and a
system without a clock driver gets the counter as well.

Update #5742.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00
Yang Zhang a62e60b525 posix: Defer mutex flags until after validation
Previously, pthread_mutex_init() wrote the object flags containing
POSIX_MUTEX_MAGIC before validating the priority ceiling attribute.
If the priority ceiling was invalid, the function returned EINVAL, but
left the mutex object marked as a valid initialized mutex. Subsequent
calls such as pthread_mutex_trylock() and pthread_mutex_destroy() then
mistakenly accepted the object and returned EBUSY, or pthread_mutex_lock()
triggered a fatal data abort due to uninitialized queues.

Defer modifying the mutex object and setting the flags until after all
attribute validations (including priority ceiling) have succeeded, and
publish the flags after the mutex queue and control fields are initialized.
Also add test coverage in psx05.

Close #5776.
2026-09-20 07:05:59 +00:00
Avi Weiss d822f38165 cpukit/contrib/sys/priority.h: Define missing macro with original value
RQ_PPQ is defined elsewhere in FreeBSD (that file was never imported
into RTEMS).

Defining it with its original value (4) for now, until the next
update. This will avoid any chance of hitting an error for an
undeclared/missing name.
2026-09-18 00:18:48 +00:00
Joel Sherrill 22b3389e26 cpukit/libmisc/shell/main_mdump.c: Use uintptr_t to print address
The behavior of the %p printf() specifier is implementation
dependent. The behavior varies on RTEMS between printf() and
printk(). This change prints an address as a uintptr_t to
ensure formatting is consistent. It also adjusts the output
width based on target architecture pointer size.

Updates rtems/docs/rtems-docs#163
2026-09-18 09:26:23 +10:00
Vijay Banerjee 42e9d64ada powerpc/mvme3100: Relicense to BSD 2-Clause
Updates #3053
2026-09-17 18:12:13 -05:00
Sharvin Neve 80b1ba90a5 cpukit/libmisc: Clean up a partial regulator
rtems_regulator_create() calls _Regulator_Free_helper() on every error
path. The helper deletes the task, the message queue and the partition
without a check. An error before the create of one of them leaves its
identifier at REGULATOR_NO_ID; the delete then returns RTEMS_INVALID_ID and
a debug build fails an assertion. The helper also loses the storage of the
message queue when the construct of the queue fails.

In addition, the output thread ends itself when it cannot create its period.
The helper then attempts to delete a task which no longer exists.
Furthermore, rtems_regulator_delete() with zero ticks deletes the output
thread before it reaches the exit path, leaking the rate monotonic period.

Finally, the exit path of the output thread previously marked
delivery_thread_is_running as false before finishing clean up and signaling
that it has exited, exposing a race window to the helper on SMP systems.

Define REGULATOR_NO_ID as ((rtems_id) UINT32_MAX) and initialize
delivery_thread_id, queue_id, and messages_partition_id to REGULATOR_NO_ID
in rtems_regulator_create(). Guard deletions in _Regulator_Free_helper()
against REGULATOR_NO_ID and delivery_thread_has_exited. Free
message_queue_storage directly if queue creation failed. Delete the rate
monotonic period in the helper if the thread was deleted before exiting.
On the output thread exit path, delete the period and set
delivery_thread_has_exited before setting delivery_thread_is_running to
false.

Close #5747.
Close #5760.
2026-09-17 17:48:39 -05:00
Sharvin Neve 61456ec62e cpukit/libmisc: Accept an empty regulator queue
The output thread of a regulator takes messages from the queue until the
queue is empty or it reaches the count of the period. An empty queue answers
RTEMS_UNSATISFIED and the loop takes that answer as the end of the deliveries
of this period. The thread also asserts that the answer is RTEMS_SUCCESSFUL,
so a debug build ends regulator01 with a failed assertion.

Accept RTEMS_UNSATISFIED in the assertion as an expected status code when the
queue has fewer messages than the maximum to dequeue per period.

Update #5747.
2026-09-17 17:48:39 -05:00
Vijay Banerjee c8fbc35eeb powerpc/motorola_powerpc: Remove MVME2700 code
Updates #5731
2026-09-18 07:42:21 +10:00
Vijay Banerjee 0687e7634b bsps/powerpc: Create separate BSP for mvme2700
This commit separates the mvme2100 BSP out of the motorola_powerpc area

+ Apply clang-format
+ Fix OpenPIC initialization
+ Add configuration for MVME2600

Updates #5731
2026-09-18 07:42:21 +10:00
Sebastian Huber 9d26b894f7 build: Fix copyright statement format
Remove the superfluous `.` characters.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-17 10:00:43 -05:00
Sebastian Huber c97e32a4d2 build: Add copyright year
A copyright statement needs a year.  Deduce it from the git history.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-17 10:00:43 -05:00
Joel Sherrill 2b4a1000e4 spec/build/*: Remove references to libnetworking
These are remnants from moving legacy networking to a separate
package.
2026-09-17 07:06:01 -05:00
Vijay Banerjee 4473580b5c bsps/powerpc: Add support for mpc7410 processor
This patch adds cpu identification for MPC7410 processor used in
MVME5110 boards
2026-09-17 08:05:48 +10:00
Vijay Banerjee 361454ceac powerpc/motorola_powerpc: Remove MVME2100 code
Updates #5731
2026-09-16 14:48:13 +00:00
Vijay Banerjee 9667b49837 bsps/powerpc: Create separate BSP for mvme2100
This commit separates the mvme2100 BSP out of the motorola_powerpc area

+ Add libi2c support for mvme2100
+ Apply clang-format
+ Use EEPROM-based VPD reading
+ Remove dependance on PPCBug's residual memory
+ Fix DBAT overlap in initialization

Updates #5731
2026-09-16 14:48:13 +00:00
Yang Zhang 9ecb715ab5 bsps/shared/acpi: Use vprintk for AcpiOsPrintf
AcpiOsPrintf() and AcpiOsVprintf() used vprintf(), which relies on
standard I/O and newlib reentrancy structures.

When acpi_tables_initialize() is called from bsp_start(), the system
has not completed initialization and no thread is executing yet.
Calling vprintf() at this stage attempts to read libc_reent via a null
pointer, which on x86_64 targets causes a triple fault crash during boot.

Use vprintk() from <rtems/bspIo.h> instead of vprintf() to route ACPICA
OSL output through the early polled kernel character device.

Fixes #5751.
2026-09-16 14:00:59 +00:00
Vijay Banerjee 3e69272ae2 powerpc/motorola_powerpc: Remove MVME5100 code
Updates #5731
2026-09-16 08:19:27 -05:00
Vijay Banerjee 3a650c0a42 bsps/powerpc: Create separate BSP for mvme5100
This commit separates the mvme5100 BSP out of the motorola_powerpc area

+ Add libi2c support for mvme5100
+ Apply clang-format
+ Use EEPROM-based VPD reading
+ Remove dependance on PPCBug's residual memory for VPD

Updates #5731
2026-09-16 08:19:27 -05:00
Sebastian Huber b3e600194a cpukit/libcsupport: Store the member offsets
rtems_resource_snapshot_take() took the address of the scalar member
active_posix_keys and indexed it as an array of 15 elements.  That is
undefined behaviour.  It also bound the order of objects_info_table to
the order of the structure members.  Nothing checked that order.
Coverity reported this as CID 1399703.

Store the offset of the target member in each row of the table.  Take
the offset with offsetof().  Write the active count through that
offset.  Each row names the member it fills, so the order and the
layout of the structure do not matter.  Assert that the structure fits
the offset type.

The public header is unchanged.

Close #5736.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-16 13:14:42 +10:00
Joel Sherrill 8b020bd687 cpukit/libdl/rtl-mdreloc-lm32.c: Remove file
This should have been removed earlier as part of removing the
lm32 dependent code as part of obsoleting it.

Updates #5025.
2026-09-14 12:50:02 -05:00
Sebastian Huber 2adc637dd9 bsps/mips: Emulate rdhwr for the thread pointer
The compiler emits rdhwr $3, $29 to read the thread pointer for every
access to a thread-local object.  It does this on every MIPS target,
because the instruction exists since MIPS32r2 and the operating system
is expected to emulate it where the processor lacks it.  The R3900 of
mips/jmr3904 lacks it, so thread-local storage did not work at all.

Emulate the instruction in the reserved instruction exception, which is
the only way the processor reports it.  A processor which has the
instruction never raises the exception, so the emulation costs nothing
there.

An instruction in a branch delay slot is left to the fatal handler: the
exception program counter references the branch, so the emulation cannot
resume by advancing it.

Close #5689.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-11 00:01:29 +00:00
Sebastian Huber d4207b7fbe cpukit/score/cpu/mips: Add thread-local storage
The port declared CPU_THREAD_LOCAL_STORAGE_VARIANT but implemented none
of it.  _CPU_Context_Initialize() ignored its thread-local storage area,
_CPU_Get_TLS_thread_pointer() returned NULL, and there was nothing to
give the compiler the thread pointer, so every access to a thread-local
object read the wrong memory.

Keep the thread pointer in the context.  It follows the registers saved
by _CPU_Context_switch(), which addresses the members before it through
the offsets defined in cpu_asm.S, so nothing in the assembly changes.

The ABI places the thread pointer 0x7000 bytes above the thread-local
storage data, so that the signed 16-bit offsets emitted by the linker
reach a larger part of the area.

The compiler reads the thread pointer with rdhwr, which this processor
does not have.  Supplying it is the task of the exception handler.

Update #5689.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-11 00:01:29 +00:00