selftests/powerpc/ptrace: Do more of ptrace-gpr in asm
The ptrace-gpr test includes some inline asm to load GPR and FPR registers. It then goes back to C to wait for the parent to trace it and then checks register contents. The split between inline asm and C is fragile, it relies on the compiler not using any non-volatile GPRs after the inline asm block. It also requires a very large and unwieldy inline asm block. So convert the logic to set registers, wait, and store registers to a single asm function, meaning there's no window for the compiler to intervene. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20220627140239.2464900-10-mpe@ellerman.id.au
This commit is contained in:
@@ -94,4 +94,12 @@
|
||||
PPC_LL r0, STACK_FRAME_LR_POS(%r1); \
|
||||
mtlr r0;
|
||||
|
||||
.macro OP_REGS op, reg_width, start_reg, end_reg, base_reg, base_reg_offset=0, skip=0
|
||||
.set i, \start_reg
|
||||
.rept (\end_reg - \start_reg + 1)
|
||||
\op i, (\reg_width * (i - \skip) + \base_reg_offset)(\base_reg)
|
||||
.set i, i + 1
|
||||
.endr
|
||||
.endm
|
||||
|
||||
#endif /* _SELFTESTS_POWERPC_BASIC_ASM_H */
|
||||
|
||||
Reference in New Issue
Block a user