Back to index

glibc  2.9
sigcontext.h
Go to the documentation of this file.
00001 /* Machine-dependent signal context structure for GNU Hurd.  i386 version.
00002    Copyright (C) 1991, 1992, 1994, 1997, 2001 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
00021 # error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
00022 #endif
00023 
00024 #ifndef sc_pc
00025 
00026 /* Signal handlers are actually called:
00027    void handler (int sig, int code, struct sigcontext *scp);  */
00028 
00029 #include <mach/machine/fp_reg.h>
00030 
00031 /* State of this thread when the signal was taken.  */
00032 struct sigcontext
00033   {
00034     /* These first members are machine-independent.  */
00035 
00036     int sc_onstack;         /* Nonzero if running on sigstack.  */
00037     __sigset_t sc_mask;            /* Blocked signals to restore.  */
00038 
00039     /* MiG reply port this thread is using.  */
00040     unsigned int sc_reply_port;
00041 
00042     /* Port this thread is doing an interruptible RPC on.  */
00043     unsigned int sc_intr_port;
00044 
00045     /* Error code associated with this signal (interpreted as `error_t').  */
00046     int sc_error;
00047 
00048     /* All following members are machine-dependent.  The rest of this
00049        structure is written to be laid out identically to:
00050        {
00051         struct i386_thread_state basic;
00052         struct i386_float_state fpu;
00053        }
00054        trampoline.c knows this, so it must be changed if this changes.  */
00055 
00056 #define sc_i386_thread_state sc_gs /* Beginning of correspondence.  */
00057     /* Segment registers.  */
00058     int sc_gs;
00059     int sc_fs;
00060     int sc_es;
00061     int sc_ds;
00062 
00063     /* "General" registers.  These members are in the order that the i386
00064        `pusha' and `popa' instructions use (`popa' ignores %esp).  */
00065     int sc_edi;
00066     int sc_esi;
00067     int sc_ebp;
00068     int sc_esp;                    /* Not used; sc_uesp is used instead.  */
00069     int sc_ebx;
00070     int sc_edx;
00071     int sc_ecx;
00072     int sc_eax;
00073 
00074     int sc_eip;                    /* Instruction pointer.  */
00075     int sc_cs;                     /* Code segment register.  */
00076 
00077     int sc_efl;                    /* Processor flags.  */
00078 
00079     int sc_uesp;            /* This stack pointer is used.  */
00080     int sc_ss;                     /* Stack segment register.  */
00081 
00082     /* Following mimics struct i386_float_state.  Structures and symbolic
00083        values can be found in <mach/i386/fp_reg.h>.  */
00084 #define sc_i386_float_state sc_fpkind
00085     int sc_fpkind;          /* FP_NO, FP_387, etc.  */
00086     int sc_fpused;          /* If zero, ignore rest of float state.  */
00087     struct i386_fp_save sc_fpsave;
00088     struct i386_fp_regs sc_fpregs;
00089     int sc_fpexcsr;         /* FPSR including exception bits.  */
00090   };
00091 
00092 /* Traditional BSD names for some members.  */
00093 #define sc_sp sc_uesp              /* Stack pointer.  */
00094 #define sc_fp sc_ebp        /* Frame pointer.  */
00095 #define sc_pc sc_eip        /* Process counter.  */
00096 #define sc_ps sc_efl
00097 
00098 
00099 /* Codes for SIGFPE.  */
00100 #define FPE_INTOVF_TRAP            0x1 /* integer overflow */
00101 #define FPE_INTDIV_FAULT    0x2 /* integer divide by zero */
00102 #define FPE_FLTOVF_FAULT    0x3 /* floating overflow */
00103 #define FPE_FLTDIV_FAULT    0x4 /* floating divide by zero */
00104 #define FPE_FLTUND_FAULT    0x5 /* floating underflow */
00105 #define FPE_SUBRNG_FAULT    0x7 /* BOUNDS instruction failed */
00106 #define FPE_FLTDNR_FAULT    0x8 /* denormalized operand */
00107 #define FPE_FLTINX_FAULT    0x9 /* floating loss of precision */
00108 #define FPE_EMERR_FAULT            0xa /* mysterious emulation error 33 */
00109 #define FPE_EMBND_FAULT            0xb /* emulation BOUNDS instruction failed */
00110 
00111 /* Codes for SIGILL.  */
00112 #define ILL_INVOPR_FAULT    0x1 /* invalid operation */
00113 #define ILL_STACK_FAULT            0x2 /* fault on microkernel stack access */
00114 #define ILL_FPEOPR_FAULT    0x3 /* invalid floating operation */
00115 
00116 /* Codes for SIGTRAP.  */
00117 #define DBG_SINGLE_TRAP            0x1 /* single step */
00118 #define DBG_BRKPNT_FAULT    0x2 /* breakpoint instruction */
00119 
00120 #endif /* sc_pc */