arm64: ptrace: Add a comment describing our syscall entry/exit trap ABI
[linux-2.6-microblaze.git] / arch / arm64 / kernel / ptrace.c
index 22f9053..89fbee3 100644 (file)
@@ -1811,8 +1811,20 @@ static void tracehook_report_syscall(struct pt_regs *regs,
        unsigned long saved_reg;
 
        /*
-        * A scratch register (ip(r12) on AArch32, x7 on AArch64) is
-        * used to denote syscall entry/exit:
+        * We have some ABI weirdness here in the way that we handle syscall
+        * exit stops because we indicate whether or not the stop has been
+        * signalled from syscall entry or syscall exit by clobbering a general
+        * purpose register (ip/r12 for AArch32, x7 for AArch64) in the tracee
+        * and restoring its old value after the stop. This means that:
+        *
+        * - Any writes by the tracer to this register during the stop are
+        *   ignored/discarded.
+        *
+        * - The actual value of the register is not available during the stop,
+        *   so the tracer cannot save it and restore it later.
+        *
+        * - Syscall stops behave differently to seccomp and pseudo-step traps
+        *   (the latter do not nobble any registers).
         */
        regno = (is_compat_task() ? 12 : 7);
        saved_reg = regs->regs[regno];