xref: /linux/tools/testing/selftests/powerpc/signal/signal.S (revision a4eb44a6435d6d8f9e642407a4a06f65eb90ca04)
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright 2015, Cyril Bur, IBM Corp.
4 */
5
6#include "basic_asm.h"
7
8/* long signal_self(pid_t pid, int sig); */
9FUNC_START(signal_self)
10	li	r0,37 /* sys_kill */
11	/* r3 already has our pid in it */
12	/* r4 already has signal type in it */
13	sc
14	bc	4,3,1f
15	subfze	r3,r3
161:	blr
17FUNC_END(signal_self)
18
19/* long tm_signal_self(pid_t pid, int sig, int *ret); */
20FUNC_START(tm_signal_self)
21	PUSH_BASIC_STACK(8)
22	std	r5,STACK_FRAME_PARAM(0)(sp) /* ret */
23	tbegin.
24	beq	1f
25	tsuspend.
26	li	r0,37 /* sys_kill */
27	/* r3 already has our pid in it */
28	/* r4 already has signal type in it */
29	sc
30	ld	r5,STACK_FRAME_PARAM(0)(sp) /* ret */
31	bc	4,3,2f
32	subfze	r3,r3
332:	std	r3,0(r5)
34	tabort. 0
35	tresume. /* Be nice to some cleanup, jumps back to tbegin then to 1: */
36	/*
37	 * Transaction should be proper doomed and we should never get
38	 * here
39	 */
40	li	r3,1
41	POP_BASIC_STACK(8)
42	blr
431:	li	r3,0
44	POP_BASIC_STACK(8)
45	blr
46FUNC_END(tm_signal_self)
47