riscv: refine vector context layout on stack#1329
riscv: refine vector context layout on stack#1329kstribrnAmzn merged 3 commits intoFreeRTOS:mainfrom
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 <wangfei_chen@realsil.com.cn>
@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.