]> git.saurik.com Git - apple/xnu.git/blame - osfmk/i386/genassym.c
xnu-4570.41.2.tar.gz
[apple/xnu.git] / osfmk / i386 / genassym.c
CommitLineData
1c79356b 1/*
39236c6e 2 * Copyright (c) 2000-2012 Apple Inc. All rights reserved.
1c79356b 3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
1c79356b 5 *
2d21ac55
A
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
8f6c56a5 14 *
2d21ac55
A
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
8f6c56a5 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b
A
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31/*
32 * Mach Operating System
33 * Copyright (c) 1991,1990 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56
5ba3f43e
A
57#include <stddef.h>
58
1c79356b 59#include <mach_ldebug.h>
1c79356b
A
60
61/*
62 * Pass field offsets to assembly code.
63 */
64#include <kern/ast.h>
65#include <kern/thread.h>
66#include <kern/task.h>
91447636 67#include <kern/locks.h>
0c530ab8
A
68#include <kern/host.h>
69#include <kern/misc_protos.h>
1c79356b
A
70#include <ipc/ipc_space.h>
71#include <ipc/ipc_port.h>
72#include <ipc/ipc_pset.h>
0c530ab8 73#include <vm/vm_map.h>
1c79356b 74#include <i386/pmap.h>
b0d623f7
A
75#include <i386/Diagnostics.h>
76#include <i386/mp_desc.h>
77#include <i386/seg.h>
78#include <i386/thread.h>
79#include <i386/cpu_data.h>
1c79356b 80#include <i386/tss.h>
91447636 81#include <i386/cpu_capabilities.h>
0c530ab8 82#include <i386/cpuid.h>
0c530ab8 83#include <i386/pmCPU.h>
0c530ab8
A
84#include <mach/i386/vm_param.h>
85#include <mach/i386/thread_status.h>
91447636 86#include <machine/commpage.h>
91447636 87#include <pexpert/i386/boot.h>
1c79356b 88
2d21ac55
A
89#if CONFIG_DTRACE
90#define NEED_DTRACE_DEFS
91#include <../bsd/sys/lockstat.h>
92#endif
93
1c79356b
A
94/*
95 * genassym.c is used to produce an
96 * assembly file which, intermingled with unuseful assembly code,
97 * has all the necessary definitions emitted. This assembly file is
98 * then postprocessed with sed to extract only these definitions
99 * and thus the final assyms.s is created.
100 *
101 * This convoluted means is necessary since the structure alignment
102 * and packing may be different between the host machine and the
103 * target so we are forced into using the cross compiler to generate
104 * the values, but we cannot run anything on the target machine.
105 */
106
1c79356b 107#define DECLARE(SYM,VAL) \
3e170ce0 108 __asm("DEFINITION__define__" SYM ":\t .ascii \"%0\"" : : "n" ((u_int)(VAL)))
1c79356b
A
109
110int main(
111 int argc,
112 char ** argv);
113
114int
115main(
116 int argc,
117 char **argv)
118{
119
120 DECLARE("AST_URGENT", AST_URGENT);
2d21ac55 121 DECLARE("AST_BSD", AST_BSD);
1c79356b 122
6d2010ae
A
123 DECLARE("MAX_CPUS", MAX_CPUS);
124
55e303ae 125 /* Simple Lock structure */
fe8ab488 126 DECLARE("SLOCK_ILK", offsetof(usimple_lock_data_t, interlock));
55e303ae 127#if MACH_LDEBUG
fe8ab488
A
128 DECLARE("SLOCK_TYPE", offsetof(usimple_lock_data_t, lock_type));
129 DECLARE("SLOCK_PC", offsetof(usimple_lock_data_t, debug.lock_pc));
130 DECLARE("SLOCK_THREAD", offsetof(usimple_lock_data_t, debug.lock_thread));
131 DECLARE("SLOCK_DURATIONH",offsetof(usimple_lock_data_t, debug.duration[0]));
132 DECLARE("SLOCK_DURATIONL",offsetof(usimple_lock_data_t, debug.duration[1]));
55e303ae
A
133 DECLARE("USLOCK_TAG", USLOCK_TAG);
134#endif /* MACH_LDEBUG */
135
136 /* Mutex structure */
fe8ab488
A
137 DECLARE("MUTEX_OWNER", offsetof(lck_mtx_t, lck_mtx_owner));
138 DECLARE("MUTEX_PTR", offsetof(lck_mtx_t, lck_mtx_ptr));
139 DECLARE("MUTEX_STATE", offsetof(lck_mtx_t, lck_mtx_state));
91447636 140 DECLARE("MUTEX_IND", LCK_MTX_TAG_INDIRECT);
2d21ac55
A
141 DECLARE("MUTEX_ASSERT_OWNED", LCK_MTX_ASSERT_OWNED);
142 DECLARE("MUTEX_ASSERT_NOTOWNED",LCK_MTX_ASSERT_NOTOWNED);
fe8ab488
A
143 DECLARE("GRP_MTX_STAT_UTIL", offsetof(lck_grp_t, lck_grp_stat.lck_grp_mtx_stat.lck_grp_mtx_util_cnt));
144 DECLARE("GRP_MTX_STAT_MISS", offsetof(lck_grp_t, lck_grp_stat.lck_grp_mtx_stat.lck_grp_mtx_miss_cnt));
145 DECLARE("GRP_MTX_STAT_WAIT", offsetof(lck_grp_t, lck_grp_stat.lck_grp_mtx_stat.lck_grp_mtx_wait_cnt));
b0d623f7
A
146
147 /* x86 only */
148 DECLARE("MUTEX_DESTROYED", LCK_MTX_TAG_DESTROYED);
149
2d21ac55 150 /* Per-mutex statistic element */
fe8ab488 151 DECLARE("MTX_ACQ_TSC", offsetof(lck_mtx_ext_t, lck_mtx_stat));
2d21ac55
A
152
153 /* Mutex group statistics elements */
fe8ab488 154 DECLARE("MUTEX_GRP", offsetof(lck_mtx_ext_t, lck_mtx_grp));
2d21ac55 155
2d21ac55
A
156 /*
157 * The use of this field is somewhat at variance with the alias.
158 */
fe8ab488 159 DECLARE("GRP_MTX_STAT_DIRECT_WAIT", offsetof(lck_grp_t, lck_grp_stat.lck_grp_mtx_stat.lck_grp_mtx_held_cnt));
2d21ac55 160
fe8ab488 161 DECLARE("GRP_MTX_STAT_HELD_MAX", offsetof(lck_grp_t, lck_grp_stat.lck_grp_mtx_stat.lck_grp_mtx_held_max));
2d21ac55
A
162 /* Reader writer lock types */
163 DECLARE("RW_SHARED", LCK_RW_TYPE_SHARED);
164 DECLARE("RW_EXCL", LCK_RW_TYPE_EXCLUSIVE);
91447636 165
fe8ab488
A
166 DECLARE("TH_RECOVER", offsetof(struct thread, recover));
167 DECLARE("TH_CONTINUATION", offsetof(struct thread, continuation));
168 DECLARE("TH_KERNEL_STACK", offsetof(struct thread, kernel_stack));
169 DECLARE("TH_MUTEX_COUNT", offsetof(struct thread, mutex_count));
170 DECLARE("TH_WAS_PROMOTED_ON_WAKEUP", offsetof(struct thread, was_promoted_on_wakeup));
171 DECLARE("TH_IOTIER_OVERRIDE", offsetof(struct thread, iotier_override));
1c79356b 172
fe8ab488
A
173 DECLARE("TH_SYSCALLS_MACH", offsetof(struct thread, syscalls_mach));
174 DECLARE("TH_SYSCALLS_UNIX", offsetof(struct thread, syscalls_unix));
1c79356b 175
fe8ab488 176 DECLARE("TASK_VTIMERS", offsetof(struct task, vtimers));
2d21ac55 177
1c79356b 178 /* These fields are being added on demand */
fe8ab488
A
179 DECLARE("TH_TASK", offsetof(struct thread, task));
180 DECLARE("TH_AST", offsetof(struct thread, ast));
181 DECLARE("TH_MAP", offsetof(struct thread, map));
182 DECLARE("TH_SPF", offsetof(struct thread, machine.specFlags));
183 DECLARE("TH_PCB_ISS", offsetof(struct thread, machine.iss));
184 DECLARE("TH_PCB_IDS", offsetof(struct thread, machine.ids));
185 DECLARE("TH_PCB_FPS", offsetof(struct thread, machine.ifps));
b0d623f7 186#if NCOPY_WINDOWS > 0
fe8ab488 187 DECLARE("TH_COPYIO_STATE", offsetof(struct thread, machine.copyio_state));
0c530ab8 188 DECLARE("WINDOWS_CLEAN", WINDOWS_CLEAN);
b0d623f7 189#endif
fe8ab488 190 DECLARE("TH_RWLOCK_COUNT", offsetof(struct thread, rwlock_count));
1c79356b 191
fe8ab488 192 DECLARE("MAP_PMAP", offsetof(struct _vm_map, pmap));
1c79356b 193
b0d623f7 194#define IEL_SIZE (sizeof(struct i386_exception_link *))
5ba3f43e 195 DECLARE("IKS_SIZE", sizeof(struct thread_kernel_state));
1c79356b 196
b0d623f7
A
197 /*
198 * KSS_* are offsets from the top of the kernel stack (cpu_kernel_stack)
199 */
5ba3f43e
A
200 DECLARE("KSS_RBX", offsetof(struct thread_kernel_state, machine.k_rbx));
201 DECLARE("KSS_RSP", offsetof(struct thread_kernel_state, machine.k_rsp));
202 DECLARE("KSS_RBP", offsetof(struct thread_kernel_state, machine.k_rbp));
203 DECLARE("KSS_R12", offsetof(struct thread_kernel_state, machine.k_r12));
204 DECLARE("KSS_R13", offsetof(struct thread_kernel_state, machine.k_r13));
205 DECLARE("KSS_R14", offsetof(struct thread_kernel_state, machine.k_r14));
206 DECLARE("KSS_R15", offsetof(struct thread_kernel_state, machine.k_r15));
207 DECLARE("KSS_RIP", offsetof(struct thread_kernel_state, machine.k_rip));
b0d623f7 208
fe8ab488
A
209 DECLARE("DS_DR0", offsetof(struct x86_debug_state32, dr0));
210 DECLARE("DS_DR1", offsetof(struct x86_debug_state32, dr1));
211 DECLARE("DS_DR2", offsetof(struct x86_debug_state32, dr2));
212 DECLARE("DS_DR3", offsetof(struct x86_debug_state32, dr3));
213 DECLARE("DS_DR4", offsetof(struct x86_debug_state32, dr4));
214 DECLARE("DS_DR5", offsetof(struct x86_debug_state32, dr5));
215 DECLARE("DS_DR6", offsetof(struct x86_debug_state32, dr6));
216 DECLARE("DS_DR7", offsetof(struct x86_debug_state32, dr7));
217
218 DECLARE("DS64_DR0", offsetof(struct x86_debug_state64, dr0));
219 DECLARE("DS64_DR1", offsetof(struct x86_debug_state64, dr1));
220 DECLARE("DS64_DR2", offsetof(struct x86_debug_state64, dr2));
221 DECLARE("DS64_DR3", offsetof(struct x86_debug_state64, dr3));
222 DECLARE("DS64_DR4", offsetof(struct x86_debug_state64, dr4));
223 DECLARE("DS64_DR5", offsetof(struct x86_debug_state64, dr5));
224 DECLARE("DS64_DR6", offsetof(struct x86_debug_state64, dr6));
225 DECLARE("DS64_DR7", offsetof(struct x86_debug_state64, dr7));
226
227 DECLARE("FP_VALID", offsetof(struct x86_fx_thread_state,fp_valid));
228
229 DECLARE("SS_FLAVOR", offsetof(x86_saved_state_t, flavor));
0c530ab8
A
230 DECLARE("SS_32", x86_SAVED_STATE32);
231 DECLARE("SS_64", x86_SAVED_STATE64);
232
fe8ab488 233#define R_(x) offsetof(x86_saved_state_t, ss_32.x)
b0d623f7
A
234 DECLARE("R32_CS", R_(cs));
235 DECLARE("R32_SS", R_(ss));
236 DECLARE("R32_DS", R_(ds));
237 DECLARE("R32_ES", R_(es));
238 DECLARE("R32_FS", R_(fs));
239 DECLARE("R32_GS", R_(gs));
240 DECLARE("R32_UESP", R_(uesp));
241 DECLARE("R32_EBP", R_(ebp));
242 DECLARE("R32_EAX", R_(eax));
243 DECLARE("R32_EBX", R_(ebx));
244 DECLARE("R32_ECX", R_(ecx));
245 DECLARE("R32_EDX", R_(edx));
246 DECLARE("R32_ESI", R_(esi));
247 DECLARE("R32_EDI", R_(edi));
248 DECLARE("R32_TRAPNO", R_(trapno));
249 DECLARE("R32_ERR", R_(err));
250 DECLARE("R32_EFLAGS", R_(efl));
251 DECLARE("R32_EIP", R_(eip));
252 DECLARE("R32_CR2", R_(cr2));
0c530ab8
A
253 DECLARE("ISS32_SIZE", sizeof (x86_saved_state32_t));
254
fe8ab488 255#define R64_(x) offsetof(x86_saved_state_t, ss_64.x)
0c530ab8
A
256 DECLARE("R64_FS", R64_(fs));
257 DECLARE("R64_GS", R64_(gs));
258 DECLARE("R64_R8", R64_(r8));
259 DECLARE("R64_R9", R64_(r9));
260 DECLARE("R64_R10", R64_(r10));
261 DECLARE("R64_R11", R64_(r11));
262 DECLARE("R64_R12", R64_(r12));
263 DECLARE("R64_R13", R64_(r13));
264 DECLARE("R64_R14", R64_(r14));
265 DECLARE("R64_R15", R64_(r15));
266 DECLARE("R64_RBP", R64_(rbp));
267 DECLARE("R64_RAX", R64_(rax));
268 DECLARE("R64_RBX", R64_(rbx));
269 DECLARE("R64_RCX", R64_(rcx));
270 DECLARE("R64_RDX", R64_(rdx));
271 DECLARE("R64_RSI", R64_(rsi));
272 DECLARE("R64_RDI", R64_(rdi));
0c530ab8
A
273 DECLARE("R64_CS", R64_(isf.cs));
274 DECLARE("R64_SS", R64_(isf.ss));
275 DECLARE("R64_RSP", R64_(isf.rsp));
276 DECLARE("R64_TRAPNO", R64_(isf.trapno));
277 DECLARE("R64_TRAPFN", R64_(isf.trapfn));
278 DECLARE("R64_ERR", R64_(isf.err));
279 DECLARE("R64_RFLAGS", R64_(isf.rflags));
280 DECLARE("R64_RIP", R64_(isf.rip));
281 DECLARE("R64_CR2", R64_(cr2));
282 DECLARE("ISS64_OFFSET", R64_(isf));
283 DECLARE("ISS64_SIZE", sizeof (x86_saved_state64_t));
284
fe8ab488 285#define ISF64_(x) offsetof(x86_64_intr_stack_frame_t, x)
0c530ab8
A
286 DECLARE("ISF64_TRAPNO", ISF64_(trapno));
287 DECLARE("ISF64_TRAPFN", ISF64_(trapfn));
288 DECLARE("ISF64_ERR", ISF64_(err));
289 DECLARE("ISF64_RIP", ISF64_(rip));
290 DECLARE("ISF64_CS", ISF64_(cs));
291 DECLARE("ISF64_RFLAGS", ISF64_(rflags));
292 DECLARE("ISF64_RSP", ISF64_(rsp));
293 DECLARE("ISF64_SS", ISF64_(ss));
294 DECLARE("ISF64_SIZE", sizeof(x86_64_intr_stack_frame_t));
295
1c79356b 296 DECLARE("NBPG", I386_PGBYTES);
91447636
A
297 DECLARE("PAGE_SIZE", I386_PGBYTES);
298 DECLARE("PAGE_MASK", I386_PGBYTES-1);
299 DECLARE("PAGE_SHIFT", 12);
300 DECLARE("NKPT", NKPT);
1c79356b
A
301 DECLARE("VM_MIN_ADDRESS", VM_MIN_ADDRESS);
302 DECLARE("VM_MAX_ADDRESS", VM_MAX_ADDRESS);
303 DECLARE("KERNELBASE", VM_MIN_KERNEL_ADDRESS);
304 DECLARE("LINEAR_KERNELBASE", LINEAR_KERNEL_ADDRESS);
305 DECLARE("KERNEL_STACK_SIZE", KERNEL_STACK_SIZE);
306
b0d623f7
A
307 DECLARE("ASM_COMM_PAGE32_BASE_ADDRESS", _COMM_PAGE32_BASE_ADDRESS);
308 DECLARE("ASM_COMM_PAGE32_START_ADDRESS", _COMM_PAGE32_START_ADDRESS);
309 DECLARE("ASM_COMM_PAGE_SCHED_GEN", _COMM_PAGE_SCHED_GEN);
91447636 310
3e170ce0 311 DECLARE("KERNEL_PML4_INDEX", KERNEL_PML4_INDEX);
1c79356b
A
312 DECLARE("IDTSZ", IDTSZ);
313 DECLARE("GDTSZ", GDTSZ);
1c79356b 314
1c79356b
A
315 DECLARE("KERNEL_DS", KERNEL_DS);
316 DECLARE("USER_CS", USER_CS);
317 DECLARE("USER_DS", USER_DS);
5c9f4661 318 DECLARE("USER_CTHREAD", USER_CTHREAD);
b0d623f7 319 DECLARE("KERNEL32_CS", KERNEL32_CS);
0c530ab8
A
320 DECLARE("KERNEL64_CS", KERNEL64_CS);
321 DECLARE("USER64_CS", USER64_CS);
1c79356b
A
322 DECLARE("KERNEL_TSS", KERNEL_TSS);
323 DECLARE("KERNEL_LDT", KERNEL_LDT);
0c530ab8
A
324 DECLARE("SYSENTER_CS", SYSENTER_CS);
325 DECLARE("SYSENTER_TF_CS",SYSENTER_TF_CS);
326 DECLARE("SYSENTER_DS", SYSENTER_DS);
327 DECLARE("SYSCALL_CS", SYSCALL_CS);
91447636
A
328
329 DECLARE("CPU_THIS",
fe8ab488 330 offsetof(cpu_data_t, cpu_this));
91447636 331 DECLARE("CPU_ACTIVE_THREAD",
fe8ab488 332 offsetof(cpu_data_t, cpu_active_thread));
91447636 333 DECLARE("CPU_ACTIVE_STACK",
fe8ab488 334 offsetof(cpu_data_t, cpu_active_stack));
91447636 335 DECLARE("CPU_KERNEL_STACK",
fe8ab488 336 offsetof(cpu_data_t, cpu_kernel_stack));
91447636 337 DECLARE("CPU_INT_STACK_TOP",
fe8ab488 338 offsetof(cpu_data_t, cpu_int_stack_top));
91447636 339 DECLARE("CPU_PREEMPTION_LEVEL",
fe8ab488 340 offsetof(cpu_data_t, cpu_preemption_level));
b0d623f7 341 DECLARE("CPU_HIBERNATE",
fe8ab488 342 offsetof(cpu_data_t, cpu_hibernate));
91447636 343 DECLARE("CPU_INTERRUPT_LEVEL",
fe8ab488 344 offsetof(cpu_data_t, cpu_interrupt_level));
060df5ea 345 DECLARE("CPU_NESTED_ISTACK",
fe8ab488 346 offsetof(cpu_data_t, cpu_nested_istack));
91447636 347 DECLARE("CPU_NUMBER_GS",
fe8ab488 348 offsetof(cpu_data_t,cpu_number));
91447636 349 DECLARE("CPU_RUNNING",
fe8ab488 350 offsetof(cpu_data_t,cpu_running));
91447636 351 DECLARE("CPU_PENDING_AST",
fe8ab488 352 offsetof(cpu_data_t,cpu_pending_ast));
91447636 353 DECLARE("CPU_PROCESSOR",
fe8ab488 354 offsetof(cpu_data_t,cpu_processor));
0c530ab8 355 DECLARE("CPU_INT_STATE",
fe8ab488 356 offsetof(cpu_data_t, cpu_int_state));
2d21ac55 357 DECLARE("CPU_INT_EVENT_TIME",
fe8ab488 358 offsetof(cpu_data_t, cpu_int_event_time));
0c530ab8 359
0c530ab8 360 DECLARE("CPU_TASK_CR3",
fe8ab488 361 offsetof(cpu_data_t, cpu_task_cr3));
0c530ab8 362 DECLARE("CPU_ACTIVE_CR3",
fe8ab488 363 offsetof(cpu_data_t, cpu_active_cr3));
0c530ab8 364 DECLARE("CPU_KERNEL_CR3",
fe8ab488 365 offsetof(cpu_data_t, cpu_kernel_cr3));
5c9f4661
A
366 DECLARE("CPU_UCR3",
367 offsetof(cpu_data_t, cpu_ucr3));
368#if DEBUG
369 DECLARE("CPU_ENTRY_CR3",
370 offsetof(cpu_data_t, cpu_entry_cr3));
371 DECLARE("CPU_EXIT_CR3",
372 offsetof(cpu_data_t, cpu_exit_cr3));
373#endif
39236c6e 374 DECLARE("CPU_TLB_INVALID",
fe8ab488 375 offsetof(cpu_data_t, cpu_tlb_invalid));
39037602
A
376 DECLARE("CPU_PAGEZERO_MAPPED",
377 offsetof(cpu_data_t, cpu_pagezero_mapped));
0c530ab8 378
0c530ab8 379 DECLARE("CPU_TASK_MAP",
fe8ab488 380 offsetof(cpu_data_t, cpu_task_map));
0c530ab8 381 DECLARE("TASK_MAP_32BIT", TASK_MAP_32BIT);
b0d623f7 382 DECLARE("TASK_MAP_64BIT", TASK_MAP_64BIT);
0c530ab8 383 DECLARE("CPU_UBER_USER_GS_BASE",
fe8ab488 384 offsetof(cpu_data_t, cpu_uber.cu_user_gs_base));
0c530ab8 385 DECLARE("CPU_UBER_ISF",
fe8ab488 386 offsetof(cpu_data_t, cpu_uber.cu_isf));
0c530ab8 387 DECLARE("CPU_UBER_TMP",
fe8ab488 388 offsetof(cpu_data_t, cpu_uber.cu_tmp));
2d21ac55 389
593a1d5f 390 DECLARE("CPU_NANOTIME",
fe8ab488 391 offsetof(cpu_data_t, cpu_nanotime));
593a1d5f 392
0c530ab8 393 DECLARE("CPU_DR7",
fe8ab488 394 offsetof(cpu_data_t, cpu_dr7));
0c530ab8 395
fe8ab488 396 DECLARE("hwIntCnt", offsetof(cpu_data_t,cpu_hwIntCnt));
6d2010ae 397 DECLARE("CPU_ACTIVE_PCID",
fe8ab488 398 offsetof(cpu_data_t, cpu_active_pcid));
39037602
A
399 DECLARE("CPU_KERNEL_PCID",
400 offsetof(cpu_data_t, cpu_kernel_pcid));
401
6d2010ae 402 DECLARE("CPU_PCID_COHERENTP",
fe8ab488 403 offsetof(cpu_data_t, cpu_pmap_pcid_coherentp));
6d2010ae 404 DECLARE("CPU_PCID_COHERENTP_KERNEL",
fe8ab488 405 offsetof(cpu_data_t, cpu_pmap_pcid_coherentp_kernel));
6d2010ae 406 DECLARE("CPU_PMAP_PCID_ENABLED",
fe8ab488 407 offsetof(cpu_data_t, cpu_pmap_pcid_enabled));
6d2010ae
A
408
409#ifdef PCID_STATS
410 DECLARE("CPU_PMAP_USER_RETS",
fe8ab488 411 offsetof(cpu_data_t, cpu_pmap_user_rets));
6d2010ae 412 DECLARE("CPU_PMAP_PCID_PRESERVES",
fe8ab488 413 offsetof(cpu_data_t, cpu_pmap_pcid_preserves));
6d2010ae 414 DECLARE("CPU_PMAP_PCID_FLUSHES",
fe8ab488 415 offsetof(cpu_data_t, cpu_pmap_pcid_flushes));
6d2010ae 416#endif
6d2010ae 417 DECLARE("CPU_TLB_INVALID_LOCAL",
fe8ab488 418 offsetof(cpu_data_t, cpu_tlb_invalid_local));
6d2010ae 419 DECLARE("CPU_TLB_INVALID_GLOBAL",
fe8ab488 420 offsetof(cpu_data_t, cpu_tlb_invalid_global));
5c9f4661
A
421 DECLARE("CPU_ESTACK",
422 offsetof(cpu_data_t, cd_estack));
423 DECLARE("CPU_DSHADOW",
424 offsetof(cpu_data_t, cd_shadow));
425
0c530ab8 426 DECLARE("enaExpTrace", enaExpTrace);
0c530ab8 427 DECLARE("enaUsrFCall", enaUsrFCall);
0c530ab8 428 DECLARE("enaUsrPhyMp", enaUsrPhyMp);
0c530ab8 429 DECLARE("enaDiagSCs", enaDiagSCs);
0c530ab8 430 DECLARE("enaDiagEM", enaDiagEM);
0c530ab8 431 DECLARE("enaNotifyEM", enaNotifyEM);
fe8ab488
A
432 DECLARE("dgLock", offsetof(struct diagWork, dgLock));
433 DECLARE("dgFlags", offsetof(struct diagWork, dgFlags));
434 DECLARE("dgMisc1", offsetof(struct diagWork, dgMisc1));
435 DECLARE("dgMisc2", offsetof(struct diagWork, dgMisc2));
436 DECLARE("dgMisc3", offsetof(struct diagWork, dgMisc3));
437 DECLARE("dgMisc4", offsetof(struct diagWork, dgMisc4));
438 DECLARE("dgMisc5", offsetof(struct diagWork, dgMisc5));
91447636 439
fe8ab488
A
440 DECLARE("TSS_ESP0", offsetof(struct i386_tss, esp0));
441 DECLARE("TSS_SS0", offsetof(struct i386_tss, ss0));
442 DECLARE("TSS_LDT", offsetof(struct i386_tss, ldt));
443 DECLARE("TSS_PDBR", offsetof(struct i386_tss, cr3));
444 DECLARE("TSS_LINK", offsetof(struct i386_tss, back_link));
1c79356b
A
445
446 DECLARE("K_TASK_GATE", ACC_P|ACC_PL_K|ACC_TASK_GATE);
447 DECLARE("K_TRAP_GATE", ACC_P|ACC_PL_K|ACC_TRAP_GATE);
448 DECLARE("U_TRAP_GATE", ACC_P|ACC_PL_U|ACC_TRAP_GATE);
449 DECLARE("K_INTR_GATE", ACC_P|ACC_PL_K|ACC_INTR_GATE);
0c530ab8 450 DECLARE("U_INTR_GATE", ACC_P|ACC_PL_U|ACC_INTR_GATE);
1c79356b
A
451 DECLARE("K_TSS", ACC_P|ACC_PL_K|ACC_TSS);
452
453 /*
454 * usimple_lock fields
455 */
fe8ab488 456 DECLARE("USL_INTERLOCK", offsetof(usimple_lock_data_t, interlock));
1c79356b
A
457
458 DECLARE("INTSTACK_SIZE", INTSTACK_SIZE);
fe8ab488
A
459 DECLARE("KADDR", offsetof(struct boot_args, kaddr));
460 DECLARE("KSIZE", offsetof(struct boot_args, ksize));
461 DECLARE("MEMORYMAP", offsetof(struct boot_args, MemoryMap));
462 DECLARE("DEVICETREEP", offsetof(struct boot_args, deviceTreeP));
0c530ab8
A
463
464 DECLARE("RNT_TSC_BASE",
fe8ab488 465 offsetof(pal_rtc_nanotime_t, tsc_base));
0c530ab8 466 DECLARE("RNT_NS_BASE",
fe8ab488 467 offsetof(pal_rtc_nanotime_t, ns_base));
0c530ab8 468 DECLARE("RNT_SCALE",
fe8ab488 469 offsetof(pal_rtc_nanotime_t, scale));
0c530ab8 470 DECLARE("RNT_SHIFT",
fe8ab488 471 offsetof(pal_rtc_nanotime_t, shift));
2d21ac55 472 DECLARE("RNT_GENERATION",
fe8ab488 473 offsetof(pal_rtc_nanotime_t, generation));
91447636
A
474
475 /* values from kern/timer.h */
b0d623f7 476#ifdef __LP64__
fe8ab488 477 DECLARE("TIMER_ALL", offsetof(struct timer, all_bits));
b0d623f7 478#else
fe8ab488
A
479 DECLARE("TIMER_LOW", offsetof(struct timer, low_bits));
480 DECLARE("TIMER_HIGH", offsetof(struct timer, high_bits));
481 DECLARE("TIMER_HIGHCHK", offsetof(struct timer, high_bits_check));
b0d623f7 482#endif
91447636 483 DECLARE("TIMER_TSTAMP",
fe8ab488 484 offsetof(struct timer, tstamp));
91447636 485
2d21ac55 486 DECLARE("THREAD_TIMER",
fe8ab488 487 offsetof(struct processor, processor_data.thread_timer));
2d21ac55 488 DECLARE("KERNEL_TIMER",
fe8ab488 489 offsetof(struct processor, processor_data.kernel_timer));
91447636 490 DECLARE("SYSTEM_TIMER",
fe8ab488 491 offsetof(struct thread, system_timer));
91447636 492 DECLARE("USER_TIMER",
fe8ab488 493 offsetof(struct thread, user_timer));
2d21ac55 494 DECLARE("SYSTEM_STATE",
fe8ab488 495 offsetof(struct processor, processor_data.system_state));
2d21ac55 496 DECLARE("USER_STATE",
fe8ab488 497 offsetof(struct processor, processor_data.user_state));
2d21ac55 498 DECLARE("IDLE_STATE",
fe8ab488 499 offsetof(struct processor, processor_data.idle_state));
2d21ac55 500 DECLARE("CURRENT_STATE",
fe8ab488 501 offsetof(struct processor, processor_data.current_state));
1c79356b 502
0c530ab8
A
503 DECLARE("OnProc", OnProc);
504
b0d623f7 505
2d21ac55
A
506#if CONFIG_DTRACE
507 DECLARE("LS_LCK_MTX_LOCK_ACQUIRE", LS_LCK_MTX_LOCK_ACQUIRE);
508 DECLARE("LS_LCK_MTX_TRY_SPIN_LOCK_ACQUIRE", LS_LCK_MTX_TRY_SPIN_LOCK_ACQUIRE);
509 DECLARE("LS_LCK_MTX_UNLOCK_RELEASE", LS_LCK_MTX_UNLOCK_RELEASE);
510 DECLARE("LS_LCK_MTX_TRY_LOCK_ACQUIRE", LS_LCK_MTX_TRY_LOCK_ACQUIRE);
511 DECLARE("LS_LCK_RW_LOCK_SHARED_ACQUIRE", LS_LCK_RW_LOCK_SHARED_ACQUIRE);
512 DECLARE("LS_LCK_RW_DONE_RELEASE", LS_LCK_RW_DONE_RELEASE);
513 DECLARE("LS_LCK_MTX_EXT_LOCK_ACQUIRE", LS_LCK_MTX_EXT_LOCK_ACQUIRE);
514 DECLARE("LS_LCK_MTX_TRY_EXT_LOCK_ACQUIRE", LS_LCK_MTX_TRY_EXT_LOCK_ACQUIRE);
515 DECLARE("LS_LCK_MTX_EXT_UNLOCK_RELEASE", LS_LCK_MTX_EXT_UNLOCK_RELEASE);
b0d623f7
A
516 DECLARE("LS_LCK_RW_LOCK_EXCL_ACQUIRE", LS_LCK_RW_LOCK_EXCL_ACQUIRE);
517 DECLARE("LS_LCK_RW_LOCK_SHARED_TO_EXCL_UPGRADE", LS_LCK_RW_LOCK_SHARED_TO_EXCL_UPGRADE);
518 DECLARE("LS_LCK_RW_TRY_LOCK_EXCL_ACQUIRE", LS_LCK_RW_TRY_LOCK_EXCL_ACQUIRE);
519 DECLARE("LS_LCK_RW_TRY_LOCK_SHARED_ACQUIRE", LS_LCK_RW_TRY_LOCK_SHARED_ACQUIRE);
520 DECLARE("LS_LCK_MTX_LOCK_SPIN_ACQUIRE", LS_LCK_MTX_LOCK_SPIN_ACQUIRE);
2d21ac55
A
521#endif
522
1c79356b
A
523 return (0);
524}