source: trunk/minix/include/sys/sigcontext.h@ 19

Last change on this file since 19 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 3.6 KB
Line 
1#ifndef _SIGCONTEXT_H
2#define _SIGCONTEXT_H
3
4/* The sigcontext structure is used by the sigreturn(2) system call.
5 * sigreturn() is seldom called by user programs, but it is used internally
6 * by the signal catching mechanism.
7 */
8
9#ifndef _ANSI_H
10#include <ansi.h>
11#endif
12
13#ifndef _MINIX_SYS_CONFIG_H
14#include <minix/sys_config.h>
15#endif
16
17#if !defined(_MINIX_CHIP)
18#include "error, configuration is not known"
19#endif
20
21/* The following structure should match the stackframe_s structure used
22 * by the kernel's context switching code. Floating point registers should
23 * be added in a different struct.
24 */
25#if (_MINIX_CHIP == _CHIP_INTEL)
26struct sigregs {
27#if _WORD_SIZE == 4
28 short sr_gs;
29 short sr_fs;
30#endif /* _WORD_SIZE == 4 */
31 short sr_es;
32 short sr_ds;
33 int sr_di;
34 int sr_si;
35 int sr_bp;
36 int sr_st; /* stack top -- used in kernel */
37 int sr_bx;
38 int sr_dx;
39 int sr_cx;
40 int sr_retreg;
41 int sr_retadr; /* return address to caller of save -- used
42 * in kernel */
43 int sr_pc;
44 int sr_cs;
45 int sr_psw;
46 int sr_sp;
47 int sr_ss;
48};
49
50struct sigframe { /* stack frame created for signalled process */
51 _PROTOTYPE( void (*sf_retadr), (void) );
52 int sf_signo;
53 int sf_code;
54 struct sigcontext *sf_scp;
55 int sf_fp;
56 _PROTOTYPE( void (*sf_retadr2), (void) );
57 struct sigcontext *sf_scpcopy;
58};
59
60#else
61#if (_MINIX_CHIP == _CHIP_M68000)
62struct sigregs {
63 long sr_retreg; /* d0 */
64 long sr_d1;
65 long sr_d2;
66 long sr_d3;
67 long sr_d4;
68 long sr_d5;
69 long sr_d6;
70 long sr_d7;
71 long sr_a0;
72 long sr_a1;
73 long sr_a2;
74 long sr_a3;
75 long sr_a4;
76 long sr_a5;
77 long sr_a6;
78 long sr_sp; /* also known as a7 */
79 long sr_pc;
80 short sr_psw;
81 short sr_dummy; /* make size multiple of 4 for system.c */
82};
83#else
84#include "error, _MINIX_CHIP is not supported"
85#endif
86#endif /* _MINIX_CHIP == _CHIP_INTEL */
87
88struct sigcontext {
89 int sc_flags; /* sigstack state to restore */
90 long sc_mask; /* signal mask to restore */
91 struct sigregs sc_regs; /* register set to restore */
92};
93
94#if (_MINIX_CHIP == _CHIP_INTEL)
95#if _WORD_SIZE == 4
96#define sc_gs sc_regs.sr_gs
97#define sc_fs sc_regs.sr_fs
98#endif /* _WORD_SIZE == 4 */
99#define sc_es sc_regs.sr_es
100#define sc_ds sc_regs.sr_ds
101#define sc_di sc_regs.sr_di
102#define sc_si sc_regs.sr_si
103#define sc_fp sc_regs.sr_bp
104#define sc_st sc_regs.sr_st /* stack top -- used in kernel */
105#define sc_bx sc_regs.sr_bx
106#define sc_dx sc_regs.sr_dx
107#define sc_cx sc_regs.sr_cx
108#define sc_retreg sc_regs.sr_retreg
109#define sc_retadr sc_regs.sr_retadr /* return address to caller of
110 save -- used in kernel */
111#define sc_pc sc_regs.sr_pc
112#define sc_cs sc_regs.sr_cs
113#define sc_psw sc_regs.sr_psw
114#define sc_sp sc_regs.sr_sp
115#define sc_ss sc_regs.sr_ss
116#endif /* _MINIX_CHIP == _CHIP_INTEL */
117
118#if (_MINIX_CHIP == M68000)
119#define sc_retreg sc_regs.sr_retreg
120#define sc_d1 sc_regs.sr_d1
121#define sc_d2 sc_regs.sr_d2
122#define sc_d3 sc_regs.sr_d3
123#define sc_d4 sc_regs.sr_d4
124#define sc_d5 sc_regs.sr_d5
125#define sc_d6 sc_regs.sr_d6
126#define sc_d7 sc_regs.sr_d7
127#define sc_a0 sc_regs.sr_a0
128#define sc_a1 sc_regs.sr_a1
129#define sc_a2 sc_regs.sr_a2
130#define sc_a3 sc_regs.sr_a3
131#define sc_a4 sc_regs.sr_a4
132#define sc_a5 sc_regs.sr_a5
133#define sc_fp sc_regs.sr_a6
134#define sc_sp sc_regs.sr_sp
135#define sc_pc sc_regs.sr_pc
136#define sc_psw sc_regs.sr_psw
137#endif /* _MINIX_CHIP == M68000 */
138
139/* Values for sc_flags. Must agree with <minix/jmp_buf.h>. */
140#define SC_SIGCONTEXT 2 /* nonzero when signal context is included */
141#define SC_NOREGLOCALS 4 /* nonzero when registers are not to be
142 saved and restored */
143
144_PROTOTYPE( int sigreturn, (struct sigcontext *_scp) );
145
146#endif /* _SIGCONTEXT_H */
Note: See TracBrowser for help on using the repository browser.