|
|
1.1 root 1: /* Copyright (c) 1991 NeXT Computer, Inc. All rights reserved.
2: *
3: * File: mach/m88k/thread_status.h
4: * Author: Mike DeMoney, NeXT Computer, Inc.
5: *
6: * This include file defines the per-thread state
7: * for NeXT 88K-based products.
8: *
9: * HISTORY
10: * 23-Jan-91 Mike DeMoney ([email protected])
11: * Created.
12: *
13: * FIXME:
14: * All of these types should be pulled from architecture.
15: * Solve possible conflicting types problem for implementations
16: * by making user define an implementation (e.g. #define __M88110__)
17: * to get a implementation specific features.
18: *
19: * Put fp envelope stuff in mach/m88k/m88110_fpee.h.
20: */
21:
22: #ifndef _MACH_M88K_THREAD_STATE_
23: #define _MACH_M88K_THREAD_STATE_
24:
25: #import <architecture/m88k/fp_regs.h>
26: #import <architecture/m88k/reg_help.h>
27:
28: /**************************************************************************
29: * Data Typedefs used by thread_getstatus() and thread_setstatus() *
30: * NOTE: FP control and status regs described in <mach/m88k/fp_regs.h> *
31: **************************************************************************/
32:
33: #define M88K_THREAD_STATE_GRF (1) // general registers
34: #define M88K_THREAD_STATE_XRF (2) // extended and fp registers
35: #define M88K_THREAD_STATE_USER (3) // non-architectural user state
36: #define M88110_THREAD_STATE_IMPL (4) // 88110 impl specific
37:
38: #define M88K_THREAD_STATE_MAXFLAVOR (M88110_THREAD_STATE_IMPL)
39:
40: /*
41: * m88k_thread_state_grf -- basic thread state for NeXT 88K-based products
42: */
43: typedef struct _m88k_thread_state_grf {
44: unsigned r1; // rpc: return pc, caller-saved
45: unsigned r2; // a0: argument 0, caller-saved
46: unsigned r3; // a1
47: unsigned r4; // a2
48: unsigned r5; // a3
49: unsigned r6; // a4
50: unsigned r7; // a5
51: unsigned r8; // a6
52: unsigned r9; // a7
53: unsigned r10; // t0: temporary, caller-saved
54: unsigned r11; // t1
55: unsigned r12; // t2: struct return ptr,
56: unsigned r13; // t3
57: unsigned r14; // s0: saved, callee-saved
58: unsigned r15; // s1
59: unsigned r16; // s2
60: unsigned r17; // s3
61: unsigned r18; // s4
62: unsigned r19; // s5
63: unsigned r20; // s6
64: unsigned r21; // s7
65: unsigned r22; // s8
66: unsigned r23; // s9
67: unsigned r24; // s10
68: unsigned r25; // s11
69: unsigned r26; // t4
70: unsigned r27; // at: temp, used by asm macros
71: unsigned r28; // lk0: reserved for link editor
72: unsigned r29; // lk1
73: unsigned r30; // fp: frame ptr, callee-saved
74: unsigned r31; // sp: stack ptr, callee-saved
75: unsigned xip; // executing instruction pointer
76: unsigned xip_in_bd; // non-zero => xip in branch delay slot
77: /*
78: * nip is only valid if xip_in_bd is TRUE
79: */
80: unsigned nip; // next instruction pointer
81: } m88k_thread_state_grf_t;
82:
83: #define M88K_THREAD_STATE_GRF_COUNT \
84: (sizeof(m88k_thread_state_grf_t)/sizeof(int))
85:
86: /*
87: * m88k_thread_state_xrf -- extended register file contents and floating point
88: * control registers for NeXT 88K-based products.
89: */
90: typedef struct _m88k_thread_state_xrf {
91: m88k_xrf_t x1; // caller-saved
92: m88k_xrf_t x2;
93: m88k_xrf_t x3;
94: m88k_xrf_t x4;
95: m88k_xrf_t x5;
96: m88k_xrf_t x6;
97: m88k_xrf_t x7;
98: m88k_xrf_t x8;
99: m88k_xrf_t x9;
100: m88k_xrf_t x10;
101: m88k_xrf_t x11;
102: m88k_xrf_t x12;
103: m88k_xrf_t x13;
104: m88k_xrf_t x14;
105: m88k_xrf_t x15;
106: m88k_xrf_t x16;
107: m88k_xrf_t x17;
108: m88k_xrf_t x18;
109: m88k_xrf_t x19;
110: m88k_xrf_t x20;
111: m88k_xrf_t x21;
112: m88k_xrf_t x22; // callee-saved
113: m88k_xrf_t x23;
114: m88k_xrf_t x24;
115: m88k_xrf_t x25;
116: m88k_xrf_t x26;
117: m88k_xrf_t x27;
118: m88k_xrf_t x28;
119: m88k_xrf_t x29;
120: m88k_xrf_t x30; // reserved
121: m88k_xrf_t x31;
122: m88k_fpsr_t fpsr; // fp status, fcr62
123: m88k_fpcr_t fpcr; // fp control, fcr63
124: } m88k_thread_state_xrf_t;
125:
126: #define M88K_THREAD_STATE_XRF_COUNT \
127: (sizeof(m88k_thread_state_xrf_t)/sizeof(int))
128:
129: typedef struct _m88k_thread_state_user {
130: int user; // user register (for cthreads)
131: } m88k_thread_state_user_t;
132:
133: #define M88K_THREAD_STATE_USER_COUNT \
134: (sizeof(m88k_thread_state_user_t)/sizeof(int))
135:
136: /*
137: * Motorola 88110 specific state
138: * (Can't count on this being in all m88k implementations.)
139: */
140:
141: #define M88110_N_DATA_BP 2 // 88110 supports 2 data bp's
142:
143: /*
144: * Data Breakpoint Address Match Mask -- actually indicates don't
145: * care bits in addr
146: */
147: typedef enum {
148: M88110_MATCH_BYTE = 0,
149: M88110_MATCH_SHORT = 0x1,
150: M88110_MATCH_WORD = 0x3,
151: M88110_MATCH_DOUBLE = 0x7,
152: M88110_MATCH_QUAD = 0xf,
153: M88110_MATCH_32 = 0x1f,
154: M88110_MATCH_64 = 0x3f,
155: M88110_MATCH_128 = 0x7f,
156: M88110_MATCH_256 = 0xff,
157: M88110_MATCH_512 = 0x1ff,
158: M88110_MATCH_1024 = 0x3ff,
159: M88110_MATCH_2048 = 0x7ff,
160: M88110_MATCH_4096 = 0xfff
161: } m88110_match_t;
162:
163: /*
164: * Data Breakpoint Control Word
165: */
166: typedef struct {
167: unsigned :BITS_WIDTH(31,29);
168: unsigned rw:BIT_WIDTH(28); // 1 => read access
169: unsigned rwm:BIT_WIDTH(27); // 0 => rw is don't care
170: unsigned :BITS_WIDTH(26,13);
171: m88110_match_t addr_match:BITS_WIDTH(12,1); // addr(12,1) don't cares
172: unsigned v:BIT_WIDTH(0);
173: } m88110_bp_ctrl_t;
174:
175: /*
176: * A complete Data Breakpoint spec
177: */
178: typedef struct {
179: unsigned addr; // data address
180: m88110_bp_ctrl_t ctrl;
181: } m88110_data_bp_t;
182:
183: /*
184: * m88110_psr_t -- 88110 Processor Status Register
185: * System prohibits modification of supr, le, se, sgn_imd, sm and mxm_dis
186: * bits for user threads.
187: */
188: typedef struct {
189: unsigned supr:BIT_WIDTH(31);
190: unsigned le:BIT_WIDTH(30); // little endian mode
191: unsigned se:BIT_WIDTH(29); // serial exec mode
192: unsigned c:BIT_WIDTH(28); // carry
193: unsigned :BIT_WIDTH(27);
194: unsigned sgn_imd:BIT_WIDTH(26); // signed immediates
195: unsigned sm:BIT_WIDTH(25); // serialize mem refs
196: unsigned :BIT_WIDTH(24);
197: unsigned trace:BIT_WIDTH(23);
198: unsigned :BITS_WIDTH(22,5);
199: unsigned sfu2dis:BIT_WIDTH(4); // gpu (sfu2) disable
200: unsigned sfu1dis:BIT_WIDTH(3); // fpu (sfu1) disable
201: unsigned mxm_dis:BIT_WIDTH(2); // misaligned dis
202: unsigned :BITS_WIDTH(1,0);
203: } m88110_psr_t;
204:
205: /*
206: * Information for IEEE floating point user trap handlers
207: */
208: typedef enum {
209: M88110_IRESULT_SIZE_NONE = 0, // no intermediate result
210: M88110_IRESULT_SIZE_SINGLE = 1, // single precision result
211: M88110_IRESULT_SIZE_DOUBLE = 2, // double precision result
212: M88110_IRESULT_SIZE_EXTENDED = 3, // double extended result
213: } m88110_iresult_size_t;
214:
215: typedef struct {
216: unsigned :BITS_WIDTH(31,16); // unused
217: m88110_iresult_size_t iresult_size:BITS_WIDTH(15,14);
218: // size of iresult
219: unsigned :BITS_WIDTH(13,9); // unused
220: unsigned sfu1_disabled:BIT_WIDTH(8); // sfu disabled
221: unsigned int:BIT_WIDTH(7); // invalid int conv
222: unsigned unimp:BIT_WIDTH(6); // unimp ctrl reg
223: unsigned priv:BIT_WIDTH(5); // priv violation
224: unsigned efinv:BIT_WIDTH(4); // IEEE EFINV
225: unsigned efdvz:BIT_WIDTH(3); // IEEE EFDVZ
226: unsigned efunf:BIT_WIDTH(2); // IEEE EFUNF
227: unsigned efovf:BIT_WIDTH(1); // IEEE EFOVF
228: unsigned efinx:BIT_WIDTH(0); // IEEE EFINX
229: } m88110_fp_trap_status_t;
230:
231: /*
232: * m88110_thread_state_impl -- 88110 implementation-specific
233: * control registers for NeXT 88K-based products.
234: */
235: typedef struct _m88110_thread_state_impl {
236: m88110_data_bp_t data_bp[M88110_N_DATA_BP];
237:
238: /*
239: * Certain of the 88110 psr bits may be modified
240: */
241: m88110_psr_t psr; // processor status
242: /*
243: * IEEE floating point user trap information. Read only.
244: * (Only valid immediately after an EXC_ARITHMETIC
245: * exception with code EXC_M88K_SFU1_EXCP. Trap
246: * handlers must determine operation, source and
247: * destination registers by fetching instruction at
248: * exip.)
249: */
250: m88k_xrf_t intermediate_result;
251: m88110_fp_trap_status_t fp_trap_status;
252: } m88110_thread_state_impl_t;
253:
254: #define M88110_THREAD_STATE_IMPL_COUNT \
255: (sizeof(m88110_thread_state_impl_t)/sizeof(int))
256:
257: #endif _MACH_M88K_THREAD_STATE_
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.