]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/mach/hurd/i386/bits/sigcontext.h
Update copyright dates with scripts/update-copyrights
[thirdparty/glibc.git] / sysdeps / mach / hurd / i386 / bits / sigcontext.h
CommitLineData
28f540f4 1/* Machine-dependent signal context structure for GNU Hurd. i386 version.
6d7e8eda 2 Copyright (C) 1991-2023 Free Software Foundation, Inc.
478b92f0 3 This file is part of the GNU C Library.
28f540f4 4
478b92f0 5 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
28f540f4 9
478b92f0
UD
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 13 Lesser General Public License for more details.
28f540f4 14
41bdb6e2 15 You should have received a copy of the GNU Lesser General Public
59ba27a6 16 License along with the GNU C Library; if not, see
5a82c748 17 <https://www.gnu.org/licenses/>. */
28f540f4 18
c66b29f9
ZW
19#ifndef _BITS_SIGCONTEXT_H
20#define _BITS_SIGCONTEXT_H 1
21
f58f41f1 22#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
f4017d20
UD
23# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
24#endif
25
28f540f4
RM
26/* Signal handlers are actually called:
27 void handler (int sig, int code, struct sigcontext *scp); */
28
a992f506 29#include <bits/types/__sigset_t.h>
28f540f4
RM
30#include <mach/machine/fp_reg.h>
31
32/* State of this thread when the signal was taken. */
33struct sigcontext
34 {
35 /* These first members are machine-independent. */
36
37 int sc_onstack; /* Nonzero if running on sigstack. */
38 __sigset_t sc_mask; /* Blocked signals to restore. */
39
40 /* MiG reply port this thread is using. */
41 unsigned int sc_reply_port;
42
43 /* Port this thread is doing an interruptible RPC on. */
44 unsigned int sc_intr_port;
45
46 /* Error code associated with this signal (interpreted as `error_t'). */
47 int sc_error;
48
49 /* All following members are machine-dependent. The rest of this
50 structure is written to be laid out identically to:
51 {
478b92f0
UD
52 struct i386_thread_state basic;
53 struct i386_float_state fpu;
28f540f4
RM
54 }
55 trampoline.c knows this, so it must be changed if this changes. */
56
57#define sc_i386_thread_state sc_gs /* Beginning of correspondence. */
58 /* Segment registers. */
59 int sc_gs;
60 int sc_fs;
61 int sc_es;
62 int sc_ds;
478b92f0 63
28f540f4
RM
64 /* "General" registers. These members are in the order that the i386
65 `pusha' and `popa' instructions use (`popa' ignores %esp). */
66 int sc_edi;
67 int sc_esi;
68 int sc_ebp;
69 int sc_esp; /* Not used; sc_uesp is used instead. */
70 int sc_ebx;
71 int sc_edx;
72 int sc_ecx;
73 int sc_eax;
478b92f0 74
28f540f4
RM
75 int sc_eip; /* Instruction pointer. */
76 int sc_cs; /* Code segment register. */
478b92f0 77
28f540f4
RM
78 int sc_efl; /* Processor flags. */
79
80 int sc_uesp; /* This stack pointer is used. */
81 int sc_ss; /* Stack segment register. */
82
83 /* Following mimics struct i386_float_state. Structures and symbolic
84 values can be found in <mach/i386/fp_reg.h>. */
85#define sc_i386_float_state sc_fpkind
86 int sc_fpkind; /* FP_NO, FP_387, etc. */
87 int sc_fpused; /* If zero, ignore rest of float state. */
88 struct i386_fp_save sc_fpsave;
89 struct i386_fp_regs sc_fpregs;
90 int sc_fpexcsr; /* FPSR including exception bits. */
91 };
92
0cdd0c51
MK
93/* Traditional BSD names for some members. */
94#define sc_sp sc_uesp /* Stack pointer. */
95#define sc_fp sc_ebp /* Frame pointer. */
96#define sc_pc sc_eip /* Process counter. */
97#define sc_ps sc_efl
98
28f540f4 99
d865ff74
JK
100/* The deprecated sigcode values below are passed as an extra, non-portable
101 argument to regular signal handlers. You should use SA_SIGINFO handlers
102 instead, which use the standard POSIX signal codes. */
103
28f540f4
RM
104/* Codes for SIGFPE. */
105#define FPE_INTOVF_TRAP 0x1 /* integer overflow */
106#define FPE_INTDIV_FAULT 0x2 /* integer divide by zero */
107#define FPE_FLTOVF_FAULT 0x3 /* floating overflow */
108#define FPE_FLTDIV_FAULT 0x4 /* floating divide by zero */
109#define FPE_FLTUND_FAULT 0x5 /* floating underflow */
110#define FPE_SUBRNG_FAULT 0x7 /* BOUNDS instruction failed */
111#define FPE_FLTDNR_FAULT 0x8 /* denormalized operand */
112#define FPE_FLTINX_FAULT 0x9 /* floating loss of precision */
113#define FPE_EMERR_FAULT 0xa /* mysterious emulation error 33 */
114#define FPE_EMBND_FAULT 0xb /* emulation BOUNDS instruction failed */
115
116/* Codes for SIGILL. */
117#define ILL_INVOPR_FAULT 0x1 /* invalid operation */
118#define ILL_STACK_FAULT 0x2 /* fault on microkernel stack access */
119#define ILL_FPEOPR_FAULT 0x3 /* invalid floating operation */
120
121/* Codes for SIGTRAP. */
122#define DBG_SINGLE_TRAP 0x1 /* single step */
123#define DBG_BRKPNT_FAULT 0x2 /* breakpoint instruction */
f58f41f1 124
c66b29f9 125#endif /* bits/sigcontext.h */