libunw: Implement RISC-V stack unwindingThis patch implements stack unwinding for RISC-V architecture intolibunw. In RISC-V, the caller stores its frame pointer into registers0 before calling the
libunw: Implement RISC-V stack unwindingThis patch implements stack unwinding for RISC-V architecture intolibunw. In RISC-V, the caller stores its frame pointer into registers0 before calling the function. In the prologue of callee function,the return address and the caller's frame pointer are saved into thebottom of the callee's stack frame, and the callee's frame pointer isalso calculated and stored into s0 within the process of calleefunction. Therefore, the caller's stack frame can be traced back fromthe 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 ...
ldelf: strip PAC from TA addressesWhen pointer authentication is enables for TA's, the LR valuessaved in the stack will have PAC which must be stripped offwhen unwinding the stack.Signed-off-by
ldelf: strip PAC from TA addressesWhen pointer authentication is enables for TA's, the LR valuessaved in the stack will have PAC which must be stripped offwhen 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>
Add unwind library (libunw)Adds libunw to consolidate the stack unwinding code found inldelf/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 inldelf/unwind_arm{32,64}.c and core/arch/arm/kernel/unwind_arm{32,64}.c.The library is called "libunw" rather than "libunwind" to avoidconfusion 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/libunwindSigned-off-by: Jerome Forissier <jerome@forissier.org>Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>