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

From: Aditya Gupta <[email-masked]>
Date: Mon, 19 Jun 2023 09:18:17 +0530

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 <[email-masked]>
>> Fixes: d16a58f8854b1 ("powerpc: Improve ppc_save_regs()")

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

Thanks
- Aditya