• Jordan Niethe's avatar
    powerpc/xmon: Move breakpoint instructions to own array · 51c9ba11
    Jordan Niethe authored
    To execute an instruction out of line after a breakpoint, the NIP is set
    to the address of struct bpt::instr. Here a copy of the instruction that
    was replaced with a breakpoint is kept, along with a trap so normal flow
    can be resumed after XOLing. The struct bpt's are located within the
    data section. This is problematic as the data section may be marked as
    no execute.
    
    Instead of each struct bpt holding the instructions to be XOL'd, make a
    new array, bpt_table[], with enough space to hold instructions for the
    number of supported breakpoints. A later patch will move this to the
    text section.
    Make struct bpt::instr a pointer to the instructions in bpt_table[]
    associated with that breakpoint. This association is a simple mapping:
    bpts[n] -> bpt_table[n * words per breakpoint]. Currently we only need
    the copied instruction followed by a trap, so 2 words per breakpoint.
    Signed-off-by: default avatarJordan Niethe <jniethe5@gmail.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Reviewed-by: default avatarAlistair Popple <alistair@popple.id.au>
    Link: https://lore.kernel.org/r/20200506034050.24806-3-jniethe5@gmail.com
    51c9ba11
xmon.c 88.3 KB