|
|
1.1 root 1: /*
2: * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * The contents of this file constitute Original Code as defined in and
7: * are subject to the Apple Public Source License Version 1.1 (the
8: * "License"). You may not use this file except in compliance with the
9: * License. Please obtain a copy of the License at
10: * http://www.apple.com/publicsource and read it before using this file.
11: *
12: * This Original Code and all software distributed under the License are
13: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17: * License for the specific language governing rights and limitations
18: * under the License.
19: *
20: * @APPLE_LICENSE_HEADER_END@
21: */
22: /*
23: * @OSF_COPYRIGHT@
24: *
25: */
26:
27: #ifndef _PPC_THREAD_ACT_H_
28: #define _PPC_THREAD_ACT_H_
29:
30: #include <mach_kgdb.h>
31: #include <mach/boolean.h>
32: #include <mach/ppc/vm_types.h>
33: #include <mach/thread_status.h>
34: #include <kern/lock.h>
35:
36:
37: /*
38: * Kernel state structure
39: *
40: * This holds the kernel state that is saved and restored across context
41: * switches. This is kept at the top of the kernel stack.
42: *
43: * XXX Some state is saved only because it is not saved on entry to the
44: * kernel from user mode. This needs to be straightened out.
45: */
46:
47: /*
48: * PPC process control block
49: *
50: * In the continuation model, the PCB holds the user context. It is used
51: * on entry to the kernel from user mode, either by system call or trap,
52: * to store the necessary user registers and other state.
53: *
54: * Note that this structure overlays a savearea. Make sure that these
55: * guys are updated in concert with that.
56: */
57: struct pcb
58: {
59: struct ppc_saved_state ss;
60: struct ppc_exception_state es;
61: struct ppc_float_state fs;
62: unsigned int gas1[6]; /* Force alignment with savearea */
63: struct ppc_vector_state vec;
64:
65: };
66:
67: typedef struct pcb *pcb_t;
68:
69: /*
70: * Maps state flavor to number of words in the state:
71: */
72: extern unsigned int state_count[];
73:
74: #define USER_REGS(ThrAct) (&(ThrAct)->mact.pcb->ss)
75:
76: #define user_pc(ThrAct) ((ThrAct)->mact.pcb->ss.srr0)
77:
78: #define act_machine_state_ptr(ThrAct) (thread_state_t)USER_REGS(ThrAct)
79:
80: typedef struct MachineThrAct {
81: /*
82: * pointer to process control block control blocks. Potentially
83: * one for each active facility context. They may point to the
84: * same saveareas.
85: */
86: pcb_t pcb; /* The "normal" savearea */
87: pcb_t FPU_pcb; /* The floating point savearea */
88: pcb_t FPU_lvl; /* The floating point context level */
89: unsigned int FPU_cpu; /* The last processor to enable floating point */
90: pcb_t VMX_pcb; /* The VMX savearea */
91: pcb_t VMX_lvl; /* The VMX context level */
92: unsigned int VMX_cpu; /* The last processor to enable vector */
93: unsigned int ksp; /* points to TOP OF STACK or zero */
94: unsigned int bbDescAddr; /* Points to Blue Box descriptor area in kernel (page aligned) */
95: unsigned int bbUserDA; /* Points to Blue Box descriptor area in user (page aligned) */
96: unsigned int bbTableStart; /* Start of Blue Box trap table start */
97: unsigned int bbPendRupt; /* Number of pending interruptions */
98: unsigned int specFlags; /* Special flags */
99: #define ignoreZeroFault 0x80000000
100: #define floatUsed 0x40000000
101: #define vectorUsed 0x20000000
102: #ifdef MACH_BSD
103: unsigned long cthread_self; /* for use of cthread package */
104: #endif
105:
106: } MachineThrAct, *MachineThrAct_t;
107:
108: extern struct ppc_saved_state * find_user_regs(thread_act_t act);
109: extern struct ppc_float_state * find_user_fpu(thread_act_t act);
110:
111: #endif /* _PPC_THREAD_ACT_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.