162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright 2015, Cyril Bur, IBM Corp.
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#include "basic_asm.h"
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci/* long signal_self(pid_t pid, int sig); */
962306a36Sopenharmony_ciFUNC_START(signal_self)
1062306a36Sopenharmony_ci	li	r0,37 /* sys_kill */
1162306a36Sopenharmony_ci	/* r3 already has our pid in it */
1262306a36Sopenharmony_ci	/* r4 already has signal type in it */
1362306a36Sopenharmony_ci	sc
1462306a36Sopenharmony_ci	bc	4,3,1f
1562306a36Sopenharmony_ci	subfze	r3,r3
1662306a36Sopenharmony_ci1:	blr
1762306a36Sopenharmony_ciFUNC_END(signal_self)
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci/* long tm_signal_self(pid_t pid, int sig, int *ret); */
2062306a36Sopenharmony_ciFUNC_START(tm_signal_self)
2162306a36Sopenharmony_ci	PUSH_BASIC_STACK(8)
2262306a36Sopenharmony_ci	std	r5,STACK_FRAME_PARAM(0)(sp) /* ret */
2362306a36Sopenharmony_ci	tbegin.
2462306a36Sopenharmony_ci	beq	1f
2562306a36Sopenharmony_ci	tsuspend.
2662306a36Sopenharmony_ci	li	r0,37 /* sys_kill */
2762306a36Sopenharmony_ci	/* r3 already has our pid in it */
2862306a36Sopenharmony_ci	/* r4 already has signal type in it */
2962306a36Sopenharmony_ci	sc
3062306a36Sopenharmony_ci	ld	r5,STACK_FRAME_PARAM(0)(sp) /* ret */
3162306a36Sopenharmony_ci	bc	4,3,2f
3262306a36Sopenharmony_ci	subfze	r3,r3
3362306a36Sopenharmony_ci2:	std	r3,0(r5)
3462306a36Sopenharmony_ci	tabort. 0
3562306a36Sopenharmony_ci	tresume. /* Be nice to some cleanup, jumps back to tbegin then to 1: */
3662306a36Sopenharmony_ci	/*
3762306a36Sopenharmony_ci	 * Transaction should be proper doomed and we should never get
3862306a36Sopenharmony_ci	 * here
3962306a36Sopenharmony_ci	 */
4062306a36Sopenharmony_ci	li	r3,1
4162306a36Sopenharmony_ci	POP_BASIC_STACK(8)
4262306a36Sopenharmony_ci	blr
4362306a36Sopenharmony_ci1:	li	r3,0
4462306a36Sopenharmony_ci	POP_BASIC_STACK(8)
4562306a36Sopenharmony_ci	blr
4662306a36Sopenharmony_ciFUNC_END(tm_signal_self)
47