__sigtramp2.S revision 1.4
11.4Sskrll/*	$NetBSD: __sigtramp2.S,v 1.4 2020/10/15 05:50:15 skrll Exp $ */
21.1Suwe
31.1Suwe/*-
41.1Suwe * Copyright (c) 2003 The NetBSD Foundation, Inc.
51.1Suwe * All rights reserved.
61.1Suwe *
71.1Suwe * This code is derived from software contributed to The NetBSD Foundation
81.1Suwe * by Jason R. Thorpe.
91.1Suwe *
101.1Suwe * Redistribution and use in source and binary forms, with or without
111.1Suwe * modification, are permitted provided that the following conditions
121.1Suwe * are met:
131.1Suwe * 1. Redistributions of source code must retain the above copyright
141.1Suwe *    notice, this list of conditions and the following disclaimer.
151.1Suwe * 2. Redistributions in binary form must reproduce the above copyright
161.1Suwe *    notice, this list of conditions and the following disclaimer in the
171.1Suwe *    documentation and/or other materials provided with the distribution.
181.1Suwe *
191.1Suwe * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
201.1Suwe * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
211.1Suwe * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
221.1Suwe * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
231.1Suwe * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
241.1Suwe * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
251.1Suwe * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
261.1Suwe * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
271.1Suwe * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
281.1Suwe * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
291.1Suwe * POSSIBILITY OF SUCH DAMAGE.
301.1Suwe */
311.1Suwe
321.1Suwe#include "SYS.h"
331.1Suwe
341.1Suwe/*
351.1Suwe * The SH signal trampoline is invoked only to return from
361.1Suwe * the signal; the kernel calls the signal handler directly.
371.1Suwe *
381.1Suwe * On entry, stack looks like:
391.1Suwe *
401.1Suwe *		siginfo structure
411.1Suwe *	sp->	ucontext structure
421.1Suwe *
431.1Suwe * NB: This order is different from what other ports use (siginfo at
441.1Suwe * the top of the stack), because we want to avoid wasting two
451.1Suwe * instructions to skip to the ucontext.  Not that this order really
461.4Sskrll * matters, but I think this inconsistency deserves an explanation.
471.1Suwe */
481.1SuweNENTRY(__sigtramp_siginfo_2)
491.1Suwe	mov	r15, r4			/* get pointer to ucontext */
501.1Suwe	SYSTRAP(setcontext)		/* and call setcontext() */
511.1Suwe	mov	r0, r4			/* exit with errno */
521.1Suwe	SYSTRAP(exit)			/* if sigreturn fails */
531.2Suwe
541.2Suwe	SET_ENTRY_SIZE(__sigtramp_siginfo_2)
55