]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - sys/compat/ia32/ia32_reg.h
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / sys / compat / ia32 / ia32_reg.h
1 /*-
2  * Copyright (c) 1990 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * William Jolitz.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 4. Neither the name of the University nor the names of its contributors
17  *    may be used to endorse or promote products derived from this software
18  *    without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30  * SUCH DAMAGE.
31  *
32  *      from: @(#)reg.h 5.5 (Berkeley) 1/18/91
33  * $FreeBSD$
34  */
35
36 #ifndef _COMPAT_IA32_IA32_REG_H_
37 #define _COMPAT_IA32_IA32_REG_H_
38
39 /*
40  * Register set accessible via /proc/$pid/regs and PT_{SET,GET}REGS.
41  */
42 struct reg32 {
43         unsigned int    r_fs;
44         unsigned int    r_es;
45         unsigned int    r_ds;
46         unsigned int    r_edi;
47         unsigned int    r_esi;
48         unsigned int    r_ebp;
49         unsigned int    r_isp;
50         unsigned int    r_ebx;
51         unsigned int    r_edx;
52         unsigned int    r_ecx;
53         unsigned int    r_eax;
54         unsigned int    r_trapno;
55         unsigned int    r_err;
56         unsigned int    r_eip;
57         unsigned int    r_cs;
58         unsigned int    r_eflags;
59         unsigned int    r_esp;
60         unsigned int    r_ss;
61         unsigned int    r_gs;
62 };
63
64 /*
65  * Register set accessible via /proc/$pid/fpregs.
66  */
67 struct fpreg32 {
68         unsigned int    fpr_env[7];
69         unsigned char   fpr_acc[8][10];
70         unsigned int    fpr_ex_sw;
71         unsigned char   fpr_pad[64];
72 };
73
74 /*
75  * Register set accessible via /proc/$pid/dbregs.
76  */
77 struct dbreg32 {
78         unsigned int  dr[8];    /* debug registers */
79 };
80
81 /* Environment information of floating point unit */
82 struct env87 {
83         int     en_cw;          /* control word (16bits) */
84         int     en_sw;          /* status word (16bits) */
85         int     en_tw;          /* tag word (16bits) */
86         int     en_fip;         /* floating point instruction pointer */
87         u_short en_fcs;         /* floating code segment selector */
88         u_short en_opcode;      /* opcode last executed (11 bits ) */
89         int     en_foo;         /* floating operand offset */
90         int     en_fos;         /* floating operand segment selector */
91 };
92
93 #ifdef __ia64__
94 /* Layout of an x87 fpu register (amd64 gets this elsewhere) */
95 struct fpacc87 {
96         u_char  fp_bytes[10];
97 };
98 #endif
99
100 /* Floating point context */
101 struct save87 {
102         struct  env87 sv_env;   /* floating point control/status */
103         struct  fpacc87 sv_ac[8];       /* accumulator contents, 0-7 */
104         u_char  sv_pad0[4];     /* padding for (now unused) saved status word */
105         u_char  sv_pad[64];     /* padding; used by emulators */
106 };
107
108 /*
109  * Wrappers and converters.
110  */
111 int     fill_regs32(struct thread *, struct reg32 *);
112 int     set_regs32(struct thread *, struct reg32 *);
113 int     fill_fpregs32(struct thread *, struct fpreg32 *);
114 int     set_fpregs32(struct thread *, struct fpreg32 *);
115 int     fill_dbregs32(struct thread *, struct dbreg32 *);
116 int     set_dbregs32(struct thread *, struct dbreg32 *);
117
118 #endif /* !_COMPAT_IA32_IA32_REG_H_ */