195719Sbenno/* $FreeBSD$ */ 295719Sbenno/* $NetBSD: sigcode.S,v 1.1 1999/11/17 14:56:11 kleink Exp $ */ 395719Sbenno 4139825Simp/*- 595719Sbenno * Copyright (C) 1995, 1996 Wolfgang Solfrank. 695719Sbenno * Copyright (C) 1995, 1996 TooLs GmbH. 795719Sbenno * All rights reserved. 895719Sbenno * 995719Sbenno * Redistribution and use in source and binary forms, with or without 1095719Sbenno * modification, are permitted provided that the following conditions 1195719Sbenno * are met: 1295719Sbenno * 1. Redistributions of source code must retain the above copyright 1395719Sbenno * notice, this list of conditions and the following disclaimer. 1495719Sbenno * 2. Redistributions in binary form must reproduce the above copyright 1595719Sbenno * notice, this list of conditions and the following disclaimer in the 1695719Sbenno * documentation and/or other materials provided with the distribution. 1795719Sbenno * 3. All advertising materials mentioning features or use of this software 1895719Sbenno * must display the following acknowledgement: 1995719Sbenno * This product includes software developed by TooLs GmbH. 2095719Sbenno * 4. The name of TooLs GmbH may not be used to endorse or promote products 2195719Sbenno * derived from this software without specific prior written permission. 2295719Sbenno * 2395719Sbenno * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 2495719Sbenno * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2595719Sbenno * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2695719Sbenno * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2795719Sbenno * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 2895719Sbenno * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 2995719Sbenno * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 3095719Sbenno * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 3195719Sbenno * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 3295719Sbenno * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3395719Sbenno */ 3495719Sbenno 3595719Sbenno#include <machine/asm.h> 3695719Sbenno#include <sys/syscall.h> 37103605Sgrehan#include "assym.s" 3895719Sbenno 3995719Sbenno/* 4095719Sbenno * The following code gets copied to the top of the user stack on process 4195719Sbenno * execution. It does signal trampolining on signal delivery. 4295719Sbenno * 4395719Sbenno * On entry r1 points to a struct sigframe at bottom of current stack. 4495719Sbenno * All other registers are unchanged. 4595719Sbenno */ 46209975Snwhitehorn .globl CNAME(sigcode64),CNAME(szsigcode64) 47209975SnwhitehornCNAME(sigcode64): 48209975Snwhitehorn addi 1,1,-48 /* reserved space for callee */ 49209975Snwhitehorn mflr 2 /* resolve function descriptor */ 50209975Snwhitehorn ld 0,0(2) 51209975Snwhitehorn ld 2,8(2) 52209975Snwhitehorn mtlr 0 53209975Snwhitehorn 5495719Sbenno blrl 55209975Snwhitehorn 56209975Snwhitehorn addi 3,1,48+SF_UC /* restore sp, and get &frame->sf_uc */ 5795719Sbenno li 0,SYS_sigreturn 5895719Sbenno sc /* sigreturn(scp) */ 5995719Sbenno li 0,SYS_exit 6095719Sbenno sc /* exit(errno) */ 61209975Snwhitehorn nop /* align to doubleword */ 62209975Snwhitehornendsigcode64: 63103605Sgrehan 64103605Sgrehan .data 65209975SnwhitehornCNAME(szsigcode64): 66209975Snwhitehorn .long endsigcode64 - CNAME(sigcode64) 67