]> git.saurik.com Git - apple/xnu.git/blame - osfmk/i386/genassym.c
xnu-7195.101.1.tar.gz
[apple/xnu.git] / osfmk / i386 / genassym.c
CommitLineData
1c79356b 1/*
f427ee49 2 * Copyright (c) 2000-2020 Apple Inc. All rights reserved.
1c79356b 3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
0a7de745 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.
0a7de745 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.
0a7de745 17 *
2d21ac55
A
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.
0a7de745 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b
A
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
0a7de745 31/*
1c79356b
A
32 * Mach Operating System
33 * Copyright (c) 1991,1990 Carnegie Mellon University
34 * All Rights Reserved.
0a7de745 35 *
1c79356b
A
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.
0a7de745 41 *
1c79356b
A
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.
0a7de745 45 *
1c79356b 46 * Carnegie Mellon requests users of this software to return to
0a7de745 47 *
1c79356b
A
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
0a7de745 52 *
1c79356b
A
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
A
88
89/*
90 * genassym.c is used to produce an
91 * assembly file which, intermingled with unuseful assembly code,
92 * has all the necessary definitions emitted. This assembly file is
93 * then postprocessed with sed to extract only these definitions
94 * and thus the final assyms.s is created.
95 *
96 * This convoluted means is necessary since the structure alignment
97 * and packing may be different between the host machine and the
98 * target so we are forced into using the cross compiler to generate
99 * the values, but we cannot run anything on the target machine.
100 */
101
0a7de745 102#define DECLARE(SYM, VAL) \
3e170ce0 103 __asm("DEFINITION__define__" SYM ":\t .ascii \"%0\"" : : "n" ((u_int)(VAL)))
1c79356b 104
0a7de745 105#define DECLAREULL(SYM, VAL) \
cb323159 106 __asm("DEFINITION__define__" SYM ":\t .ascii \"%0\"" : : "i" ((unsigned long long)(VAL)))
0a7de745
A
107
108int main(
109 int argc,
110 char ** argv);
1c79356b
A
111
112int
113main(
0a7de745
A
114 int argc,
115 char **argv)
1c79356b 116{
0a7de745
A
117 DECLARE("AST_URGENT", AST_URGENT);
118 DECLARE("AST_BSD", AST_BSD);
1c79356b 119
0a7de745 120 DECLARE("MAX_CPUS", MAX_CPUS);
6d2010ae 121
55e303ae 122 /* Simple Lock structure */
0a7de745
A
123 DECLARE("SLOCK_ILK", offsetof(usimple_lock_data_t, interlock));
124#if MACH_LDEBUG
125 DECLARE("SLOCK_TYPE", offsetof(usimple_lock_data_t, lock_type));
126 DECLARE("SLOCK_PC", offsetof(usimple_lock_data_t, debug.lock_pc));
127 DECLARE("SLOCK_THREAD", offsetof(usimple_lock_data_t, debug.lock_thread));
128 DECLARE("SLOCK_DURATIONH", offsetof(usimple_lock_data_t, debug.duration[0]));
129 DECLARE("SLOCK_DURATIONL", offsetof(usimple_lock_data_t, debug.duration[1]));
130 DECLARE("USLOCK_TAG", USLOCK_TAG);
131#endif /* MACH_LDEBUG */
55e303ae
A
132
133 /* Mutex structure */
fe8ab488 134 DECLARE("MUTEX_OWNER", offsetof(lck_mtx_t, lck_mtx_owner));
0a7de745 135 DECLARE("MUTEX_PTR", offsetof(lck_mtx_t, lck_mtx_ptr));
fe8ab488 136 DECLARE("MUTEX_STATE", offsetof(lck_mtx_t, lck_mtx_state));
0a7de745
A
137 DECLARE("MUTEX_IND", LCK_MTX_TAG_INDIRECT);
138 DECLARE("MUTEX_ASSERT_OWNED", LCK_MTX_ASSERT_OWNED);
139 DECLARE("MUTEX_ASSERT_NOTOWNED", LCK_MTX_ASSERT_NOTOWNED);
140
b0d623f7
A
141 /* x86 only */
142 DECLARE("MUTEX_DESTROYED", LCK_MTX_TAG_DESTROYED);
143
2d21ac55 144 /* Per-mutex statistic element */
0a7de745 145 DECLARE("MTX_ACQ_TSC", offsetof(lck_mtx_ext_t, lck_mtx_stat));
2d21ac55 146
2d21ac55 147 /* Reader writer lock types */
0a7de745
A
148 DECLARE("RW_SHARED", LCK_RW_TYPE_SHARED);
149 DECLARE("RW_EXCL", LCK_RW_TYPE_EXCLUSIVE);
91447636 150
0a7de745
A
151 DECLARE("TH_RECOVER", offsetof(struct thread, recover));
152 DECLARE("TH_CONTINUATION", offsetof(struct thread, continuation));
153 DECLARE("TH_KERNEL_STACK", offsetof(struct thread, kernel_stack));
154 DECLARE("TH_MUTEX_COUNT", offsetof(struct thread, mutex_count));
0a7de745
A
155 DECLARE("TH_IOTIER_OVERRIDE", offsetof(struct thread, iotier_override));
156
157 DECLARE("TH_SYSCALLS_MACH", offsetof(struct thread, syscalls_mach));
158 DECLARE("TH_SYSCALLS_UNIX", offsetof(struct thread, syscalls_unix));
1c79356b 159
0a7de745 160 DECLARE("TH_CTH_SELF", offsetof(struct thread, machine.cthread_self));
1c79356b 161
0a7de745 162 DECLARE("TASK_VTIMERS", offsetof(struct task, vtimers));
2d21ac55 163
1c79356b 164 /* These fields are being added on demand */
0a7de745
A
165 DECLARE("TH_TASK", offsetof(struct thread, task));
166 DECLARE("TH_AST", offsetof(struct thread, ast));
167 DECLARE("TH_MAP", offsetof(struct thread, map));
168 DECLARE("TH_SPF", offsetof(struct thread, machine.specFlags));
169 DECLARE("TH_PCB_ISS", offsetof(struct thread, machine.iss));
170 DECLARE("TH_PCB_IDS", offsetof(struct thread, machine.ids));
171 DECLARE("TH_PCB_FPS", offsetof(struct thread, machine.ifps));
0a7de745 172 DECLARE("TH_RWLOCK_COUNT", offsetof(struct thread, rwlock_count));
f427ee49 173 DECLARE("TH_TMP_ALLOC_CNT", offsetof(struct thread, t_temp_alloc_count));
1c79356b 174
0a7de745 175 DECLARE("MAP_PMAP", offsetof(struct _vm_map, pmap));
1c79356b 176
0a7de745
A
177#define IEL_SIZE (sizeof(struct i386_exception_link *))
178 DECLARE("IKS_SIZE", sizeof(struct thread_kernel_state));
1c79356b 179
b0d623f7
A
180 /*
181 * KSS_* are offsets from the top of the kernel stack (cpu_kernel_stack)
182 */
0a7de745
A
183 DECLARE("KSS_RBX", offsetof(struct thread_kernel_state, machine.k_rbx));
184 DECLARE("KSS_RSP", offsetof(struct thread_kernel_state, machine.k_rsp));
185 DECLARE("KSS_RBP", offsetof(struct thread_kernel_state, machine.k_rbp));
186 DECLARE("KSS_R12", offsetof(struct thread_kernel_state, machine.k_r12));
187 DECLARE("KSS_R13", offsetof(struct thread_kernel_state, machine.k_r13));
188 DECLARE("KSS_R14", offsetof(struct thread_kernel_state, machine.k_r14));
189 DECLARE("KSS_R15", offsetof(struct thread_kernel_state, machine.k_r15));
190 DECLARE("KSS_RIP", offsetof(struct thread_kernel_state, machine.k_rip));
191
192 DECLARE("DS_DR0", offsetof(struct x86_debug_state32, dr0));
193 DECLARE("DS_DR1", offsetof(struct x86_debug_state32, dr1));
194 DECLARE("DS_DR2", offsetof(struct x86_debug_state32, dr2));
195 DECLARE("DS_DR3", offsetof(struct x86_debug_state32, dr3));
196 DECLARE("DS_DR4", offsetof(struct x86_debug_state32, dr4));
197 DECLARE("DS_DR5", offsetof(struct x86_debug_state32, dr5));
198 DECLARE("DS_DR6", offsetof(struct x86_debug_state32, dr6));
199 DECLARE("DS_DR7", offsetof(struct x86_debug_state32, dr7));
200
201 DECLARE("DS64_DR0", offsetof(struct x86_debug_state64, dr0));
202 DECLARE("DS64_DR1", offsetof(struct x86_debug_state64, dr1));
203 DECLARE("DS64_DR2", offsetof(struct x86_debug_state64, dr2));
204 DECLARE("DS64_DR3", offsetof(struct x86_debug_state64, dr3));
205 DECLARE("DS64_DR4", offsetof(struct x86_debug_state64, dr4));
206 DECLARE("DS64_DR5", offsetof(struct x86_debug_state64, dr5));
207 DECLARE("DS64_DR6", offsetof(struct x86_debug_state64, dr6));
208 DECLARE("DS64_DR7", offsetof(struct x86_debug_state64, dr7));
209
210 DECLARE("FP_VALID", offsetof(struct x86_fx_thread_state, fp_valid));
211
212 DECLARE("SS_FLAVOR", offsetof(x86_saved_state_t, flavor));
213 DECLARE("SS_32", x86_SAVED_STATE32);
214 DECLARE("SS_64", x86_SAVED_STATE64);
0c530ab8 215
fe8ab488 216#define R_(x) offsetof(x86_saved_state_t, ss_32.x)
0a7de745
A
217 DECLARE("R32_CS", R_(cs));
218 DECLARE("R32_SS", R_(ss));
219 DECLARE("R32_DS", R_(ds));
220 DECLARE("R32_ES", R_(es));
221 DECLARE("R32_FS", R_(fs));
222 DECLARE("R32_GS", R_(gs));
223 DECLARE("R32_UESP", R_(uesp));
224 DECLARE("R32_EBP", R_(ebp));
225 DECLARE("R32_EAX", R_(eax));
226 DECLARE("R32_EBX", R_(ebx));
227 DECLARE("R32_ECX", R_(ecx));
228 DECLARE("R32_EDX", R_(edx));
229 DECLARE("R32_ESI", R_(esi));
230 DECLARE("R32_EDI", R_(edi));
231 DECLARE("R32_TRAPNO", R_(trapno));
232 DECLARE("R32_ERR", R_(err));
233 DECLARE("R32_EFLAGS", R_(efl));
234 DECLARE("R32_EIP", R_(eip));
235 DECLARE("R32_CR2", R_(cr2));
236 DECLARE("ISS32_SIZE", sizeof(x86_saved_state32_t));
0c530ab8 237
fe8ab488 238#define R64_(x) offsetof(x86_saved_state_t, ss_64.x)
0a7de745
A
239 DECLARE("R64_DS", R64_(ds));
240 DECLARE("R64_ES", R64_(es));
241 DECLARE("R64_FS", R64_(fs));
242 DECLARE("R64_GS", R64_(gs));
243 DECLARE("R64_R8", R64_(r8));
244 DECLARE("R64_R9", R64_(r9));
245 DECLARE("R64_R10", R64_(r10));
246 DECLARE("R64_R11", R64_(r11));
247 DECLARE("R64_R12", R64_(r12));
248 DECLARE("R64_R13", R64_(r13));
249 DECLARE("R64_R14", R64_(r14));
250 DECLARE("R64_R15", R64_(r15));
251 DECLARE("R64_RBP", R64_(rbp));
252 DECLARE("R64_RAX", R64_(rax));
253 DECLARE("R64_RBX", R64_(rbx));
254 DECLARE("R64_RCX", R64_(rcx));
255 DECLARE("R64_RDX", R64_(rdx));
256 DECLARE("R64_RSI", R64_(rsi));
257 DECLARE("R64_RDI", R64_(rdi));
258 DECLARE("R64_CS", R64_(isf.cs));
259 DECLARE("R64_SS", R64_(isf.ss));
260 DECLARE("R64_RSP", R64_(isf.rsp));
261 DECLARE("R64_TRAPNO", R64_(isf.trapno));
262 DECLARE("R64_TRAPFN", R64_(isf.trapfn));
263 DECLARE("R64_ERR", R64_(isf.err));
264 DECLARE("R64_RFLAGS", R64_(isf.rflags));
265 DECLARE("R64_RIP", R64_(isf.rip));
266 DECLARE("R64_CR2", R64_(cr2));
267 DECLARE("ISS64_OFFSET", R64_(isf));
268 DECLARE("ISS64_SIZE", sizeof(x86_saved_state64_t));
0c530ab8 269
fe8ab488 270#define ISF64_(x) offsetof(x86_64_intr_stack_frame_t, x)
0a7de745
A
271 DECLARE("ISF64_TRAPNO", ISF64_(trapno));
272 DECLARE("ISF64_TRAPFN", ISF64_(trapfn));
273 DECLARE("ISF64_ERR", ISF64_(err));
274 DECLARE("ISF64_RIP", ISF64_(rip));
275 DECLARE("ISF64_CS", ISF64_(cs));
276 DECLARE("ISF64_RFLAGS", ISF64_(rflags));
277 DECLARE("ISF64_RSP", ISF64_(rsp));
278 DECLARE("ISF64_SS", ISF64_(ss));
279 DECLARE("ISF64_SIZE", sizeof(x86_64_intr_stack_frame_t));
280
281 DECLARE("NBPG", I386_PGBYTES);
282 DECLARE("PAGE_SIZE", I386_PGBYTES);
283 DECLARE("PAGE_MASK", I386_PGBYTES - 1);
284 DECLARE("PAGE_SHIFT", 12);
285 DECLARE("NKPT", NKPT);
286 DECLARE("VM_MIN_ADDRESS", VM_MIN_ADDRESS);
287 DECLARE("VM_MAX_ADDRESS", VM_MAX_ADDRESS);
288 DECLARE("KERNELBASE", VM_MIN_KERNEL_ADDRESS);
289 DECLARE("LINEAR_KERNELBASE", LINEAR_KERNEL_ADDRESS);
290 DECLARE("KERNEL_STACK_SIZE", KERNEL_STACK_SIZE);
291
292 DECLARE("ASM_COMM_PAGE32_BASE_ADDRESS", _COMM_PAGE32_BASE_ADDRESS);
293 DECLARE("ASM_COMM_PAGE32_START_ADDRESS", _COMM_PAGE32_START_ADDRESS);
91447636 294
3e170ce0 295 DECLARE("KERNEL_PML4_INDEX", KERNEL_PML4_INDEX);
0a7de745
A
296 DECLAREULL("KERNEL_BASE", KERNEL_BASE);
297 DECLARE("IDTSZ", IDTSZ);
298 DECLARE("GDTSZ", GDTSZ);
299
300 DECLARE("KERNEL_DS", KERNEL_DS);
301 DECLARE("USER_CS", USER_CS);
302 DECLARE("USER_DS", USER_DS);
303 DECLARE("USER_CTHREAD", USER_CTHREAD);
304 DECLARE("KERNEL32_CS", KERNEL32_CS);
305 DECLARE("KERNEL64_CS", KERNEL64_CS);
306 DECLARE("USER64_CS", USER64_CS);
307 DECLARE("KERNEL_TSS", KERNEL_TSS);
308 DECLARE("KERNEL_LDT", KERNEL_LDT);
309 DECLARE("SYSENTER_CS", SYSENTER_CS);
310 DECLARE("SYSENTER_TF_CS", SYSENTER_TF_CS);
311 DECLARE("SYSENTER_DS", SYSENTER_DS);
312 DECLARE("SYSCALL_CS", SYSCALL_CS);
313
314 DECLARE("CPU_THIS",
315 offsetof(cpu_data_t, cpu_this));
316 DECLARE("CPU_ACTIVE_THREAD",
317 offsetof(cpu_data_t, cpu_active_thread));
318 DECLARE("CPU_ACTIVE_STACK",
319 offsetof(cpu_data_t, cpu_active_stack));
320 DECLARE("CPU_KERNEL_STACK",
321 offsetof(cpu_data_t, cpu_kernel_stack));
322 DECLARE("CPU_INT_STACK_TOP",
323 offsetof(cpu_data_t, cpu_int_stack_top));
324 DECLARE("CPU_PREEMPTION_LEVEL",
325 offsetof(cpu_data_t, cpu_preemption_level));
326 DECLARE("CPU_HIBERNATE",
327 offsetof(cpu_data_t, cpu_hibernate));
328 DECLARE("CPU_INTERRUPT_LEVEL",
329 offsetof(cpu_data_t, cpu_interrupt_level));
330 DECLARE("CPU_NEED_SEGCHK",
331 offsetof(cpu_data_t, cpu_curthread_do_segchk));
060df5ea 332 DECLARE("CPU_NESTED_ISTACK",
fe8ab488 333 offsetof(cpu_data_t, cpu_nested_istack));
0a7de745
A
334 DECLARE("CPU_NUMBER_GS",
335 offsetof(cpu_data_t, cpu_number));
336 DECLARE("CPU_RUNNING",
337 offsetof(cpu_data_t, cpu_running));
91447636 338 DECLARE("CPU_PENDING_AST",
0a7de745 339 offsetof(cpu_data_t, cpu_pending_ast));
91447636 340 DECLARE("CPU_PROCESSOR",
0a7de745
A
341 offsetof(cpu_data_t, cpu_processor));
342 DECLARE("CPU_INT_STATE",
343 offsetof(cpu_data_t, cpu_int_state));
344 DECLARE("CPU_INT_EVENT_TIME",
345 offsetof(cpu_data_t, cpu_int_event_time));
346
347 DECLARE("CPU_TASK_CR3",
348 offsetof(cpu_data_t, cpu_task_cr3));
349 DECLARE("CPU_SHADOWTASK_CR3",
350 offsetof(cpu_data_t, cpu_shadowtask_cr3));
351 DECLARE("CPU_ACTIVE_CR3",
352 offsetof(cpu_data_t, cpu_active_cr3));
353 DECLARE("CPU_KERNEL_CR3",
354 offsetof(cpu_data_t, cpu_kernel_cr3));
5c9f4661 355 DECLARE("CPU_UCR3",
0a7de745
A
356 offsetof(cpu_data_t, cpu_ucr3));
357 DECLARE("CPU_IP_DESC",
358 offsetof(cpu_data_t, cpu_ip_desc));
359#if DEBUG
5c9f4661 360 DECLARE("CPU_ENTRY_CR3",
0a7de745 361 offsetof(cpu_data_t, cpu_entry_cr3));
5c9f4661 362 DECLARE("CPU_EXIT_CR3",
0a7de745 363 offsetof(cpu_data_t, cpu_exit_cr3));
5c9f4661 364#endif
39236c6e 365 DECLARE("CPU_TLB_INVALID",
0a7de745 366 offsetof(cpu_data_t, cpu_tlb_invalid));
39037602 367 DECLARE("CPU_PAGEZERO_MAPPED",
0a7de745
A
368 offsetof(cpu_data_t, cpu_pagezero_mapped));
369 DECLARE("CPU_CURTASK_HAS_LDT",
370 offsetof(cpu_data_t, cpu_curtask_has_ldt));
0c530ab8 371
0c530ab8 372 DECLARE("CPU_TASK_MAP",
0a7de745
A
373 offsetof(cpu_data_t, cpu_task_map));
374 DECLARE("TASK_MAP_32BIT", TASK_MAP_32BIT);
375 DECLARE("TASK_MAP_64BIT", TASK_MAP_64BIT);
0c530ab8 376 DECLARE("CPU_UBER_ISF",
0a7de745 377 offsetof(cpu_data_t, cpu_uber.cu_isf));
0c530ab8 378 DECLARE("CPU_UBER_TMP",
0a7de745 379 offsetof(cpu_data_t, cpu_uber.cu_tmp));
2d21ac55 380
593a1d5f 381 DECLARE("CPU_NANOTIME",
0a7de745 382 offsetof(cpu_data_t, cpu_nanotime));
593a1d5f 383
0c530ab8 384 DECLARE("CPU_DR7",
0a7de745 385 offsetof(cpu_data_t, cpu_dr7));
0c530ab8 386
0a7de745 387 DECLARE("hwIntCnt", offsetof(cpu_data_t, cpu_hwIntCnt));
6d2010ae 388 DECLARE("CPU_ACTIVE_PCID",
0a7de745 389 offsetof(cpu_data_t, cpu_active_pcid));
39037602 390 DECLARE("CPU_KERNEL_PCID",
0a7de745 391 offsetof(cpu_data_t, cpu_kernel_pcid));
39037602 392
6d2010ae 393 DECLARE("CPU_PCID_COHERENTP",
0a7de745 394 offsetof(cpu_data_t, cpu_pmap_pcid_coherentp));
6d2010ae 395 DECLARE("CPU_PCID_COHERENTP_KERNEL",
0a7de745 396 offsetof(cpu_data_t, cpu_pmap_pcid_coherentp_kernel));
6d2010ae 397 DECLARE("CPU_PMAP_PCID_ENABLED",
fe8ab488 398 offsetof(cpu_data_t, cpu_pmap_pcid_enabled));
6d2010ae 399
0a7de745 400#ifdef PCID_STATS
6d2010ae 401 DECLARE("CPU_PMAP_USER_RETS",
fe8ab488 402 offsetof(cpu_data_t, cpu_pmap_user_rets));
6d2010ae 403 DECLARE("CPU_PMAP_PCID_PRESERVES",
fe8ab488 404 offsetof(cpu_data_t, cpu_pmap_pcid_preserves));
6d2010ae 405 DECLARE("CPU_PMAP_PCID_FLUSHES",
fe8ab488 406 offsetof(cpu_data_t, cpu_pmap_pcid_flushes));
6d2010ae 407#endif
6d2010ae 408 DECLARE("CPU_TLB_INVALID_LOCAL",
fe8ab488 409 offsetof(cpu_data_t, cpu_tlb_invalid_local));
6d2010ae 410 DECLARE("CPU_TLB_INVALID_GLOBAL",
0a7de745 411 offsetof(cpu_data_t, cpu_tlb_invalid_global));
5c9f4661 412 DECLARE("CPU_ESTACK",
0a7de745 413 offsetof(cpu_data_t, cd_estack));
5c9f4661 414 DECLARE("CPU_DSHADOW",
0a7de745 415 offsetof(cpu_data_t, cd_shadow));
f427ee49
A
416#if DEVELOPMENT || DEBUG
417 DECLARE("CPU_RTIMES",
418 offsetof(cpu_data_t, cpu_rtimes[0]));
419#endif
0a7de745
A
420
421 DECLARE("enaExpTrace", enaExpTrace);
422 DECLARE("enaUsrFCall", enaUsrFCall);
423 DECLARE("enaUsrPhyMp", enaUsrPhyMp);
424 DECLARE("enaDiagSCs", enaDiagSCs);
425 DECLARE("enaDiagEM", enaDiagEM);
426 DECLARE("enaNotifyEM", enaNotifyEM);
427 DECLARE("dgLock", offsetof(struct diagWork, dgLock));
428 DECLARE("dgFlags", offsetof(struct diagWork, dgFlags));
429 DECLARE("dgMisc1", offsetof(struct diagWork, dgMisc1));
430 DECLARE("dgMisc2", offsetof(struct diagWork, dgMisc2));
431 DECLARE("dgMisc3", offsetof(struct diagWork, dgMisc3));
432 DECLARE("dgMisc4", offsetof(struct diagWork, dgMisc4));
433 DECLARE("dgMisc5", offsetof(struct diagWork, dgMisc5));
434
435 DECLARE("TSS_ESP0", offsetof(struct i386_tss, esp0));
436 DECLARE("TSS_SS0", offsetof(struct i386_tss, ss0));
437 DECLARE("TSS_LDT", offsetof(struct i386_tss, ldt));
438 DECLARE("TSS_PDBR", offsetof(struct i386_tss, cr3));
439 DECLARE("TSS_LINK", offsetof(struct i386_tss, back_link));
440
441 DECLARE("K_TASK_GATE", ACC_P | ACC_PL_K | ACC_TASK_GATE);
442 DECLARE("K_TRAP_GATE", ACC_P | ACC_PL_K | ACC_TRAP_GATE);
443 DECLARE("U_TRAP_GATE", ACC_P | ACC_PL_U | ACC_TRAP_GATE);
444 DECLARE("K_INTR_GATE", ACC_P | ACC_PL_K | ACC_INTR_GATE);
445 DECLARE("U_INTR_GATE", ACC_P | ACC_PL_U | ACC_INTR_GATE);
446 DECLARE("K_TSS", ACC_P | ACC_PL_K | ACC_TSS);
1c79356b
A
447
448 /*
449 * usimple_lock fields
450 */
0a7de745 451 DECLARE("USL_INTERLOCK", offsetof(usimple_lock_data_t, interlock));
1c79356b 452
0a7de745 453 DECLARE("INTSTACK_SIZE", INTSTACK_SIZE);
fe8ab488
A
454 DECLARE("KADDR", offsetof(struct boot_args, kaddr));
455 DECLARE("KSIZE", offsetof(struct boot_args, ksize));
456 DECLARE("MEMORYMAP", offsetof(struct boot_args, MemoryMap));
457 DECLARE("DEVICETREEP", offsetof(struct boot_args, deviceTreeP));
0c530ab8
A
458
459 DECLARE("RNT_TSC_BASE",
0a7de745 460 offsetof(pal_rtc_nanotime_t, tsc_base));
0c530ab8 461 DECLARE("RNT_NS_BASE",
0a7de745 462 offsetof(pal_rtc_nanotime_t, ns_base));
0c530ab8 463 DECLARE("RNT_SCALE",
0a7de745 464 offsetof(pal_rtc_nanotime_t, scale));
0c530ab8 465 DECLARE("RNT_SHIFT",
0a7de745 466 offsetof(pal_rtc_nanotime_t, shift));
2d21ac55 467 DECLARE("RNT_GENERATION",
0a7de745 468 offsetof(pal_rtc_nanotime_t, generation));
91447636
A
469
470 /* values from kern/timer.h */
b0d623f7 471#ifdef __LP64__
fe8ab488 472 DECLARE("TIMER_ALL", offsetof(struct timer, all_bits));
b0d623f7 473#else
0a7de745
A
474 DECLARE("TIMER_LOW", offsetof(struct timer, low_bits));
475 DECLARE("TIMER_HIGH", offsetof(struct timer, high_bits));
476 DECLARE("TIMER_HIGHCHK", offsetof(struct timer, high_bits_check));
b0d623f7 477#endif
91447636 478 DECLARE("TIMER_TSTAMP",
0a7de745 479 offsetof(struct timer, tstamp));
91447636 480
2d21ac55 481 DECLARE("THREAD_TIMER",
f427ee49 482 offsetof(struct processor, thread_timer));
2d21ac55 483 DECLARE("KERNEL_TIMER",
f427ee49 484 offsetof(struct processor, kernel_timer));
91447636 485 DECLARE("SYSTEM_TIMER",
0a7de745 486 offsetof(struct thread, system_timer));
91447636 487 DECLARE("USER_TIMER",
0a7de745 488 offsetof(struct thread, user_timer));
2d21ac55 489 DECLARE("SYSTEM_STATE",
f427ee49 490 offsetof(struct processor, system_state));
2d21ac55 491 DECLARE("USER_STATE",
f427ee49 492 offsetof(struct processor, user_state));
2d21ac55 493 DECLARE("IDLE_STATE",
f427ee49 494 offsetof(struct processor, idle_state));
2d21ac55 495 DECLARE("CURRENT_STATE",
f427ee49 496 offsetof(struct processor, current_state));
1c79356b 497
0c530ab8
A
498 DECLARE("OnProc", OnProc);
499
0a7de745 500 return 0;
1c79356b 501}