1. 24 8月, 2009 6 次提交
    • G
      sh: kgdb: do not reload VBR while handling debugger breackpoint · 27a30f53
      Giuseppe Cavallaro 提交于
      Save the VBR allowing GDB to dump full registers set but do not reload it
      as soon as the kgdb_handle_exception is invoked.
      Signed-off-by: NGiuseppe Cavallaro <peppe.cavallaro@st.com>
      Signed-off-by: NStuart Menefy <stuart.menefy@st.com>
      Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
      27a30f53
    • D
      sh: Allow use of GENERIC_IOMAP · 15444a89
      David McKay 提交于
      The synopsys PCI cell used in the later STMicro chips requires code to
      be run in order to do IO cycles, rather than just memory mapping the IO
      space. Rather than extending the existing SH infrastructure to allow
      this, use the GENERIC_IOMAP implmentation to save re-inventing the
      wheel.
      
      This set of changes allows the SH to be built with GENERIC_IOMAP
      enabled, it just ifdef's out the functions provided by the GENERIC_IOMAP
      implementation, and provides a few required missing functions.
      Signed-off-by: NDavid McKay <david.mckay@st.com>
      Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
      15444a89
    • C
      sh: Improve unwind info for signals · 2fc742f8
      Carl Shaw 提交于
      GCC does not issue unwind information for function epilogues.
      Unfortunately we can catch a signal during an epilogue.  The signal
      handler writes the current context and signal return code onto the stack
      overwriting previous contents.  During unwinding, libgcc can try to
      restore registers from the stack and restores corrupted ones. This can
      lead to segmentation, misaligned access and sigbus faults.
      
      For example, consider the following code:
      
          mov.l   r12,@-r15
          mov.l   r14,@-r15
          sts.l   pr,@-r15
          mov     r15,r14
      
          <do stuff>
      
          mov r14, r15
          lds.l @r15+, pr
      	<<< SIGNAL HERE
          mov.l @r15+, r14
          mov.l @r15+, r12
          rts
      
      Unwind is aware that pr was pushed to stack in prolog, so tries to
      restore it.  Unfortunately it restores the last word of the signal
      handler code placed on the stack by the kernel.
      
      This patch tries to avoid the problem by adding a guard region on the
      stack between where the function pushes data and where the signal handler
      pushes its return code.  We probably don't see this problem often because
      exception handling unwinding in an epilogue only occurs due to a pthread
      cancel signal.  Also the kernel signal stack handler alignment of 8 bytes
      could hide the occurance of this problem sometimes as the stack may not
      be trampled at a particular required word.
      
      This is not guaranteed to always work.  It relies on a frame pointer
      existing for the function (so it can get the correct sp value) which is
      not always the case for the SH4.
      
      Modifications will also be made to libgcc for the case where there is no
      fp.
      Signed-off-by: NCarl Shaw <carl.shaw@st.com>
      Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
      2fc742f8
    • A
      sh: cleanup of do_address_error() · 5a0ab35e
      Andre Draszik 提交于
      This patch fixes a few problems with the existing code in do_address_error().
      
      a) the variable used to printk()d the offending instruction wasn't
         initialized correctly. This is a fix to bug 5727
      
      b) behaviour for CONFIG_CPU_SH2A wasn't correct
      
      c) the 'ignore address error' behaviour didn't update the PC, causing an
         infinite loop.
      Signed-off-by: NAndre Draszik <andre.draszik@st.com>
      Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
      5a0ab35e
    • A
      sh: Allow user control over misaligned fixup handling · 7436cde6
      Andre Draszik 提交于
      This patch brings the SH4 misaligned trap handler in line with what
      happens on ARM:
      Add a /proc/cpu/alignment which can be read from to get alignment
      trap statistics and written to to influence the behaviour of the
      alignment trap handling. The value to write is a bitfield, which
      has the following meaning: 1 warn, 2 fixup, 4 signal
      In addition, we add a /proc/cpu/kernel_alignment, to enable or
      disable warnings in case of kernel code causing alignment errors.
      
      Signed-off by: Andre Draszik <andre.draszik@st.com>
      Signed-off-by: NStuart Menefy <stuart.menefy@st.com>
      Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
      7436cde6
    • A
      sh: ratelimit unaligned fixups · 9a4af027
      Andre Draszik 提交于
      This patch makes sure we see messages about unaligned access fixups
      every now and then. Else especially userspace apps suffering from
      bad programming won't ever be noticed...
      
      Signed-off by: Andre Draszik <andre.draszik@st.com>
      Signed-off-by: NStuart Menefy <stuart.menefy@st.com>
      Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
      9a4af027
  2. 23 8月, 2009 14 次提交
  3. 22 8月, 2009 14 次提交
  4. 21 8月, 2009 6 次提交
    • M
      sh: Handle the DWARF op, DW_CFA_undefined · 5580e904
      Matt Fleming 提交于
      Allow a DWARF register to have an undefined value. When applied to the
      DWARF return address register this lets lets us label a function as
      having no direct caller, e.g. kernel_thread_helper().
      Signed-off-by: NMatt Fleming <matt@console-pimps.org>
      5580e904
    • M
      sh: Fix bug calculating the end of the FDE instructions · 5480675d
      Matt Fleming 提交于
      The 'end' member of struct dwarf_fde denotes one byte past the end of
      the CFA instruction stream for an FDE. The value of 'end' was being
      calcualted incorrectly, it was being set too high. This resulted in
      dwarf_cfa_execute_insns() interpreting data past the end of valid
      instructions, thus causing all sorts of weird crashes.
      Signed-off-by: NMatt Fleming <matt@console-pimps.org>
      5480675d
    • M
      sh: Setup the frame pointer in handle_interrupt · fe98dd31
      Matt Fleming 提交于
      When CONFIG_DWARF_UNWINDER is enabled setup r14 in handle_interrupt, so
      that we can figure out what function was running when we were
      interrupted.
      Signed-off-by: NMatt Fleming <matt@console-pimps.org>
      fe98dd31
    • M
      sh: unwinder: Introduce UNWINDER_BUG() and UNWINDER_BUG_ON() · b344e24a
      Matt Fleming 提交于
      We can't assume that if we execute the unwinder code and the unwinder
      was already running that it has faulted. Clearly two kernel threads can
      invoke the unwinder at the same time and may be running simultaneously.
      
      The previous approach used BUG() and BUG_ON() in the unwinder code to
      detect whether the unwinder was incapable of unwinding the stack, and
      that the next available unwinder should be used instead. A better
      approach is to explicitly invoke a trap handler to switch unwinders when
      the current unwinder cannot continue.
      Signed-off-by: NMatt Fleming <matt@console-pimps.org>
      b344e24a
    • M
      sh: unwinder: Set the flags for DW_CFA_val_offset ops as DWARF_VAL_OFFSET · 97efbbd5
      Matt Fleming 提交于
      The handling of DW_CFA_val_offset ops was incorrectly using the
      DWARF_REG_OFFSET flag but the register's value cannot be calculated
      using the DWARF_REG_OFFSET method. Create a new flag to indicate that a
      different method must be used to calculate the register's value even
      though there is no implementation for DWARF_VAL_OFFSET yet; it's mainly
      just a place holder.
      Signed-off-by: NMatt Fleming <matt@console-pimps.org>
      97efbbd5
    • M
      sh: unwinder: Fix memory leak and create our own kmem cache · fb3f3e7f
      Matt Fleming 提交于
      Plug a memory leak in dwarf_unwinder_dump() where we didn't free the
      memory that we had previously allocated for the DWARF frames and DWARF
      registers.
      
      Now is also a opportune time to implement our own mempool and kmem
      cache. It's a good idea to have a certain number of frame and register
      objects in reserve at all times, so that we are guaranteed to have our
      allocation satisfied even when memory is scarce. Since we have pools to
      allocate from we can implement the registers for each frame as a linked
      list as opposed to a sparsely populated array. Whilst it's true that the
      lookup time for a linked list is larger than for arrays, there's only
      usually a maximum of 8 registers per frame. So the overhead isn't that
      much of a concern.
      Signed-off-by: NMatt Fleming <matt@console-pimps.org>
      fb3f3e7f