| #
339a78c2 |
| 22-Feb-2024 |
Jerome Forissier <jerome.forissier@linaro.org> |
libunw: riscv: simplify architecture test
Test ARCH rather than CFG_RV32_$(sm) and CFG_RV64_$(sm).
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Etienne Carriere <etien
libunw: riscv: simplify architecture test
Test ARCH rather than CFG_RV32_$(sm) and CFG_RV64_$(sm).
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com> Reviewed-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
9fed4516 |
| 22-Feb-2024 |
Jerome Forissier <jerome.forissier@linaro.org> |
libunw: arm: unwind_arm32.c should be compiled only for Arm
unwind_arm32.c contains functions to unwind arm32 code. This is used when libunw is built for arm32 or arm64, in other words when ARCH=arm
libunw: arm: unwind_arm32.c should be compiled only for Arm
unwind_arm32.c contains functions to unwind arm32 code. This is used when libunw is built for arm32 or arm64, in other words when ARCH=arm. Other architectures (such as ARCH=riscv) obviously don't need it.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
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 ...
|
| #
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 ...
|