1. 08 Feb, 2010 3 commits
    • Matt Fleming's avatar
      sh: Don't continue unwinding across interrupts · 944a3438
      Matt Fleming authored
      Unfortunately, due to poor DWARF info in current toolchains, unwinding
      through interrutps cannot be done reliably. The problem is that the
      DWARF info for function epilogues is wrong.
      
      Take this standard epilogue sequence,
      
      80003cc4:       e3 6f           mov     r14,r15
      80003cc6:       26 4f           lds.l   @r15+,pr
      80003cc8:       f6 6e           mov.l   @r15+,r14
      						<---- interrupt here
      80003cca:       f6 6b           mov.l   @r15+,r11
      80003ccc:       f6 6a           mov.l   @r15+,r10
      80003cce:       f6 69           mov.l   @r15+,r9
      80003cd0:       0b 00           rts
      
      If we take an interrupt at the highlighted point, the DWARF info will
      bogusly claim that the return address can be found at some offset from
      the frame pointer, even though the frame pointer was just restored. The
      worst part is if the unwinder finds a text address at the bogus stack
      address - unwinding will continue, for a bit, until it finally comes
      across an unexpected address on the stack and blows up.
      
      The only solution is to stop unwinding once we've calculated the
      function that was executing when the interrupt occurred. This PC can be
      easily calculated from pt_regs->pc.
      Signed-off-by: default avatarMatt Fleming <matt@console-pimps.org>
      Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
      944a3438
    • Matt Fleming's avatar
      sh: Setup frame pointer in handle_exception path · 1dca56f1
      Matt Fleming authored
      In order to allow the DWARF unwinder to unwind through exceptions we
      need to setup the frame pointer register (r14).
      Signed-off-by: default avatarMatt Fleming <matt@console-pimps.org>
      Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
      1dca56f1
    • Matt Fleming's avatar
      sh: Correct the offset of the return address in ret_from_exception · 14269828
      Matt Fleming authored
      The address that ret_from_exception and ret_from_irq will return to is
      found in the stack slot for SPC, not PR. This error was causing the
      DWARF unwinder to pick up the wrong return address on the stack and then
      unwind using the unwind tables for the wrong function.
      
      While I'm here I might as well add CFI annotations for the other
      registers since they could be useful when unwinding.
      Signed-off-by: default avatarMatt Fleming <matt@console-pimps.org>
      Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
      14269828
  2. 05 Feb, 2010 8 commits
  3. 04 Feb, 2010 2 commits
  4. 03 Feb, 2010 27 commits