signal.h revision 1.1
11.1Sfvdl/* $NetBSD: signal.h,v 1.1 2003/04/26 18:39:48 fvdl Exp $ */ 21.1Sfvdl 31.1Sfvdl/* 41.1Sfvdl * Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California. 51.1Sfvdl * All rights reserved. 61.1Sfvdl * 71.1Sfvdl * Redistribution and use in source and binary forms, with or without 81.1Sfvdl * modification, are permitted provided that the following conditions 91.1Sfvdl * are met: 101.1Sfvdl * 1. Redistributions of source code must retain the above copyright 111.1Sfvdl * notice, this list of conditions and the following disclaimer. 121.1Sfvdl * 2. Redistributions in binary form must reproduce the above copyright 131.1Sfvdl * notice, this list of conditions and the following disclaimer in the 141.1Sfvdl * documentation and/or other materials provided with the distribution. 151.1Sfvdl * 3. All advertising materials mentioning features or use of this software 161.1Sfvdl * must display the following acknowledgement: 171.1Sfvdl * This product includes software developed by the University of 181.1Sfvdl * California, Berkeley and its contributors. 191.1Sfvdl * 4. Neither the name of the University nor the names of its contributors 201.1Sfvdl * may be used to endorse or promote products derived from this software 211.1Sfvdl * without specific prior written permission. 221.1Sfvdl * 231.1Sfvdl * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 241.1Sfvdl * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 251.1Sfvdl * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 261.1Sfvdl * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 271.1Sfvdl * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 281.1Sfvdl * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 291.1Sfvdl * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 301.1Sfvdl * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 311.1Sfvdl * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 321.1Sfvdl * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 331.1Sfvdl * SUCH DAMAGE. 341.1Sfvdl * 351.1Sfvdl * @(#)signal.h 7.16 (Berkeley) 3/17/91 361.1Sfvdl */ 371.1Sfvdl 381.1Sfvdl#ifndef _AMD64_SIGNAL_H_ 391.1Sfvdl#define _AMD64_SIGNAL_H_ 401.1Sfvdl 411.1Sfvdltypedef int sig_atomic_t; 421.1Sfvdl 431.1Sfvdl#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \ 441.1Sfvdl !defined(_XOPEN_SOURCE) 451.1Sfvdl/* 461.1Sfvdl * Get the "code" values 471.1Sfvdl */ 481.1Sfvdl#include <machine/trap.h> 491.1Sfvdl#include <machine/fpu.h> 501.1Sfvdl#include <machine/mcontext.h> 511.1Sfvdl 521.1Sfvdl/* 531.1Sfvdl * Information pushed on stack when a signal is delivered. 541.1Sfvdl * This is used by the kernel to restore state following 551.1Sfvdl * execution of the signal handler. It is also made available 561.1Sfvdl * to the handler to allow it to restore state properly if 571.1Sfvdl * a non-standard exit is performed. 581.1Sfvdl */ 591.1Sfvdlstruct sigcontext { 601.1Sfvdl struct fxsave64 *sc_fpstate; 611.1Sfvdl u_int64_t sc_onstack; 621.1Sfvdl sigset_t sc_mask; 631.1Sfvdl mcontext_t sc_mcontext; 641.1Sfvdl}; 651.1Sfvdl 661.1Sfvdl#define _MCONTEXT_TO_SIGCONTEXT(uc, sc) \ 671.1Sfvdldo { \ 681.1Sfvdl memcpy(&(sc)->sc_mcontext.__gregs, &(uc)->uc_mcontext.__gregs, \ 691.1Sfvdl sizeof ((uc)->uc_mcontext.__gregs)); \ 701.1Sfvdl if ((uc)->uc_flags & _UC_FPU) { \ 711.1Sfvdl memcpy(&(sc)->sc_mcontext.__fpregs, \ 721.1Sfvdl &(uc)->uc_mcontext.__fpregs, \ 731.1Sfvdl sizeof ((uc)->uc_mcontext.__fpregs)); \ 741.1Sfvdl } \ 751.1Sfvdl} while (/*CONSTCOND*/0) 761.1Sfvdl 771.1Sfvdl#define _SIGCONTEXT_TO_MCONTEXT(sc, uc) \ 781.1Sfvdldo { \ 791.1Sfvdl memcpy(&(uc)->uc_mcontext.__gregs, &(sc)->sc_mcontext.__gregs, \ 801.1Sfvdl sizeof ((uc)->uc_mcontext.__gregs)); \ 811.1Sfvdl if ((uc)->uc_flags & _UC_FPU) { \ 821.1Sfvdl memcpy(&(uc)->uc_mcontext.__fpregs, \ 831.1Sfvdl &(sc)->sc_mcontext.__fpregs, \ 841.1Sfvdl sizeof ((uc)->uc_mcontext.__fpregs)); \ 851.1Sfvdl } \ 861.1Sfvdl} while (/*CONSTCOND*/0) 871.1Sfvdl 881.1Sfvdl#endif /* !_ANSI_SOURCE && !_POSIX_C_SOURCE && !_XOPEN_SOURCE */ 891.1Sfvdl#endif /* !_AMD64_SIGNAL_H_ */ 90