[RFC PATCH v2 1/1] powerpc: update ppc_save_regs to save current r1 in pt_regs

Aditya Gupta adityag at linux.ibm.com
Mon Jun 19 13:48:17 AEST 2023


On 15/06/23 17:40, Nicholas Piggin wrote:
> On Thu Jun 15, 2023 at 7:10 PM AEST, Aditya Gupta wrote:
>> ppc_save_regs() skips one stack frame while saving the CPU register states.
>> Instead of saving current R1, it pulls the previous stack frame pointer.
>>
>> ...
>>
>> So this now saves regs as though it was an interrupt taken in the
>> caller, at the instruction after the call to ppc_save_regs, whereas
>> previously the NIP was there, but R1 came from the caller's caller
>> and that mismatch is what causes gdb's dwarf unwinder to go haywire.
>>
>> Nice catch, and I think I follow the fix and I think I agree with it.
>> Before the bug was introduced, NIP also came from the grandparent.
>> Which is what xmon presumably wanted, but since then I think maybe it
>> makes more sense to just have the parent caller.
>>
>> Reivewed-by: Nicholas Piggin <npiggin at gmail.com>
>> Fixes: d16a58f8854b1 ("powerpc: Improve ppc_save_regs()")

Thanks for reviewing this, and providing a Fixes tag too.

Thanks
- Aditya



More information about the Linuxppc-dev mailing list