1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright 2015, Cyril Bur, IBM Corp.
13 * Large caveat here being that the caller cannot expect the
14 * signal to always be sent! The hardware can (AND WILL!) abort
15 * the transaction between the tbegin and the tsuspend (however
16 * unlikely it seems or infrequently it actually happens).
17 * You have been warned.
19 /* long tm_signal_self(pid_t pid, long *gprs, double *fps, vector *vms, vector *vss); */
20 FUNC_START(tm_signal_self_context_load)
23 * Don't strictly need to save and restore as it depends on if
24 * we're going to use them, however this reduces messy logic
26 PUSH_VMX(STACK_FRAME_LOCAL(5,0),r8)
28 PUSH_NVREGS_BELOW_FPU(512)
29 std r3, STACK_FRAME_PARAM(0)(sp) /* pid */
30 std r4, STACK_FRAME_PARAM(1)(sp) /* gps */
31 std r5, STACK_FRAME_PARAM(2)(sp) /* fps */
32 std r6, STACK_FRAME_PARAM(3)(sp) /* vms */
33 std r7, STACK_FRAME_PARAM(4)(sp) /* vss */
35 ld r3, STACK_FRAME_PARAM(1)(sp)
40 ld r3, STACK_FRAME_PARAM(2)(sp)
45 ld r3, STACK_FRAME_PARAM(3)(sp)
50 ld r3, STACK_FRAME_PARAM(4)(sp)
56 * Set r3 (return value) before tbegin. Use the pid as a known
57 * 'all good' return value, zero is used to indicate a non-doomed
60 ld r3, STACK_FRAME_PARAM(0)(sp)
63 tsuspend. /* Can't enter a syscall transactionally */
64 ld r3, STACK_FRAME_PARAM(1)(sp)
67 /* Get the second half of the array */
71 ld r3, STACK_FRAME_PARAM(2)(sp)
74 /* Get the second half of the array */
78 ld r3, STACK_FRAME_PARAM(3)(sp)
81 /* Get the second half of the array */
85 ld r3, STACK_FRAME_PARAM(4)(sp)
88 /* Get the second half of the array */
92 li r0, 37 /* sys_kill */
93 ld r3, STACK_FRAME_PARAM(0)(sp) /* pid */
94 li r4, 10 /* SIGUSR1 */
95 sc /* Taking the signal will doom the transaction */
97 tresume. /* Be super sure we abort */
99 * This will cause us to resume doomed transaction and cause
100 * hardware to cleanup, we'll end up at 1: anything between
101 * tresume. and 1: shouldn't ever run.
105 POP_VMX(STACK_FRAME_LOCAL(5,0),r4)
107 POP_NVREGS_BELOW_FPU(512)
110 FUNC_END(tm_signal_self_context_load)