Home | History | Annotate | Download | only in signal
      1 /*
      2  * Copyright 2015, Cyril Bur, IBM Corp.
      3  *
      4  * This program is free software; you can redistribute it and/or
      5  * modify it under the terms of the GNU General Public License
      6  * as published by the Free Software Foundation; either version
      7  * 2 of the License, or (at your option) any later version.
      8  */
      9 
     10 #include "basic_asm.h"
     11 
     12 /* long signal_self(pid_t pid, int sig); */
     13 FUNC_START(signal_self)
     14 	li	r0,37 /* sys_kill */
     15 	/* r3 already has our pid in it */
     16 	/* r4 already has signal type in it */
     17 	sc
     18 	bc	4,3,1f
     19 	subfze	r3,r3
     20 1:	blr
     21 FUNC_END(signal_self)
     22 
     23 /* long tm_signal_self(pid_t pid, int sig, int *ret); */
     24 FUNC_START(tm_signal_self)
     25 	PUSH_BASIC_STACK(8)
     26 	std	r5,STACK_FRAME_PARAM(0)(sp) /* ret */
     27 	tbegin.
     28 	beq	1f
     29 	tsuspend.
     30 	li	r0,37 /* sys_kill */
     31 	/* r3 already has our pid in it */
     32 	/* r4 already has signal type in it */
     33 	sc
     34 	ld	r5,STACK_FRAME_PARAM(0)(sp) /* ret */
     35 	bc	4,3,2f
     36 	subfze	r3,r3
     37 2:	std	r3,0(r5)
     38 	tabort. 0
     39 	tresume. /* Be nice to some cleanup, jumps back to tbegin then to 1: */
     40 	/*
     41 	 * Transaction should be proper doomed and we should never get
     42 	 * here
     43 	 */
     44 	li	r3,1
     45 	POP_BASIC_STACK(8)
     46 	blr
     47 1:	li	r3,0
     48 	POP_BASIC_STACK(8)
     49 	blr
     50 FUNC_END(tm_signal_self)
     51