xref: /netbsd-src/lib/libc/compat/arch/i386/sys/compat___sigtramp1.S (revision 0d34bfa26d596b4f9bcb49175a92020d91572850)
1*0d34bfa2Suebayasi/*	$NetBSD: compat___sigtramp1.S,v 1.3 2014/05/23 02:34:33 uebayasi Exp $	*/
25b84b398Schristos
35b84b398Schristos/*-
45b84b398Schristos * Copyright (c) 2002 The NetBSD Foundation, Inc.
55b84b398Schristos * All rights reserved.
65b84b398Schristos *
75b84b398Schristos * This code is derived from software contributed to The NetBSD Foundation
85b84b398Schristos * by Jason R. Thorpe.
95b84b398Schristos *
105b84b398Schristos * Redistribution and use in source and binary forms, with or without
115b84b398Schristos * modification, are permitted provided that the following conditions
125b84b398Schristos * are met:
135b84b398Schristos * 1. Redistributions of source code must retain the above copyright
145b84b398Schristos *    notice, this list of conditions and the following disclaimer.
155b84b398Schristos * 2. Redistributions in binary form must reproduce the above copyright
165b84b398Schristos *    notice, this list of conditions and the following disclaimer in the
175b84b398Schristos *    documentation and/or other materials provided with the distribution.
185b84b398Schristos *
195b84b398Schristos * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
205b84b398Schristos * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
215b84b398Schristos * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
225b84b398Schristos * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
235b84b398Schristos * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
245b84b398Schristos * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
255b84b398Schristos * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
265b84b398Schristos * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
275b84b398Schristos * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
285b84b398Schristos * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
295b84b398Schristos * POSSIBILITY OF SUCH DAMAGE.
305b84b398Schristos */
315b84b398Schristos
325b84b398Schristos#include "SYS.h"
335b84b398Schristos
345b84b398Schristos/*
355b84b398Schristos * The i386 signal trampoline is invoked only to return from
365b84b398Schristos * the signal; the kernel calls the signal handler directly.
375b84b398Schristos *
385b84b398Schristos * On entry, stack looks like:
395b84b398Schristos *
405b84b398Schristos *		sigcontext structure			[12]
415b84b398Schristos *		pointer to sigcontext structure		[8]
425b84b398Schristos *		signal specific code			[4]
435b84b398Schristos *	sp->	signal number				[0]
445b84b398Schristos */
455b84b398SchristosNENTRY(__sigtramp_sigcontext_1)
465b84b398Schristos	leal	12(%esp),%eax	/* get pointer to sigcontext */
475b84b398Schristos	movl	%eax,4(%esp)	/* put it in the argument slot */
485b84b398Schristos				/* fake return address already there */
495b84b398Schristos	SYSTRAP(compat_16___sigreturn14) /* do sigreturn */
505b84b398Schristos	movl	%eax,4(%esp)	/* error code */
515b84b398Schristos	SYSTRAP(exit)		/* exit */
52*0d34bfa2SuebayasiEND(__sigtramp_sigcontext_1)
53