xscale: add support for length arg to wp command
commit4f1296d1510715b5504f39909dadae79698aa27a
authorMike Dunn <mikedunn@newsguy.com>
Wed, 21 Apr 2010 17:40:51 +0000 (21 13:40 -0400)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Sat, 24 Apr 2010 14:54:36 +0000 (24 16:54 +0200)
tree47b48eee1ba99799f8e06eb71bb0d85a2999714f
parentc6cd253ae105a9542f051d4af3fda7e9a1c7140b
xscale: add support for length arg to wp command

This patch adds support for the length argument to the xscale implementation of
the wp command.  Per discussion with David, the length argument specifies the
range of addresses over which a memory access should generate a debug exception.
This patch utilizes the "mask" feature of the xscale debug hardware to implement
the correct functionality of the length argument.  Some limitations imposed by
the hardware are:

   - The length must be a power of two, with a minumum of 4.
   - Two data breakpoint registers are available, allowing for two watchpoints.
     However, if the length of a watchpoint is greater than four, both registers
     are used (the second for a mask value), limiting the number of watchpoints
     to one.

This patch also removes a useless call to xscale_get_reg(dbcon) in
xscale_set_watchpoint() (value had already been read from the register cache,
and the same previously read value is then modified and written back).

I have been using and testing this patch for a couple days.

Questions, corrections, criticisms of course gratefully received.
src/target/xscale.c