| #
2661af29 |
| 26-May-2023 |
Alvin Chang <alvinga@andestech.com> |
libunw: Implement RISC-V stack unwinding
This patch implements stack unwinding for RISC-V architecture into libunw. In RISC-V, the caller stores its frame pointer into register s0 before calling the
libunw: Implement RISC-V stack unwinding
This patch implements stack unwinding for RISC-V architecture into libunw. In RISC-V, the caller stores its frame pointer into register s0 before calling the function. In the prologue of callee function, the return address and the caller's frame pointer are saved into the bottom of the callee's stack frame, and the callee's frame pointer is also calculated and stored into s0 within the process of callee function. Therefore, the caller's stack frame can be traced back from the callee's stack frame.
The following steps describe the stack unwinding on RV64 system: 1. When an exception occurs, we get the current frame pointer from trapped register s0/fp. 2. Get the ra from the memory address (fp-0x8). 3. Get the caller's frame pointer from the memory address (fp-0x10). 4. Update the caller's pc as (ra-0x4), this is information we want from stack unwinding. 5. Repeat the step 2 to step 4, until we exceed the stack frame of the thread.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| #
c6c416f1 |
| 10-Jan-2022 |
Ruchika Gupta <ruchika.gupta@linaro.org> |
ldelf: strip PAC from TA addresses
When pointer authentication is enables for TA's, the LR values saved in the stack will have PAC which must be stripped off when unwinding the stack.
Signed-off-by
ldelf: strip PAC from TA addresses
When pointer authentication is enables for TA's, the LR values saved in the stack will have PAC which must be stripped off when unwinding the stack.
Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
e1a6547d |
| 03-Sep-2020 |
Jerome Forissier <jerome@forissier.org> |
Add unwind library (libunw)
Adds libunw to consolidate the stack unwinding code found in ldelf/unwind_arm{32,64}.c and core/arch/arm/kernel/unwind_arm{32,64}.c.
The library is called "libunw" rathe
Add unwind library (libunw)
Adds libunw to consolidate the stack unwinding code found in ldelf/unwind_arm{32,64}.c and core/arch/arm/kernel/unwind_arm{32,64}.c.
The library is called "libunw" rather than "libunwind" to avoid confusion with the GNU libunwind [1]. The header file is <unw/unwind.h> to avoid a conflict with GCC's <unwind.h>.
Link: [1] https://www.nongnu.org/libunwind Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|