Home | History | Annotate | Line # | Download | only in sys
      1  1.1  christos /*	$NetBSD: compat___sigtramp1.S,v 1.1 2021/10/30 21:39:28 christos Exp $	*/
      2  1.1  christos 
      3  1.1  christos /*
      4  1.1  christos  * Copyright (c) 1998-2001 Michael Shalayeff
      5  1.1  christos  * All rights reserved.
      6  1.1  christos  *
      7  1.1  christos  * Redistribution and use in source and binary forms, with or without
      8  1.1  christos  * modification, are permitted provided that the following conditions
      9  1.1  christos  * are met:
     10  1.1  christos  * 1. Redistributions of source code must retain the above copyright
     11  1.1  christos  *    notice, this list of conditions and the following disclaimer.
     12  1.1  christos  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  christos  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  christos  *    documentation and/or other materials provided with the distribution.
     15  1.1  christos  * 3. All advertising materials mentioning features or use of this software
     16  1.1  christos  *    must display the following acknowledgement:
     17  1.1  christos  *      This product includes software developed by Michael Shalayeff.
     18  1.1  christos  * 4. The name of the author may not be used to endorse or promote products
     19  1.1  christos  *    derived from this software without specific prior written permission.
     20  1.1  christos  *
     21  1.1  christos  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22  1.1  christos  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23  1.1  christos  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24  1.1  christos  * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
     25  1.1  christos  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     26  1.1  christos  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     27  1.1  christos  * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     28  1.1  christos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     29  1.1  christos  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     30  1.1  christos  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     31  1.1  christos  * THE POSSIBILITY OF SUCH DAMAGE.
     32  1.1  christos  *
     33  1.1  christos  * Portitions of this file are derived from other sources, see
     34  1.1  christos  * the copyrights and acknowledgements below.
     35  1.1  christos  */
     36  1.1  christos /*
     37  1.1  christos  * Copyright (c) 1990,1991,1992,1994 The University of Utah and
     38  1.1  christos  * the Computer Systems Laboratory (CSL).  All rights reserved.
     39  1.1  christos  *
     40  1.1  christos  * THE UNIVERSITY OF UTAH AND CSL PROVIDE THIS SOFTWARE IN ITS "AS IS"
     41  1.1  christos  * CONDITION, AND DISCLAIM ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
     42  1.1  christos  * WHATSOEVER RESULTING FROM ITS USE.
     43  1.1  christos  *
     44  1.1  christos  * CSL requests users of this software to return to csl-dist (at) cs.utah.edu any
     45  1.1  christos  * improvements that they make and grant CSL redistribution rights.
     46  1.1  christos  *
     47  1.1  christos  *	Utah $Hdr: locore.s 1.62 94/12/15$
     48  1.1  christos  */
     49  1.1  christos /*
     50  1.1  christos  *  (c) Copyright 1988 HEWLETT-PACKARD COMPANY
     51  1.1  christos  *
     52  1.1  christos  *  To anyone who acknowledges that this file is provided "AS IS"
     53  1.1  christos  *  without any express or implied warranty:
     54  1.1  christos  *      permission to use, copy, modify, and distribute this file
     55  1.1  christos  *  for any purpose is hereby granted without fee, provided that
     56  1.1  christos  *  the above copyright notice and this notice appears in all
     57  1.1  christos  *  copies, and that the name of Hewlett-Packard Company not be
     58  1.1  christos  *  used in advertising or publicity pertaining to distribution
     59  1.1  christos  *  of the software without specific, written prior permission.
     60  1.1  christos  *  Hewlett-Packard Company makes no representations about the
     61  1.1  christos  *  suitability of this software for any purpose.
     62  1.1  christos  */
     63  1.1  christos 
     64  1.1  christos #include "SYS.h"
     65  1.1  christos 
     66  1.1  christos ENTRY_NOPROFILE(__sigtramp_sigcontext_1,0)
     67  1.1  christos 	.call
     68  1.1  christos 	/*
     69  1.1  christos 	 * Our sendsig() places the address of the signal handler
     70  1.1  christos 	 * in %arg3.  It may actually be a PLABEL.
     71  1.1  christos 	 */
     72  1.1  christos 	bb,>=,n	%arg3, 30, L$sigcode_bounce	; branch if not a PLABEL
     73  1.1  christos 	depi	0, 31, 2, %arg3			; zero L bit in PLABEL pointer
     74  1.1  christos 	ldw	4(%arg3), %r19			; load shared library linkage
     75  1.1  christos 	ldw	0(%arg3), %arg3			; load real catcher address
     76  1.1  christos L$sigcode_bounce:
     77  1.1  christos 	/*
     78  1.1  christos 	 * This blr puts the address of the following nop in rp.
     79  1.1  christos 	 * It also schedules the nop for execution, which is why
     80  1.1  christos 	 * that instruction has to be a nop, or, rather, not any
     81  1.1  christos 	 * instruction only meant to execute once the signal handler
     82  1.1  christos 	 * returns.
     83  1.1  christos 	 */
     84  1.1  christos 	blr	%r0, %rp
     85  1.1  christos 	/*
     86  1.1  christos 	 * This bv schedules the instruction pointed to by arg3
     87  1.1  christos 	 * for execution.  So, arg3 is the address of the signal
     88  1.1  christos 	 * handler.
     89  1.1  christos 	 */
     90  1.1  christos 	bv,n	%r0(%arg3)
     91  1.1  christos 	nop
     92  1.1  christos 	/*
     93  1.1  christos 	 * The signal handler has returned.  Since r3 is on the list
     94  1.1  christos 	 * of callee-saved registers, it's whatever the sendsig
     95  1.1  christos 	 * code wanted it set to.  Since we copy it into arg0,
     96  1.1  christos 	 * it looks like sendsig leaves r3 holding the desired
     97  1.1  christos 	 * single argument to sys___sigreturn14, i.e., the
     98  1.1  christos 	 * struct sigcontext *.
     99  1.1  christos 	 */
    100  1.1  christos 	/* Make a SYS___sigreturn14 system call. */
    101  1.1  christos 	copy	%r3, %arg0
    102  1.1  christos 	ldil	L%SYSCALLGATE, %r1
    103  1.1  christos 	.call
    104  1.1  christos 	ble	4(%sr7, %r1)
    105  1.1  christos 	ldi	SYS_compat_16___sigreturn14, %t1
    106  1.1  christos 	/* Make a SYS_exit system call. */
    107  1.1  christos 	copy	%ret0, %arg0
    108  1.1  christos 	ldil	L%SYSCALLGATE, %r1
    109  1.1  christos 	.call
    110  1.1  christos 	ble	4(%sr7, %r1)
    111  1.1  christos 	ldi	SYS_exit, %t1
    112  1.1  christos EXIT(__sigtramp_sigcontext_1)
    113