Chameleon

Chameleon Svn Source Tree

Root/branches/Chimera/i386/include/architecture/i386/frame.h

1/*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24 * Copyright (c) 1992 NeXT Computer, Inc.
25 *
26 * Intel386 Family:Processor exception frame.
27 *
28 * HISTORY
29 *
30 * 31 August 1992 ? at NeXT
31 *Added v86 mode stuff.
32 *
33 * 8 June 1992 ? at NeXT
34 *Changed name of write field in err_code_t
35 *which collided with write() in shlib.
36 *
37 * 30 March 1992 ? at NeXT
38 *Created.
39 */
40
41#ifndef _ARCH_I386_FRAME_H_
42#define _ARCH_I386_FRAME_H_
43
44/*
45 * Format of the error code
46 * generated by the hardware
47 * for certain exceptions.
48 */
49
50typedef union err_code {
51 struct err_code_normal {
52unsigned intext:1,
53tbl:2,
54#define ERR_GDT0
55#define ERR_IDT1
56#define ERR_LDT2
57index:13,
58:16;
59 } normal;
60 struct err_code_pgfault {
61unsigned intprot:1,
62wrtflt:1,
63user:1,
64:29;
65 } pgfault;
66} err_code_t;
67
68#include <architecture/i386/sel.h>
69
70/*
71 * The actual hardware exception frame
72 * is variable in size. An error code is
73 * only pushed for certain exceptions.
74 * Previous stack information is only
75 * pushed for exceptions that cause a
76 * change in privilege level. The dpl
77 * field of the saved CS selector can be
78 * used to determine whether this is the
79 * case. If the interrupted task was
80 * executing in v86 mode, then the data
81 * segment registers are also present in
82 * the exception frame (in addition to
83 * previous stack information). This
84 * case can be determined by examining
85 * eflags.
86 */
87
88typedef struct except_frame {
89 err_code_terr;
90 unsigned inteip;
91 sel_tcs;
92 unsigned int:0;
93 unsigned inteflags;
94 unsigned intesp;
95 sel_tss;
96 unsigned int:0;
97 unsigned shortv_es;
98 unsigned int:0;
99 unsigned shortv_ds;
100 unsigned int:0;
101 unsigned shortv_fs;
102 unsigned int:0;
103 unsigned shortv_gs;
104 unsigned int:0;
105} except_frame_t;
106
107/*
108 * Values in eflags.
109 */
110
111#define EFL_CF0x00001
112#define EFL_PF0x00004
113#define EFL_AF0x00010
114#define EFL_ZF0x00040
115#define EFL_SF0x00080
116#define EFL_TF0x00100
117#define EFL_IF0x00200
118#define EFL_DF0x00400
119#define EFL_OF0x00800
120#define EFL_IOPL0x03000
121#define EFL_NT0x04000
122#define EFL_RF0x10000
123#define EFL_VM0x20000
124#define EFL_AC0x40000
125
126#define EFL_CLR0xfff88028
127#define EFL_SET0x00000002
128
129#endif/* _ARCH_I386_FRAME_H_ */
130

Archive Download this file

Revision: 2225