|
|
1.1 root 1: /*
2: * Copyright (c) 1992 NeXT Computer, Inc.
3: *
4: * Intel386 Family: Processor exception frame.
5: *
6: * HISTORY
7: *
8: * 31 August 1992 David E. Bohman at NeXT
9: * Added v86 mode stuff.
10: *
11: * 8 June 1992 David E. Bohman at NeXT
12: * Changed name of write field in err_code_t
13: * which collided with write() in shlib.
14: *
15: * 30 March 1992 David E. Bohman at NeXT
16: * Created.
17: */
18:
19: /*
20: * Format of the error code
21: * generated by the hardware
22: * for certain exceptions.
23: */
24:
25: typedef union err_code {
26: struct err_code_normal {
27: unsigned int ext :1,
28: tbl :2,
29: #define ERR_GDT 0
30: #define ERR_IDT 1
31: #define ERR_LDT 2
32: index :13,
33: :16;
34: } normal;
35: struct err_code_pgfault {
36: unsigned int prot :1,
37: wrtflt :1,
38: user :1,
39: :29;
40: } pgfault;
41: } err_code_t;
42:
43: #import <architecture/i386/sel.h>
44:
45: /*
46: * The actual hardware exception frame
47: * is variable in size. An error code is
48: * only pushed for certain exceptions.
49: * Previous stack information is only
50: * pushed for exceptions that cause a
51: * change in privilege level. The dpl
52: * field of the saved CS selector can be
53: * used to determine whether this is the
54: * case. If the interrupted task was
55: * executing in v86 mode, then the data
56: * segment registers are also present in
57: * the exception frame (in addition to
58: * previous stack information). This
59: * case can be determined by examining
60: * eflags.
61: */
62:
63: typedef struct except_frame {
64: err_code_t err;
65: unsigned int eip;
66: sel_t cs;
67: unsigned int :0;
68: unsigned int eflags;
69: unsigned int esp;
70: sel_t ss;
71: unsigned int :0;
72: unsigned short v_es;
73: unsigned int :0;
74: unsigned short v_ds;
75: unsigned int :0;
76: unsigned short v_fs;
77: unsigned int :0;
78: unsigned short v_gs;
79: unsigned int :0;
80: } except_frame_t;
81:
82: /*
83: * Values in eflags.
84: */
85:
86: #define EFL_CF 0x00001
87: #define EFL_PF 0x00004
88: #define EFL_AF 0x00010
89: #define EFL_ZF 0x00040
90: #define EFL_SF 0x00080
91: #define EFL_TF 0x00100
92: #define EFL_IF 0x00200
93: #define EFL_DF 0x00400
94: #define EFL_OF 0x00800
95: #define EFL_IOPL 0x03000
96: #define EFL_NT 0x04000
97: #define EFL_RF 0x10000
98: #define EFL_VM 0x20000
99: #define EFL_AC 0x40000
100:
101: #define EFL_CLR 0xfff88028
102: #define EFL_SET 0x00000002
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.