182a9fd6aSFrançois Revol/*
2173f54f1SMatt Madia * Copyright 2002-2012 Haiku, Inc. All Rights Reserved.
382a9fd6aSFrançois Revol * Distributed under the terms of the MIT License.
482a9fd6aSFrançois Revol */
582a9fd6aSFrançois Revol#ifndef _ARCH_SIGNAL_H_
682a9fd6aSFrançois Revol#define _ARCH_SIGNAL_H_
782a9fd6aSFrançois Revol
80fae8733SScott McCreary
982a9fd6aSFrançois Revol/*
1082a9fd6aSFrançois Revol * Architecture-specific structure passed to signal handlers
1182a9fd6aSFrançois Revol */
1282a9fd6aSFrançois Revol
135ffbe7d7SAugustin Cavalier#if __i386__
1482a9fd6aSFrançois Revol
1582a9fd6aSFrançois Revoltypedef struct packed_fp_stack {
1682a9fd6aSFrançois Revol	unsigned char	st0[10];
1782a9fd6aSFrançois Revol	unsigned char	st1[10];
1882a9fd6aSFrançois Revol	unsigned char	st2[10];
1982a9fd6aSFrançois Revol	unsigned char	st3[10];
2082a9fd6aSFrançois Revol	unsigned char	st4[10];
2182a9fd6aSFrançois Revol	unsigned char	st5[10];
2282a9fd6aSFrançois Revol	unsigned char	st6[10];
2382a9fd6aSFrançois Revol	unsigned char	st7[10];
2482a9fd6aSFrançois Revol} packed_fp_stack;
2582a9fd6aSFrançois Revol
2682a9fd6aSFrançois Revoltypedef struct packed_mmx_regs {
2782a9fd6aSFrançois Revol	unsigned char	mm0[10];
2882a9fd6aSFrançois Revol	unsigned char	mm1[10];
2982a9fd6aSFrançois Revol	unsigned char	mm2[10];
3082a9fd6aSFrançois Revol	unsigned char	mm3[10];
3182a9fd6aSFrançois Revol	unsigned char	mm4[10];
3282a9fd6aSFrançois Revol	unsigned char	mm5[10];
3382a9fd6aSFrançois Revol	unsigned char	mm6[10];
3482a9fd6aSFrançois Revol	unsigned char	mm7[10];
3582a9fd6aSFrançois Revol} packed_mmx_regs;
3682a9fd6aSFrançois Revol
3782a9fd6aSFrançois Revoltypedef struct old_extended_regs {
3882a9fd6aSFrançois Revol	unsigned short	fp_control;
3982a9fd6aSFrançois Revol	unsigned short	_reserved1;
4082a9fd6aSFrançois Revol	unsigned short	fp_status;
4182a9fd6aSFrançois Revol	unsigned short	_reserved2;
4282a9fd6aSFrançois Revol	unsigned short	fp_tag;
4382a9fd6aSFrançois Revol	unsigned short	_reserved3;
4482a9fd6aSFrançois Revol	unsigned long	fp_eip;
4582a9fd6aSFrançois Revol	unsigned short	fp_cs;
4682a9fd6aSFrançois Revol	unsigned short	fp_opcode;
4782a9fd6aSFrançois Revol	unsigned long	fp_datap;
4882a9fd6aSFrançois Revol	unsigned short	fp_ds;
4982a9fd6aSFrançois Revol	unsigned short	_reserved4;
5082a9fd6aSFrançois Revol	union {
5182a9fd6aSFrançois Revol		packed_fp_stack	fp;
5282a9fd6aSFrançois Revol		packed_mmx_regs	mmx;
5382a9fd6aSFrançois Revol	} fp_mmx;
5482a9fd6aSFrançois Revol} old_extended_regs;
5582a9fd6aSFrançois Revol
5682a9fd6aSFrançois Revoltypedef struct fp_stack {
5782a9fd6aSFrançois Revol	unsigned char	st0[10];
5882a9fd6aSFrançois Revol	unsigned char	_reserved_42_47[6];
5982a9fd6aSFrançois Revol	unsigned char	st1[10];
6082a9fd6aSFrançois Revol	unsigned char	_reserved_58_63[6];
6182a9fd6aSFrançois Revol	unsigned char	st2[10];
6282a9fd6aSFrançois Revol	unsigned char	_reserved_74_79[6];
6382a9fd6aSFrançois Revol	unsigned char	st3[10];
6482a9fd6aSFrançois Revol	unsigned char	_reserved_90_95[6];
6582a9fd6aSFrançois Revol	unsigned char	st4[10];
6682a9fd6aSFrançois Revol	unsigned char	_reserved_106_111[6];
6782a9fd6aSFrançois Revol	unsigned char	st5[10];
6882a9fd6aSFrançois Revol	unsigned char	_reserved_122_127[6];
6982a9fd6aSFrançois Revol	unsigned char	st6[10];
7082a9fd6aSFrançois Revol	unsigned char	_reserved_138_143[6];
7182a9fd6aSFrançois Revol	unsigned char	st7[10];
7282a9fd6aSFrançois Revol	unsigned char	_reserved_154_159[6];
7382a9fd6aSFrançois Revol} fp_stack;
7482a9fd6aSFrançois Revol
7582a9fd6aSFrançois Revoltypedef struct mmx_regs {
7682a9fd6aSFrançois Revol	unsigned char	mm0[10];
7782a9fd6aSFrançois Revol	unsigned char	_reserved_42_47[6];
7882a9fd6aSFrançois Revol	unsigned char	mm1[10];
7982a9fd6aSFrançois Revol	unsigned char	_reserved_58_63[6];
8082a9fd6aSFrançois Revol	unsigned char	mm2[10];
8182a9fd6aSFrançois Revol	unsigned char	_reserved_74_79[6];
8282a9fd6aSFrançois Revol	unsigned char	mm3[10];
8382a9fd6aSFrançois Revol	unsigned char	_reserved_90_95[6];
8482a9fd6aSFrançois Revol	unsigned char	mm4[10];
8582a9fd6aSFrançois Revol	unsigned char	_reserved_106_111[6];
8682a9fd6aSFrançois Revol	unsigned char	mm5[10];
8782a9fd6aSFrançois Revol	unsigned char	_reserved_122_127[6];
8882a9fd6aSFrançois Revol	unsigned char	mm6[10];
8982a9fd6aSFrançois Revol	unsigned char	_reserved_138_143[6];
9082a9fd6aSFrançois Revol	unsigned char	mm7[10];
9182a9fd6aSFrançois Revol	unsigned char	_reserved_154_159[6];
9282a9fd6aSFrançois Revol} mmx_regs;
9324df6592SIngo Weinhold
9482a9fd6aSFrançois Revoltypedef struct xmmx_regs {
9582a9fd6aSFrançois Revol	unsigned char	xmm0[16];
9682a9fd6aSFrançois Revol	unsigned char	xmm1[16];
9782a9fd6aSFrançois Revol	unsigned char	xmm2[16];
9882a9fd6aSFrançois Revol	unsigned char	xmm3[16];
9982a9fd6aSFrançois Revol	unsigned char	xmm4[16];
10082a9fd6aSFrançois Revol	unsigned char	xmm5[16];
10182a9fd6aSFrançois Revol	unsigned char	xmm6[16];
10282a9fd6aSFrançois Revol	unsigned char	xmm7[16];
10382a9fd6aSFrançois Revol} xmmx_regs;
10482a9fd6aSFrançois Revol
10582a9fd6aSFrançois Revoltypedef struct new_extended_regs {
10682a9fd6aSFrançois Revol	unsigned short	fp_control;
10782a9fd6aSFrançois Revol	unsigned short	fp_status;
10824df6592SIngo Weinhold	unsigned short	fp_tag;
10982a9fd6aSFrançois Revol	unsigned short	fp_opcode;
11082a9fd6aSFrançois Revol	unsigned long	fp_eip;
11182a9fd6aSFrançois Revol	unsigned short	fp_cs;
11282a9fd6aSFrançois Revol	unsigned short	res_14_15;
11382a9fd6aSFrançois Revol	unsigned long	fp_datap;
11482a9fd6aSFrançois Revol	unsigned short	fp_ds;
11582a9fd6aSFrançois Revol	unsigned short	_reserved_22_23;
11682a9fd6aSFrançois Revol	unsigned long	mxcsr;
11782a9fd6aSFrançois Revol	unsigned long	_reserved_28_31;
11882a9fd6aSFrançois Revol	union {
11982a9fd6aSFrançois Revol		fp_stack fp;
12082a9fd6aSFrançois Revol		mmx_regs mmx;
12182a9fd6aSFrançois Revol	} fp_mmx;
12282a9fd6aSFrançois Revol	xmmx_regs xmmx;
12382a9fd6aSFrançois Revol	unsigned char	_reserved_288_511[224];
12482a9fd6aSFrançois Revol} new_extended_regs;
12582a9fd6aSFrançois Revol
12682a9fd6aSFrançois Revoltypedef struct extended_regs {
12782a9fd6aSFrançois Revol	union {
12882a9fd6aSFrançois Revol		old_extended_regs	old_format;
12982a9fd6aSFrançois Revol		new_extended_regs	new_format;
13082a9fd6aSFrançois Revol	} state;
13124df6592SIngo Weinhold	unsigned long	format;
13282a9fd6aSFrançois Revol} extended_regs;
13382a9fd6aSFrançois Revol
13482a9fd6aSFrançois Revolstruct vregs {
13582a9fd6aSFrançois Revol	unsigned long			eip;
13682a9fd6aSFrançois Revol	unsigned long			eflags;
13782a9fd6aSFrançois Revol	unsigned long			eax;
13882a9fd6aSFrançois Revol	unsigned long			ecx;
13982a9fd6aSFrançois Revol	unsigned long			edx;
14082a9fd6aSFrançois Revol	unsigned long			esp;
14182a9fd6aSFrançois Revol	unsigned long			ebp;
14282a9fd6aSFrançois Revol	unsigned long			_reserved_1;
14382a9fd6aSFrançois Revol	extended_regs	xregs;
14424df6592SIngo Weinhold	unsigned long			edi;
14524df6592SIngo Weinhold	unsigned long			esi;
14624df6592SIngo Weinhold	unsigned long			ebx;
14782a9fd6aSFrançois Revol};
14824df6592SIngo Weinhold
1495ffbe7d7SAugustin Cavalier#endif /* __i386__ */
15082a9fd6aSFrançois Revol
15182a9fd6aSFrançois Revol#endif /* _ARCH_SIGNAL_H_ */