• Will Deacon's avatar
    ARM: hw_breakpoint: correct and simplify alignment fixup code · 6ee33c27
    Will Deacon authored
    The current hw_breakpoint code tries to fix up the alignment of
    breakpoints so that we can make use of sparse byte-address-select
    bits in the control register and give the illusion that we can
    set breakpoints on unaligned addresses.
    
    Although this works on v6 cores, v7 forbids this behaviour, instead
    requiring breakpoints to be set on aligned addresses and have contiguous
    byte-address-select ranges depending on the instruction set in use.
    For ARM the only supported size is 4 bytes, whilst Thumb-2 also permits
    2 byte breakpoints (watchpoints can be of 1, 2, 4 or 8 bytes long).
    
    This patch simplifies the alignment fixup code so that we require
    addresses to be aligned to the size of the corresponding breakpoint.
    This allows us to handle the common case of breaking on a half-word
    aligned Thumb-2 instruction and also allows us to set byte watchpoints
    on arbitrary addresses.
    Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
    6ee33c27
hw_breakpoint.c 20.9 KB