10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #ifndef _IA32_SYS_PRIVREGS_H
28 #define _IA32_SYS_PRIVREGS_H
29
30 #pragma ident "%Z%%M% %I% %E% SMI"
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 /*
37 * This file describes the cpu's privileged register set, and
38 * how the machine state is saved on the stack when a trap occurs.
39 */
40
41 #if !defined(__i386)
42 #error "non-i386 code depends on i386 privileged header!"
43 #endif
44
45 #ifndef _ASM
46
47 /*
48 * This is NOT the structure to use for general purpose debugging;
49 * see /proc for that. This is NOT the structure to use to decode
50 * the ucontext or grovel about in a core file; see <sys/regset.h>.
51 */
73 greg_t r_trapno;
74 greg_t r_err;
75 greg_t r_eip;
76 greg_t r_cs;
77 greg_t r_efl;
78 greg_t r_uesp;
79 greg_t r_ss;
80 };
81
82 #define r_r0 r_eax /* r0 for portability */
83 #define r_r1 r_edx /* r1 for portability */
84 #define r_fp r_ebp /* system frame pointer */
85 #define r_sp r_uesp /* user stack pointer */
86 #define r_pc r_eip /* user's instruction pointer */
87 #define r_ps r_efl /* user's EFLAGS */
88
89 #define GREG_NUM 8 /* Number of regs between %edi and %eax */
90
91 #ifdef _KERNEL
92 #define lwptoregs(lwp) ((struct regs *)((lwp)->lwp_regs))
93 #endif /* _KERNEL */
94
95 #else /* !_ASM */
96
97 #if defined(_MACHDEP)
98
99 #include <sys/machprivregs.h>
100
101 /*
102 * Save current frame on the stack. Uses %eax.
103 */
104 #define __FRAME_PUSH \
105 subl $8, %esp; \
106 movl REGOFF_EIP(%esp), %eax; \
107 movl %eax, REGOFF_SAVPC(%esp); \
108 movl %ebp, REGOFF_SAVFP(%esp);
109
110 /*
111 * Save segment registers on the stack.
112 */
|
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #ifndef _IA32_SYS_PRIVREGS_H
28 #define _IA32_SYS_PRIVREGS_H
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 /*
35 * This file describes the cpu's privileged register set, and
36 * how the machine state is saved on the stack when a trap occurs.
37 */
38
39 #if !defined(__i386)
40 #error "non-i386 code depends on i386 privileged header!"
41 #endif
42
43 #ifndef _ASM
44
45 /*
46 * This is NOT the structure to use for general purpose debugging;
47 * see /proc for that. This is NOT the structure to use to decode
48 * the ucontext or grovel about in a core file; see <sys/regset.h>.
49 */
71 greg_t r_trapno;
72 greg_t r_err;
73 greg_t r_eip;
74 greg_t r_cs;
75 greg_t r_efl;
76 greg_t r_uesp;
77 greg_t r_ss;
78 };
79
80 #define r_r0 r_eax /* r0 for portability */
81 #define r_r1 r_edx /* r1 for portability */
82 #define r_fp r_ebp /* system frame pointer */
83 #define r_sp r_uesp /* user stack pointer */
84 #define r_pc r_eip /* user's instruction pointer */
85 #define r_ps r_efl /* user's EFLAGS */
86
87 #define GREG_NUM 8 /* Number of regs between %edi and %eax */
88
89 #ifdef _KERNEL
90 #define lwptoregs(lwp) ((struct regs *)((lwp)->lwp_regs))
91 #define lwptofpu(lwp) ((kfpu_t *)((lwp)->lwp_fpu))
92 #endif /* _KERNEL */
93
94 #else /* !_ASM */
95
96 #if defined(_MACHDEP)
97
98 #include <sys/machprivregs.h>
99
100 /*
101 * Save current frame on the stack. Uses %eax.
102 */
103 #define __FRAME_PUSH \
104 subl $8, %esp; \
105 movl REGOFF_EIP(%esp), %eax; \
106 movl %eax, REGOFF_SAVPC(%esp); \
107 movl %ebp, REGOFF_SAVFP(%esp);
108
109 /*
110 * Save segment registers on the stack.
111 */
|