RTEMS | bsps/microblaze: The thread entry, the timecounter and the link (#5743)

Sebastian Huber (@sebhub) gitlab at rtems.org
Thu Sep 3 02:36:12 UTC 2026



Issue created by Sebastian Huber: https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5743



`_CPU_Context_Initialize()` puts the address of the entry point into `r15`. The
context restore returns with `rtsd r15, 8`, so a thread starts 8 bytes after
its entry point. `_Thread_Handler` tolerates the loss while its first two
instructions are the prologue. A compiler which puts a live constant there
makes the thread read through an uninitialized register.

The clock driver installs the timecounter while the AXI timer is disabled and
held at its load value. The write which loads the value clears the down counter
bit, so the counter register reads as all ones. The installation takes 65537 as
the offset of the first period, which is one more than a running counter gives.
Time goes backwards at the first wrap of the counter. `sptimecounter03` fails
on `petalogix_s3adsp1800`.

The compiler driver passes `-relax` to the linker. The relaxation deletes an
`imm` instruction where the offset fits in the branch. It does not correct the
call site table of `.gcc_except_table`, which the assembler resolved to offsets
from the start of the function. Every region and every landing pad of a
function which loses an instruction is then four bytes too high. A C++
exception reaches the wrong landing pad. `cdtest` fails on
`petalogix_s3adsp1800`.

Found while running the test suite of the BSP on Qemu. This description was
created with Claude Code assistance.

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5743
You're receiving this email because of your account on gitlab.rtems.org. Unsubscribe from this thread: https://gitlab.rtems.org/-/sent_notifications/5-45ek43vw1reyjcvyhdda5v7ml-1d/unsubscribe | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | Help: https://gitlab.rtems.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260903/81d06393/attachment-0001.htm>


More information about the bugs mailing list