[BACK]Return to __sigtramp2.S CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libc / arch / hppa / sys

Annotation of src/lib/libc/arch/hppa/sys/__sigtramp2.S, Revision 1.2.10.1

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

CVSweb <webmaster@jp.NetBSD.org>