-
Notifications
You must be signed in to change notification settings - Fork 1.4k
riscv: refine vector context layout on stack #1329
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
Conversation
Vector general register layout: Before: +--------------+ <-- High Address | v7 | +--------------+ | v6 | +--------------+ | ... | +--------------+ | v0 | +--------------+ <-- v0 - v7 | v15 | +--------------+ | v14 | +--------------+ | ... | +--------------+ | v8 | +--------------+ <-- v8 - v15 | ... | +--------------+ | v24 | +--------------+ <-- Low address After: +--------------+ <-- High Address | v31 | +--------------+ | v30 | +--------------+ | ... | +--------------+ | v1 | +--------------+ | v0 | +--------------+ <-- Low Address Signed-off-by: wangfei_chen <[email protected]>
@Saiiijchan Would you please help us understand how does this change facilitate debugger analysis of task stack context? |
Our debugger team is developing a GDB tool for FreeRTOS that can parse the task context from the stack. It would be easier to implement if the registers were arranged sequentially. |
|
@Saiiijchan Thank you for sharing! |
|
|
@Saiiijchan I made a change to change the |
|
@aggarg I tested and no problems. However, there are not additional regs on my platfrom. |
|
@Saiiijchan Thank you for confirming! |



Currently, vector registers are not placed continuously in the stack. Place v31 - v0 in order from high address to low address to facilitate debugger analysis of task stack context.
Vector general register layout:
Before:
+--------------+ <-- High Address
| v7 |
+--------------+
| v6 |
+--------------+
| ... |
+--------------+
| v0 |
+--------------+ <-- v0 - v7
| v15 |
+--------------+
| v14 |
+--------------+
| ... |
+--------------+
| v8 |
+--------------+ <-- v8 - v15
| ... |
+--------------+
| v24 |
+--------------+ <-- Low address
After:
+--------------+ <-- High Address
| v31 |
+--------------+
| v30 |
+--------------+
| ... |
+--------------+
| v1 |
+--------------+
| v0 |
+--------------+ <-- Low Address
Description
Test Steps
Checklist:
Related Issue
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.