xref: /xnu-10063.121.3/osfmk/i386/genassym.c (revision 2c2f96dc2b9a4408a43d3150ae9c105355ca3daa)
1 /*
2  * Copyright (c) 2000-2020 Apple Inc. All rights reserved.
3  *
4  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5  *
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.
14  *
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
20  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
25  *
26  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
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  [email protected]
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 
57 #include <stddef.h>
58 
59 #include <mach_ldebug.h>
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>
67 #include <kern/locks.h>
68 #include <kern/host.h>
69 #include <kern/misc_protos.h>
70 #include <ipc/ipc_space.h>
71 #include <ipc/ipc_port.h>
72 #include <ipc/ipc_pset.h>
73 #include <vm/vm_map.h>
74 #include <i386/pmap.h>
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>
80 #include <i386/tss.h>
81 #include <i386/cpu_capabilities.h>
82 #include <i386/cpuid.h>
83 #include <i386/pmCPU.h>
84 #include <mach/i386/vm_param.h>
85 #include <mach/i386/thread_status.h>
86 #include <machine/commpage.h>
87 #include <pexpert/i386/boot.h>
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 
102 #define DECLARE(SYM, VAL) \
103 	__asm("DEFINITION__define__" SYM ":\t .ascii \"%0\"" : : "n"  ((u_int)(VAL)))
104 
105 #define DECLAREULL(SYM, VAL) \
106 	__asm("DEFINITION__define__" SYM ":\t .ascii \"%0\"" : : "i"  ((unsigned long long)(VAL)))
107 
108 int     main(
109 	int             argc,
110 	char            ** argv);
111 
112 int
main(int argc,char ** argv)113 main(
114 	int     argc,
115 	char    **argv)
116 {
117 	DECLARE("AST_URGENT", AST_URGENT);
118 	DECLARE("AST_BSD", AST_BSD);
119 
120 	DECLARE("MAX_CPUS", MAX_CPUS);
121 
122 	/* Simple Lock structure */
123 	DECLARE("SLOCK_ILK", offsetof(usimple_lock_data_t, interlock));
124 
125 	/* Reader writer lock types */
126 	DECLARE("RW_SHARED", LCK_RW_TYPE_SHARED);
127 	DECLARE("RW_EXCL", LCK_RW_TYPE_EXCLUSIVE);
128 
129 	DECLARE("TH_RECOVER", offsetof(struct thread, recover));
130 	DECLARE("TH_CONTINUATION", offsetof(struct thread, continuation));
131 	DECLARE("TH_KERNEL_STACK", offsetof(struct thread, kernel_stack));
132 	DECLARE("TH_IOTIER_OVERRIDE", offsetof(struct thread, iotier_override));
133 
134 	DECLARE("TH_SYSCALLS_MACH", offsetof(struct thread, syscalls_mach));
135 	DECLARE("TH_SYSCALLS_UNIX", offsetof(struct thread, syscalls_unix));
136 
137 	DECLARE("TH_CTH_SELF", offsetof(struct thread, machine.cthread_self));
138 
139 	DECLARE("TASK_VTIMERS", offsetof(struct task, vtimers));
140 
141 	/* These fields are being added on demand */
142 	DECLARE("TH_TASK", offsetof(struct thread, t_task));
143 	DECLARE("TH_AST", offsetof(struct thread, ast));
144 	DECLARE("TH_MAP", offsetof(struct thread, map));
145 	DECLARE("TH_SPF", offsetof(struct thread, machine.specFlags));
146 	DECLARE("TH_PCB_ISS", offsetof(struct thread, machine.iss));
147 	DECLARE("TH_PCB_IDS", offsetof(struct thread, machine.ids));
148 	DECLARE("TH_PCB_FPS", offsetof(struct thread, machine.ifps));
149 
150 	DECLARE("MAP_PMAP", offsetof(struct _vm_map, pmap));
151 
152 #define IEL_SIZE                (sizeof(struct i386_exception_link *))
153 	DECLARE("IKS_SIZE", sizeof(struct thread_kernel_state));
154 
155 	/*
156 	 * KSS_* are offsets from the top of the kernel stack (cpu_kernel_stack)
157 	 */
158 	DECLARE("KSS_RBX", offsetof(struct thread_kernel_state, machine.k_rbx));
159 	DECLARE("KSS_RSP", offsetof(struct thread_kernel_state, machine.k_rsp));
160 	DECLARE("KSS_RBP", offsetof(struct thread_kernel_state, machine.k_rbp));
161 	DECLARE("KSS_R12", offsetof(struct thread_kernel_state, machine.k_r12));
162 	DECLARE("KSS_R13", offsetof(struct thread_kernel_state, machine.k_r13));
163 	DECLARE("KSS_R14", offsetof(struct thread_kernel_state, machine.k_r14));
164 	DECLARE("KSS_R15", offsetof(struct thread_kernel_state, machine.k_r15));
165 	DECLARE("KSS_RIP", offsetof(struct thread_kernel_state, machine.k_rip));
166 
167 	DECLARE("DS_DR0", offsetof(struct x86_debug_state32, dr0));
168 	DECLARE("DS_DR1", offsetof(struct x86_debug_state32, dr1));
169 	DECLARE("DS_DR2", offsetof(struct x86_debug_state32, dr2));
170 	DECLARE("DS_DR3", offsetof(struct x86_debug_state32, dr3));
171 	DECLARE("DS_DR4", offsetof(struct x86_debug_state32, dr4));
172 	DECLARE("DS_DR5", offsetof(struct x86_debug_state32, dr5));
173 	DECLARE("DS_DR6", offsetof(struct x86_debug_state32, dr6));
174 	DECLARE("DS_DR7", offsetof(struct x86_debug_state32, dr7));
175 
176 	DECLARE("DS64_DR0", offsetof(struct x86_debug_state64, dr0));
177 	DECLARE("DS64_DR1", offsetof(struct x86_debug_state64, dr1));
178 	DECLARE("DS64_DR2", offsetof(struct x86_debug_state64, dr2));
179 	DECLARE("DS64_DR3", offsetof(struct x86_debug_state64, dr3));
180 	DECLARE("DS64_DR4", offsetof(struct x86_debug_state64, dr4));
181 	DECLARE("DS64_DR5", offsetof(struct x86_debug_state64, dr5));
182 	DECLARE("DS64_DR6", offsetof(struct x86_debug_state64, dr6));
183 	DECLARE("DS64_DR7", offsetof(struct x86_debug_state64, dr7));
184 
185 	DECLARE("FP_VALID", offsetof(struct x86_fx_thread_state, fp_valid));
186 
187 	DECLARE("SS_FLAVOR", offsetof(x86_saved_state_t, flavor));
188 	DECLARE("SS_32", x86_SAVED_STATE32);
189 	DECLARE("SS_64", x86_SAVED_STATE64);
190 
191 #define R_(x)  offsetof(x86_saved_state_t, ss_32.x)
192 	DECLARE("R32_CS", R_(cs));
193 	DECLARE("R32_SS", R_(ss));
194 	DECLARE("R32_DS", R_(ds));
195 	DECLARE("R32_ES", R_(es));
196 	DECLARE("R32_FS", R_(fs));
197 	DECLARE("R32_GS", R_(gs));
198 	DECLARE("R32_UESP", R_(uesp));
199 	DECLARE("R32_EBP", R_(ebp));
200 	DECLARE("R32_EAX", R_(eax));
201 	DECLARE("R32_EBX", R_(ebx));
202 	DECLARE("R32_ECX", R_(ecx));
203 	DECLARE("R32_EDX", R_(edx));
204 	DECLARE("R32_ESI", R_(esi));
205 	DECLARE("R32_EDI", R_(edi));
206 	DECLARE("R32_TRAPNO", R_(trapno));
207 	DECLARE("R32_ERR", R_(err));
208 	DECLARE("R32_EFLAGS", R_(efl));
209 	DECLARE("R32_EIP", R_(eip));
210 	DECLARE("R32_CR2", R_(cr2));
211 	DECLARE("ISS32_SIZE", sizeof(x86_saved_state32_t));
212 
213 #define R64_(x)  offsetof(x86_saved_state_t, ss_64.x)
214 	DECLARE("R64_DS", R64_(ds));
215 	DECLARE("R64_ES", R64_(es));
216 	DECLARE("R64_FS", R64_(fs));
217 	DECLARE("R64_GS", R64_(gs));
218 	DECLARE("R64_R8", R64_(r8));
219 	DECLARE("R64_R9", R64_(r9));
220 	DECLARE("R64_R10", R64_(r10));
221 	DECLARE("R64_R11", R64_(r11));
222 	DECLARE("R64_R12", R64_(r12));
223 	DECLARE("R64_R13", R64_(r13));
224 	DECLARE("R64_R14", R64_(r14));
225 	DECLARE("R64_R15", R64_(r15));
226 	DECLARE("R64_RBP", R64_(rbp));
227 	DECLARE("R64_RAX", R64_(rax));
228 	DECLARE("R64_RBX", R64_(rbx));
229 	DECLARE("R64_RCX", R64_(rcx));
230 	DECLARE("R64_RDX", R64_(rdx));
231 	DECLARE("R64_RSI", R64_(rsi));
232 	DECLARE("R64_RDI", R64_(rdi));
233 	DECLARE("R64_CS", R64_(isf.cs));
234 	DECLARE("R64_SS", R64_(isf.ss));
235 	DECLARE("R64_RSP", R64_(isf.rsp));
236 	DECLARE("R64_TRAPNO", R64_(isf.trapno));
237 	DECLARE("R64_TRAPFN", R64_(isf.trapfn));
238 	DECLARE("R64_ERR", R64_(isf.err));
239 	DECLARE("R64_RFLAGS", R64_(isf.rflags));
240 	DECLARE("R64_RIP", R64_(isf.rip));
241 	DECLARE("R64_CR2", R64_(cr2));
242 	DECLARE("ISS64_OFFSET", R64_(isf));
243 	DECLARE("ISS64_SIZE", sizeof(x86_saved_state64_t));
244 
245 #define ISF64_(x)  offsetof(x86_64_intr_stack_frame_t, x)
246 	DECLARE("ISF64_TRAPNO", ISF64_(trapno));
247 	DECLARE("ISF64_TRAPFN", ISF64_(trapfn));
248 	DECLARE("ISF64_ERR", ISF64_(err));
249 	DECLARE("ISF64_RIP", ISF64_(rip));
250 	DECLARE("ISF64_CS", ISF64_(cs));
251 	DECLARE("ISF64_RFLAGS", ISF64_(rflags));
252 	DECLARE("ISF64_RSP", ISF64_(rsp));
253 	DECLARE("ISF64_SS", ISF64_(ss));
254 	DECLARE("ISF64_SIZE", sizeof(x86_64_intr_stack_frame_t));
255 
256 	DECLARE("NBPG", I386_PGBYTES);
257 	DECLARE("PAGE_SIZE", I386_PGBYTES);
258 	DECLARE("PAGE_MASK", I386_PGBYTES - 1);
259 	DECLARE("PAGE_SHIFT", 12);
260 	DECLARE("NKPT", NKPT);
261 	DECLARE("VM_MIN_ADDRESS", VM_MIN_ADDRESS);
262 	DECLARE("VM_MAX_ADDRESS", VM_MAX_ADDRESS);
263 	DECLARE("KERNELBASE", VM_MIN_KERNEL_ADDRESS);
264 	DECLARE("LINEAR_KERNELBASE", LINEAR_KERNEL_ADDRESS);
265 	DECLARE("KERNEL_STACK_SIZE", KERNEL_STACK_SIZE);
266 
267 	DECLARE("ASM_COMM_PAGE32_BASE_ADDRESS", _COMM_PAGE32_BASE_ADDRESS);
268 	DECLARE("ASM_COMM_PAGE32_START_ADDRESS", _COMM_PAGE32_START_ADDRESS);
269 
270 	DECLARE("KERNEL_PML4_INDEX", KERNEL_PML4_INDEX);
271 	DECLAREULL("KERNEL_BASE", KERNEL_BASE);
272 	DECLARE("IDTSZ", IDTSZ);
273 	DECLARE("GDTSZ", GDTSZ);
274 
275 	DECLARE("KERNEL_DS", KERNEL_DS);
276 	DECLARE("USER_CS", USER_CS);
277 	DECLARE("USER_DS", USER_DS);
278 	DECLARE("USER_CTHREAD", USER_CTHREAD);
279 	DECLARE("KERNEL32_CS", KERNEL32_CS);
280 	DECLARE("KERNEL64_CS", KERNEL64_CS);
281 	DECLARE("USER64_CS", USER64_CS);
282 	DECLARE("KERNEL_TSS", KERNEL_TSS);
283 	DECLARE("KERNEL_LDT", KERNEL_LDT);
284 	DECLARE("SYSENTER_CS", SYSENTER_CS);
285 	DECLARE("SYSENTER_TF_CS", SYSENTER_TF_CS);
286 	DECLARE("SYSENTER_DS", SYSENTER_DS);
287 	DECLARE("SYSCALL_CS", SYSCALL_CS);
288 
289 	DECLARE("CPU_THIS",
290 	    offsetof(cpu_data_t, cpu_this));
291 	DECLARE("CPU_ACTIVE_THREAD",
292 	    offsetof(cpu_data_t, cpu_active_thread));
293 	DECLARE("CPU_ACTIVE_STACK",
294 	    offsetof(cpu_data_t, cpu_active_stack));
295 	DECLARE("CPU_KERNEL_STACK",
296 	    offsetof(cpu_data_t, cpu_kernel_stack));
297 	DECLARE("CPU_INT_STACK_TOP",
298 	    offsetof(cpu_data_t, cpu_int_stack_top));
299 	DECLARE("CPU_PREEMPTION_LEVEL",
300 	    offsetof(cpu_data_t, cpu_preemption_level));
301 	DECLARE("CPU_HIBERNATE",
302 	    offsetof(cpu_data_t, cpu_hibernate));
303 	DECLARE("CPU_INTERRUPT_LEVEL",
304 	    offsetof(cpu_data_t, cpu_interrupt_level));
305 	DECLARE("CPU_NEED_SEGCHK",
306 	    offsetof(cpu_data_t, cpu_curthread_do_segchk));
307 	DECLARE("MTHR_SEGCHK", MTHR_SEGCHK);
308 	DECLARE("CPU_NESTED_ISTACK",
309 	    offsetof(cpu_data_t, cpu_nested_istack));
310 	DECLARE("CPU_NUMBER_GS",
311 	    offsetof(cpu_data_t, cpu_number));
312 	DECLARE("CPU_RUNNING",
313 	    offsetof(cpu_data_t, cpu_running));
314 	DECLARE("CPU_PENDING_AST",
315 	    offsetof(cpu_data_t, cpu_pending_ast));
316 	DECLARE("CPU_PROCESSOR",
317 	    offsetof(cpu_data_t, cpu_processor));
318 	DECLARE("CPU_INT_STATE",
319 	    offsetof(cpu_data_t, cpu_int_state));
320 	DECLARE("CPU_INT_EVENT_TIME",
321 	    offsetof(cpu_data_t, cpu_int_event_time));
322 
323 	DECLARE("CPU_TASK_CR3",
324 	    offsetof(cpu_data_t, cpu_task_cr3));
325 	DECLARE("CPU_SHADOWTASK_CR3",
326 	    offsetof(cpu_data_t, cpu_shadowtask_cr3));
327 	DECLARE("CPU_ACTIVE_CR3",
328 	    offsetof(cpu_data_t, cpu_active_cr3));
329 	DECLARE("CPU_KERNEL_CR3",
330 	    offsetof(cpu_data_t, cpu_kernel_cr3));
331 	DECLARE("CPU_UCR3",
332 	    offsetof(cpu_data_t, cpu_ucr3));
333 	DECLARE("CPU_IP_DESC",
334 	    offsetof(cpu_data_t, cpu_ip_desc));
335 #if     DEBUG
336 	DECLARE("CPU_ENTRY_CR3",
337 	    offsetof(cpu_data_t, cpu_entry_cr3));
338 	DECLARE("CPU_EXIT_CR3",
339 	    offsetof(cpu_data_t, cpu_exit_cr3));
340 #endif
341 	DECLARE("CPU_TLB_INVALID",
342 	    offsetof(cpu_data_t, cpu_tlb_invalid));
343 	DECLARE("CPU_PAGEZERO_MAPPED",
344 	    offsetof(cpu_data_t, cpu_pagezero_mapped));
345 	DECLARE("CPU_CURTASK_HAS_LDT",
346 	    offsetof(cpu_data_t, cpu_curtask_has_ldt));
347 
348 	DECLARE("CPU_TASK_MAP",
349 	    offsetof(cpu_data_t, cpu_task_map));
350 	DECLARE("TASK_MAP_32BIT", TASK_MAP_32BIT);
351 	DECLARE("TASK_MAP_64BIT", TASK_MAP_64BIT);
352 	DECLARE("CPU_UBER_ISF",
353 	    offsetof(cpu_data_t, cpu_uber.cu_isf));
354 	DECLARE("CPU_UBER_TMP",
355 	    offsetof(cpu_data_t, cpu_uber.cu_tmp));
356 
357 	DECLARE("CPU_NANOTIME",
358 	    offsetof(cpu_data_t, cpu_nanotime));
359 
360 	DECLARE("CPU_DR7",
361 	    offsetof(cpu_data_t, cpu_dr7));
362 
363 	DECLARE("hwIntCnt", offsetof(cpu_data_t, cpu_hwIntCnt));
364 	DECLARE("CPU_ACTIVE_PCID",
365 	    offsetof(cpu_data_t, cpu_active_pcid));
366 	DECLARE("CPU_KERNEL_PCID",
367 	    offsetof(cpu_data_t, cpu_kernel_pcid));
368 
369 	DECLARE("CPU_PCID_COHERENTP",
370 	    offsetof(cpu_data_t, cpu_pmap_pcid_coherentp));
371 	DECLARE("CPU_PCID_COHERENTP_KERNEL",
372 	    offsetof(cpu_data_t, cpu_pmap_pcid_coherentp_kernel));
373 	DECLARE("CPU_PMAP_PCID_ENABLED",
374 	    offsetof(cpu_data_t, cpu_pmap_pcid_enabled));
375 
376 #ifdef  PCID_STATS
377 	DECLARE("CPU_PMAP_USER_RETS",
378 	    offsetof(cpu_data_t, cpu_pmap_user_rets));
379 	DECLARE("CPU_PMAP_PCID_PRESERVES",
380 	    offsetof(cpu_data_t, cpu_pmap_pcid_preserves));
381 	DECLARE("CPU_PMAP_PCID_FLUSHES",
382 	    offsetof(cpu_data_t, cpu_pmap_pcid_flushes));
383 #endif
384 	DECLARE("CPU_TLB_INVALID_LOCAL",
385 	    offsetof(cpu_data_t, cpu_tlb_invalid_local));
386 	DECLARE("CPU_TLB_INVALID_GLOBAL",
387 	    offsetof(cpu_data_t, cpu_tlb_invalid_global));
388 	DECLARE("CPU_ESTACK",
389 	    offsetof(cpu_data_t, cd_estack));
390 	DECLARE("CPU_DSHADOW",
391 	    offsetof(cpu_data_t, cd_shadow));
392 #if DEVELOPMENT || DEBUG
393 	DECLARE("CPU_RTIMES",
394 	    offsetof(cpu_data_t, cpu_rtimes[0]));
395 #endif
396 
397 	DECLARE("enaExpTrace", enaExpTrace);
398 	DECLARE("enaUsrFCall", enaUsrFCall);
399 	DECLARE("enaUsrPhyMp", enaUsrPhyMp);
400 	DECLARE("enaDiagSCs", enaDiagSCs);
401 	DECLARE("enaDiagEM", enaDiagEM);
402 	DECLARE("enaNotifyEM", enaNotifyEM);
403 	DECLARE("dgLock", offsetof(struct diagWork, dgLock));
404 	DECLARE("dgFlags", offsetof(struct diagWork, dgFlags));
405 	DECLARE("dgMisc1", offsetof(struct diagWork, dgMisc1));
406 	DECLARE("dgMisc2", offsetof(struct diagWork, dgMisc2));
407 	DECLARE("dgMisc3", offsetof(struct diagWork, dgMisc3));
408 	DECLARE("dgMisc4", offsetof(struct diagWork, dgMisc4));
409 	DECLARE("dgMisc5", offsetof(struct diagWork, dgMisc5));
410 
411 	DECLARE("TSS_ESP0", offsetof(struct i386_tss, esp0));
412 	DECLARE("TSS_SS0", offsetof(struct i386_tss, ss0));
413 	DECLARE("TSS_LDT", offsetof(struct i386_tss, ldt));
414 	DECLARE("TSS_PDBR", offsetof(struct i386_tss, cr3));
415 	DECLARE("TSS_LINK", offsetof(struct i386_tss, back_link));
416 
417 	DECLARE("K_TASK_GATE", ACC_P | ACC_PL_K | ACC_TASK_GATE);
418 	DECLARE("K_TRAP_GATE", ACC_P | ACC_PL_K | ACC_TRAP_GATE);
419 	DECLARE("U_TRAP_GATE", ACC_P | ACC_PL_U | ACC_TRAP_GATE);
420 	DECLARE("K_INTR_GATE", ACC_P | ACC_PL_K | ACC_INTR_GATE);
421 	DECLARE("U_INTR_GATE", ACC_P | ACC_PL_U | ACC_INTR_GATE);
422 	DECLARE("K_TSS", ACC_P | ACC_PL_K | ACC_TSS);
423 
424 	/*
425 	 *	usimple_lock fields
426 	 */
427 	DECLARE("USL_INTERLOCK", offsetof(usimple_lock_data_t, interlock));
428 
429 	DECLARE("INTSTACK_SIZE", INTSTACK_SIZE);
430 	DECLARE("KADDR", offsetof(struct boot_args, kaddr));
431 	DECLARE("KSIZE", offsetof(struct boot_args, ksize));
432 	DECLARE("MEMORYMAP", offsetof(struct boot_args, MemoryMap));
433 	DECLARE("DEVICETREEP", offsetof(struct boot_args, deviceTreeP));
434 
435 	DECLARE("RNT_TSC_BASE",
436 	    offsetof(pal_rtc_nanotime_t, tsc_base));
437 	DECLARE("RNT_NS_BASE",
438 	    offsetof(pal_rtc_nanotime_t, ns_base));
439 	DECLARE("RNT_SCALE",
440 	    offsetof(pal_rtc_nanotime_t, scale));
441 	DECLARE("RNT_SHIFT",
442 	    offsetof(pal_rtc_nanotime_t, shift));
443 	DECLARE("RNT_GENERATION",
444 	    offsetof(pal_rtc_nanotime_t, generation));
445 
446 	/* values from kern/timer.h */
447 #ifdef __LP64__
448 	DECLARE("TIMER_ALL", offsetof(struct timer, all_bits));
449 #endif
450 	DECLARE("TIMER_TSTAMP",
451 	    offsetof(struct timer, tstamp));
452 
453 	DECLARE("OnProc", OnProc);
454 
455 	return 0;
456 }
457