|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /*
26: * Copyright (c) 1992 NeXT Computer, Inc.
27: *
28: * Intel386 Family: External thread state.
29: *
30: * HISTORY
31: *
32: * 5 April 1992 ? at NeXT
33: * Created.
34: */
35:
36: #import <architecture/i386/frame.h>
37: #import <architecture/i386/fpu.h>
38:
39: /*
40: * Main thread state consists of
41: * general registers, segment registers,
42: * eip and eflags.
43: */
44:
45: #define i386_THREAD_STATE -1
46:
47: typedef struct {
48: unsigned int eax;
49: unsigned int ebx;
50: unsigned int ecx;
51: unsigned int edx;
52: unsigned int edi;
53: unsigned int esi;
54: unsigned int ebp;
55: unsigned int esp;
56: unsigned int ss;
57: unsigned int eflags;
58: unsigned int eip;
59: unsigned int cs;
60: unsigned int ds;
61: unsigned int es;
62: unsigned int fs;
63: unsigned int gs;
64: } i386_thread_state_t;
65:
66: #define i386_THREAD_STATE_COUNT \
67: ( sizeof (i386_thread_state_t) / sizeof (int) )
68:
69: /*
70: * Default segment register values.
71: */
72:
73: #define USER_CODE_SELECTOR 0x000f
74: #define USER_DATA_SELECTOR 0x0017
75: #define KERN_CODE_SELECTOR 0x0008
76: #define KERN_DATA_SELECTOR 0x0010
77:
78: /*
79: * Thread floating point state
80: * includes FPU environment as
81: * well as the register stack.
82: */
83:
84: #define i386_THREAD_FPSTATE -2
85:
86: typedef struct {
87: fp_env_t environ;
88: fp_stack_t stack;
89: } i386_thread_fpstate_t;
90:
91: #define i386_THREAD_FPSTATE_COUNT \
92: ( sizeof (i386_thread_fpstate_t) / sizeof (int) )
93:
94: /*
95: * Extra state that may be
96: * useful to exception handlers.
97: */
98:
99: #define i386_THREAD_EXCEPTSTATE -3
100:
101: typedef struct {
102: unsigned int trapno;
103: err_code_t err;
104: } i386_thread_exceptstate_t;
105:
106: #define i386_THREAD_EXCEPTSTATE_COUNT \
107: ( sizeof (i386_thread_exceptstate_t) / sizeof (int) )
108:
109: /*
110: * Per-thread variable used
111: * to store 'self' id for cthreads.
112: */
113:
114: #define i386_THREAD_CTHREADSTATE -4
115:
116: typedef struct {
117: unsigned int self;
118: } i386_thread_cthreadstate_t;
119:
120: #define i386_THREAD_CTHREADSTATE_COUNT \
121: ( sizeof (i386_thread_cthreadstate_t) / sizeof (int) )
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.