]> git.saurik.com Git - apple/xnu.git/blob - osfmk/ddb/db_task_thread.h
xnu-201.tar.gz
[apple/xnu.git] / osfmk / ddb / db_task_thread.h
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 * HISTORY
27 *
28 * Revision 1.1.1.1 1998/09/22 21:05:48 wsanchez
29 * Import of Mac OS X kernel (~semeria)
30 *
31 * Revision 1.1.1.1 1998/03/07 02:26:09 wsanchez
32 * Import of OSF Mach kernel (~mburg)
33 *
34 * Revision 1.1.9.1 1994/09/23 01:22:09 ezf
35 * change marker to not FREE
36 * [1994/09/22 21:11:13 ezf]
37 *
38 * Revision 1.1.7.4 1994/03/17 22:35:38 dwm
39 * The infamous name change: thread_activation + thread_shuttle = thread.
40 * [1994/03/17 21:25:53 dwm]
41 *
42 * Revision 1.1.7.3 1994/02/03 21:44:27 bolinger
43 * Change a surviving current_thread() to current_act().
44 * [1994/02/03 20:48:03 bolinger]
45 *
46 * Revision 1.1.7.2 1994/01/12 17:50:56 dwm
47 * Coloc: initial restructuring to follow Utah model.
48 * [1994/01/12 17:13:27 dwm]
49 *
50 * Revision 1.1.7.1 1994/01/05 19:28:18 bolinger
51 * Separate notions of "address space" and "task" (i.e., symbol table),
52 * via new macros db_current_space() and db_is_current_space(); also update
53 * db_target_space() to treat kernel-loaded tasks correctly.
54 * [1994/01/04 17:41:47 bolinger]
55 *
56 * Revision 1.1.2.4 1993/07/27 18:28:17 elliston
57 * Add ANSI prototypes. CR #9523.
58 * [1993/07/27 18:13:10 elliston]
59 *
60 * Revision 1.1.2.3 1993/06/07 22:06:58 jeffc
61 * CR9176 - ANSI C violations: trailing tokens on CPP
62 * directives, extra semicolons after decl_ ..., asm keywords
63 * [1993/06/07 18:57:35 jeffc]
64 *
65 * Revision 1.1.2.2 1993/06/02 23:12:46 jeffc
66 * Added to OSF/1 R1.3 from NMK15.0.
67 * [1993/06/02 20:57:32 jeffc]
68 *
69 * Revision 1.1 1992/09/30 02:24:23 robert
70 * Initial revision
71 *
72 * $EndLog$
73 */
74 /* CMU_HIST */
75 /*
76 * Revision 2.2 91/10/09 16:03:18 af
77 * Revision 2.1.3.1 91/10/05 13:08:07 jeffreyh
78 * Created for task/thread handling.
79 * [91/08/29 tak]
80 *
81 * Revision 2.1.3.1 91/10/05 13:08:07 jeffreyh
82 * Created for task/thread handling.
83 * [91/08/29 tak]
84 *
85 */
86 /* CMU_ENDHIST */
87 /*
88 * Mach Operating System
89 * Copyright (c) 1991,1990 Carnegie Mellon University
90 * All Rights Reserved.
91 *
92 * Permission to use, copy, modify and distribute this software and its
93 * documentation is hereby granted, provided that both the copyright
94 * notice and this permission notice appear in all copies of the
95 * software, derivative works or modified versions, and any portions
96 * thereof, and that both notices appear in supporting documentation.
97 *
98 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
99 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
100 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
101 *
102 * Carnegie Mellon requests users of this software to return to
103 *
104 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
105 * School of Computer Science
106 * Carnegie Mellon University
107 * Pittsburgh PA 15213-3890
108 *
109 * any improvements or extensions that they make and grant Carnegie Mellon
110 * the rights to redistribute these changes.
111 */
112 /*
113 */
114
115 #ifndef _DDB_DB_TASK_THREAD_H_
116 #define _DDB_DB_TASK_THREAD_H_
117
118 #include <kern/task.h>
119 #include <kern/thread.h>
120 #include <kern/processor.h>
121 #include <ddb/db_variables.h> /* For db_var_aux_param_t */
122
123 /*
124 * On behalf of kernel-loaded tasks, distinguish between current task
125 * (=> symbol table) and current address space (=> where [e.g.]
126 * breakpoints are set). From ddb's perspective, kernel-loaded tasks
127 * can retain their own symbol tables, but share the kernel's address
128 * space.
129 */
130 #define db_current_task() \
131 ((current_act())? current_act()->task: TASK_NULL)
132 #define db_current_space() \
133 ((current_act() && !current_act()->kernel_loaded)?\
134 current_act()->task: TASK_NULL)
135 #define db_target_space(thr_act, user_space) \
136 ((!(user_space) || ((thr_act) && (thr_act)->kernel_loaded))?\
137 TASK_NULL: \
138 (thr_act)? \
139 (thr_act)->task: db_current_space())
140 #define db_is_current_space(task) \
141 ((task) == TASK_NULL || (task) == db_current_space())
142
143 extern task_t db_default_task; /* default target task */
144 extern thread_act_t db_default_act; /* default target thr_act */
145
146
147 /* Prototypes for functions exported by this module.
148 */
149
150 int db_lookup_act(thread_act_t target_act);
151
152 int db_lookup_task(task_t target_task);
153
154 int db_lookup_task_act(
155 task_t task,
156 thread_act_t target_act);
157
158 boolean_t db_check_act_address_valid(thread_act_t thr_act);
159
160 boolean_t db_get_next_act(
161 thread_act_t *actp,
162 int position);
163
164 void db_init_default_act(void);
165
166 int db_set_default_act(
167 struct db_variable *vp,
168 db_expr_t *valuep,
169 int flag,
170 db_var_aux_param_t ap);
171
172 int db_get_task_act(
173 struct db_variable *vp,
174 db_expr_t *valuep,
175 int flag,
176 db_var_aux_param_t ap);
177
178 #endif /* !_DDB_DB_TASK_THREAD_H_ */