Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read Zephyr caller-saved registers if saved on IRQ context on ARC #56

Open
wants to merge 3 commits into
base: zephyr-20220611
Choose a base branch
from

Conversation

bdmendes
Copy link

@bdmendes bdmendes commented Aug 3, 2023

This ARC-specific patch allows reading caller-saved registers from the thread's stack if an interrupt entry caused them to be automatically pushed on the thread's stack (RIRQ) or by the ISR (FIRQ). One can test this in gdb by fetching saved registers from an inactive thread.

zephyrproject-rtos/zephyr#61106 is required for this to be effective, but OpenOCD won't break with this patch if Zephyr is not updated accordingly.
This is based on #57, which was needed for adding further offsets.

@bdmendes bdmendes force-pushed the zephyr_arc_thread_relinquish_cause branch 5 times, most recently from b186115 to 160b663 Compare August 4, 2023 11:26
@bdmendes bdmendes marked this pull request as ready for review August 4, 2023 11:38
Since zephyrproject-rtos/zephyr@c3eeae8,
Zephyr OS exposes offset of mode_exc_return in the arch struct for ARM.

Accounting for this allows for consistency and enables
logic with further offsets that may be added after this.

Signed-off-by: Bruno Mendes <[email protected]>
Depending on the architecture, a different set of registers may be saved on a thread's stack in a cooperative vs. a preemptive switch.

Signed-off-by: Bruno Mendes <[email protected]>
If a thread is preempted in an interrupt, we can read the caller-saved registers from its stack.

Signed-off-by: Bruno Mendes <[email protected]>
@bdmendes bdmendes force-pushed the zephyr_arc_thread_relinquish_cause branch from 160b663 to ace265a Compare August 7, 2023 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant