1. 23 Jun, 2010 1 commit
  2. 22 Jun, 2010 6 commits
    • K.Prasad's avatar
      powerpc, hw_breakpoint: Discard extraneous interrupt due to accesses outside symbol length · e3e94084
      K.Prasad authored
      Many a times, the requested breakpoint length can be less than the
      fixed breakpoint length i.e. 8 bytes supported by PowerPC 64-bit
      server (Book III S) processors.  This could lead to extraneous
      interrupts resulting in false breakpoint notifications.  This
      detects and discards such interrupts for non-ptrace requests.
      We don't change ptrace behaviour to avoid breaking compatability.
      
      [Suggestion from Paul Mackerras <paulus@samba.org> to add a new flag in
      'struct arch_hw_breakpoint' to identify extraneous interrupts]
      Signed-off-by: default avatarK.Prasad <prasad@linux.vnet.ibm.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      e3e94084
    • K.Prasad's avatar
      powerpc, hw_breakpoint: Enable hw-breakpoints while handling intervening signals · 06532a67
      K.Prasad authored
      A signal delivered between a hw_breakpoint_handler() and the
      single_step_dabr_instruction() will not have the breakpoint active
      while the signal handler is running -- the signal delivery will
      set up a new MSR value which will not have MSR_SE set, so we
      won't get the signal step interrupt until and unless the signal
      handler returns (which it may never do).
      
      To fix this, we restore the breakpoint when delivering a signal --
      we clear the MSR_SE bit and set the DABR again.  If the signal
      handler returns, the DABR interrupt will occur again when the
      instruction that we were originally trying to single-step gets
      re-executed.
      
      [Paul Mackerras <paulus@samba.org> pointed out the need to do this.]
      Signed-off-by: default avatarK.Prasad <prasad@linux.vnet.ibm.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      06532a67
    • K.Prasad's avatar
      powerpc, hw_breakpoint: Handle concurrent alignment interrupts · 2538c2d0
      K.Prasad authored
      If an alignment interrupt occurs on an instruction that is being
      single-stepped, the alignment interrupt handler currently handles
      the single-step condition by unconditionally sending a SIGTRAP to
      the process.  Other synchronous interrupts that result in the
      instruction being emulated do likewise.
      
      With hw_breakpoint support, the hw_breakpoint code needs to be able
      to intercept these single-step events as well as those where the
      instruction executes normally and a trace interrupt happens.
      
      Fix this by making emulate_single_step() use the existing
      single_step_exception() function instead of calling _exception()
      directly.  We then make single_step_exception() use the abstracted
      clear_single_step() rather than clearing bits in the MSR image
      directly so that emulate_single_step() will continue to work
      correctly on Book 3E processors.
      Signed-off-by: default avatarK.Prasad <prasad@linux.vnet.ibm.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      2538c2d0
    • K.Prasad's avatar
      powerpc, hw_breakpoints: Implement hw_breakpoints for 64-bit server processors · 5aae8a53
      K.Prasad authored
      Implement perf-events based hw-breakpoint interfaces for PowerPC
      64-bit server (Book III S) processors.  This allows access to a
      given location to be used as an event that can be counted or
      profiled by the perf_events subsystem.
      
      This is done using the DABR (data breakpoint register), which can
      also be used for process debugging via ptrace.  When perf_event
      hw_breakpoint support is configured in, the perf_event subsystem
      manages the DABR and arbitrates access to it, and ptrace then
      creates a perf_event when it is requested to set a data breakpoint.
      
      [Adopted suggestions from Paul Mackerras <paulus@samba.org> to
      - emulate_step() all system-wide breakpoints and single-step only the
        per-task breakpoints
      - perform arch-specific cleanup before unregistration through
        arch_unregister_hw_breakpoint()
      ]
      Signed-off-by: default avatarK.Prasad <prasad@linux.vnet.ibm.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      5aae8a53
    • K.Prasad's avatar
      hw_breakpoints: Allow arch-specific cleanup before breakpoint unregistration · f7136c51
      K.Prasad authored
      Certain architectures (such as PowerPC) have a need to clean up data
      structures before a breakpoint is unregistered.  This introduces an
      arch-specific hook in release_bp_slot() along with a weak definition
      in the form of a stub function.
      Signed-off-by: default avatarK.Prasad <prasad@linux.vnet.ibm.com>
      Acked-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      f7136c51
    • Paul Mackerras's avatar
      powerpc: Emulate most Book I instructions in emulate_step() · 0016a4cf
      Paul Mackerras authored
      This extends the emulate_step() function to handle a large proportion
      of the Book I instructions implemented on current 64-bit server
      processors.  The aim is to handle all the load and store instructions
      used in the kernel, plus all of the instructions that appear between
      l[wd]arx and st[wd]cx., so this handles the Altivec/VMX lvx and stvx
      and the VSX lxv2dx and stxv2dx instructions (implemented in POWER7).
      
      The new code can emulate user mode instructions, and checks the
      effective address for a load or store if the saved state is for
      user mode.  It doesn't handle little-endian mode at present.
      
      For floating-point, Altivec/VMX and VSX instructions, it checks
      that the saved MSR has the enable bit for the relevant facility
      set, and if so, assumes that the FP/VMX/VSX registers contain
      valid state, and does loads or stores directly to/from the
      FP/VMX/VSX registers, using assembly helpers in ldstfp.S.
      
      Instructions supported now include:
      * Loads and stores, including some but not all VMX and VSX instructions,
        and lmw/stmw
      * Atomic loads and stores (l[dw]arx, st[dw]cx.)
      * Arithmetic instructions (add, subtract, multiply, divide, etc.)
      * Compare instructions
      * Rotate and mask instructions
      * Shift instructions
      * Logical instructions (and, or, xor, etc.)
      * Condition register logical instructions
      * mtcrf, cntlz[wd], exts[bhw]
      * isync, sync, lwsync, ptesync, eieio
      * Cache operations (dcbf, dcbst, dcbt, dcbtst)
      
      The overflow-checking arithmetic instructions are not included, but
      they appear not to be ever used in C code.
      
      This uses decimal values for the minor opcodes in the switch statements
      because that is what appears in the Power ISA specification, thus it is
      easier to check that they are correct if they are in decimal.
      
      If this is used to single-step an instruction where a data breakpoint
      interrupt occurred, then there is the possibility that the instruction
      is a lwarx or ldarx.  In that case we have to be careful not to lose the
      reservation until we get to the matching st[wd]cx., or we'll never make
      forward progress.  One alternative is to try to arrange that we can
      return from interrupts and handle data breakpoint interrupts without
      losing the reservation, which means not using any spinlocks, mutexes,
      or atomic ops (including bitops).  That seems rather fragile.  The
      other alternative is to emulate the larx/stcx and all the instructions
      in between.  This is why this commit adds support for a wide range
      of integer instructions.
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      0016a4cf
  3. 12 Jun, 2010 1 commit
  4. 11 Jun, 2010 32 commits