]> git.saurik.com Git - apple/xnu.git/blob - osfmk/i386/genassym.c
56cffc1912da4390cb96647299d44a22ee697bec
[apple/xnu.git] / osfmk / i386 / genassym.c
1 /*
2 * Copyright (c) 2000-2005 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 * Mach Operating System
27 * Copyright (c) 1991,1990 Carnegie Mellon University
28 * All Rights Reserved.
29 *
30 * Permission to use, copy, modify and distribute this software and its
31 * documentation is hereby granted, provided that both the copyright
32 * notice and this permission notice appear in all copies of the
33 * software, derivative works or modified versions, and any portions
34 * thereof, and that both notices appear in supporting documentation.
35 *
36 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
37 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
38 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
39 *
40 * Carnegie Mellon requests users of this software to return to
41 *
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
46 *
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
49 */
50
51 #include <platforms.h>
52 #include <mach_kdb.h>
53 #include <mach_ldebug.h>
54 #include <stat_time.h>
55
56 /*
57 * Pass field offsets to assembly code.
58 */
59 #include <kern/ast.h>
60 #include <kern/thread.h>
61 #include <kern/task.h>
62 #include <kern/lock.h>
63 #include <kern/locks.h>
64 #include <kern/host.h>
65 #include <kern/misc_protos.h>
66 #include <ipc/ipc_space.h>
67 #include <ipc/ipc_port.h>
68 #include <ipc/ipc_pset.h>
69 #include <vm/vm_map.h>
70 #include <i386/cpu_data.h>
71 #include <i386/thread.h>
72 #include <i386/seg.h>
73 #include <i386/pmap.h>
74 #include <i386/tss.h>
75 #include <i386/cpu_capabilities.h>
76 #include <i386/cpuid.h>
77 #include <i386/Diagnostics.h>
78 #include <i386/pmCPU.h>
79 #include <i386/hpet.h>
80 #include <mach/i386/vm_param.h>
81 #include <mach/i386/thread_status.h>
82 #include <machine/commpage.h>
83 #include <i386/mp_desc.h>
84 #include <pexpert/i386/boot.h>
85
86 /*
87 * genassym.c is used to produce an
88 * assembly file which, intermingled with unuseful assembly code,
89 * has all the necessary definitions emitted. This assembly file is
90 * then postprocessed with sed to extract only these definitions
91 * and thus the final assyms.s is created.
92 *
93 * This convoluted means is necessary since the structure alignment
94 * and packing may be different between the host machine and the
95 * target so we are forced into using the cross compiler to generate
96 * the values, but we cannot run anything on the target machine.
97 */
98
99 #undef offsetof
100 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE)0)->MEMBER)
101
102 #if 0
103 #define DECLARE(SYM,VAL) \
104 __asm("#DEFINITION#\t.set\t" SYM ",\t%0" : : "n" ((u_int)(VAL)))
105 #else
106 #define DECLARE(SYM,VAL) \
107 __asm("#DEFINITION##define " SYM "\t%0" : : "n" ((u_int)(VAL)))
108 #endif
109
110 int main(
111 int argc,
112 char ** argv);
113
114 int
115 main(
116 int argc,
117 char **argv)
118 {
119
120 DECLARE("AST_URGENT", AST_URGENT);
121
122 /* Simple Lock structure */
123 DECLARE("SLOCK_ILK", offsetof(usimple_lock_t, interlock));
124 #if MACH_LDEBUG
125 DECLARE("SLOCK_TYPE", offsetof(usimple_lock_t, lock_type));
126 DECLARE("SLOCK_PC", offsetof(usimple_lock_t, debug.lock_pc));
127 DECLARE("SLOCK_THREAD", offsetof(usimple_lock_t, debug.lock_thread));
128 DECLARE("SLOCK_DURATIONH",offsetof(usimple_lock_t, debug.duration[0]));
129 DECLARE("SLOCK_DURATIONL",offsetof(usimple_lock_t, debug.duration[1]));
130 DECLARE("USLOCK_TAG", USLOCK_TAG);
131 #endif /* MACH_LDEBUG */
132
133 /* Mutex structure */
134 DECLARE("MUTEX_LOCKED", offsetof(mutex_t *, lck_mtx.lck_mtx_locked));
135 DECLARE("MUTEX_WAITERS",offsetof(mutex_t *, lck_mtx.lck_mtx_waiters));
136 DECLARE("MUTEX_PROMOTED_PRI",offsetof(mutex_t *, lck_mtx.lck_mtx_pri));
137 #if MACH_LDEBUG
138 DECLARE("MUTEX_TYPE", offsetof(mutex_t *, type));
139 DECLARE("MUTEX_PC", offsetof(mutex_t *, pc));
140 DECLARE("MUTEX_THREAD", offsetof(mutex_t *, thread));
141 DECLARE("MUTEX_TAG", MUTEX_TAG);
142 #endif /* MACH_LDEBUG */
143 DECLARE("MUTEX_IND", LCK_MTX_TAG_INDIRECT);
144 DECLARE("MUTEX_ITAG", offsetof(lck_mtx_t *, lck_mtx_tag));
145 DECLARE("MUTEX_PTR", offsetof(lck_mtx_t *, lck_mtx_ptr));
146
147 DECLARE("TH_RECOVER", offsetof(thread_t, recover));
148 DECLARE("TH_CONTINUATION", offsetof(thread_t, continuation));
149 DECLARE("TH_KERNEL_STACK", offsetof(thread_t, kernel_stack));
150
151 DECLARE("TASK_MACH_EXC_PORT",
152 offsetof(task_t, exc_actions[EXC_MACH_SYSCALL].port));
153 DECLARE("TASK_SYSCALLS_MACH", offsetof(struct task *, syscalls_mach));
154 DECLARE("TASK_SYSCALLS_UNIX", offsetof(struct task *, syscalls_unix));
155
156 /* These fields are being added on demand */
157 DECLARE("ACT_MACH_EXC_PORT",
158 offsetof(thread_t, exc_actions[EXC_MACH_SYSCALL].port));
159
160 DECLARE("ACT_TASK", offsetof(thread_t, task));
161 DECLARE("ACT_PCB", offsetof(thread_t, machine.pcb));
162 DECLARE("ACT_SPF", offsetof(thread_t, machine.specFlags));
163 DECLARE("ACT_MAP", offsetof(thread_t, map));
164 DECLARE("ACT_COPYIO_STATE", offsetof(thread_t, machine.copyio_state));
165 DECLARE("ACT_PCB_ISS", offsetof(thread_t, machine.xxx_pcb.iss));
166 DECLARE("ACT_PCB_IDS", offsetof(thread_t, machine.xxx_pcb.ids));
167
168 DECLARE("WINDOWS_CLEAN", WINDOWS_CLEAN);
169
170 DECLARE("MAP_PMAP", offsetof(vm_map_t, pmap));
171
172 #define IKS ((size_t) (STACK_IKS(0)))
173
174 DECLARE("KSS_EBX", IKS + offsetof(struct x86_kernel_state32 *, k_ebx));
175 DECLARE("KSS_ESP", IKS + offsetof(struct x86_kernel_state32 *, k_esp));
176 DECLARE("KSS_EBP", IKS + offsetof(struct x86_kernel_state32 *, k_ebp));
177 DECLARE("KSS_EDI", IKS + offsetof(struct x86_kernel_state32 *, k_edi));
178 DECLARE("KSS_ESI", IKS + offsetof(struct x86_kernel_state32 *, k_esi));
179 DECLARE("KSS_EIP", IKS + offsetof(struct x86_kernel_state32 *, k_eip));
180
181 DECLARE("IKS_SIZE", sizeof(struct x86_kernel_state32));
182 DECLARE("IEL_SIZE", sizeof(struct i386_exception_link));
183
184 DECLARE("PCB_FPS", offsetof(pcb_t, ifps));
185 DECLARE("PCB_ISS", offsetof(pcb_t, iss));
186
187 DECLARE("DS_DR0", offsetof(struct x86_debug_state32 *, dr0));
188 DECLARE("DS_DR1", offsetof(struct x86_debug_state32 *, dr1));
189 DECLARE("DS_DR2", offsetof(struct x86_debug_state32 *, dr2));
190 DECLARE("DS_DR3", offsetof(struct x86_debug_state32 *, dr3));
191 DECLARE("DS_DR4", offsetof(struct x86_debug_state32 *, dr4));
192 DECLARE("DS_DR5", offsetof(struct x86_debug_state32 *, dr5));
193 DECLARE("DS_DR6", offsetof(struct x86_debug_state32 *, dr6));
194 DECLARE("DS_DR7", offsetof(struct x86_debug_state32 *, dr7));
195
196 DECLARE("DS64_DR0", offsetof(struct x86_debug_state64 *, dr0));
197 DECLARE("DS64_DR1", offsetof(struct x86_debug_state64 *, dr1));
198 DECLARE("DS64_DR2", offsetof(struct x86_debug_state64 *, dr2));
199 DECLARE("DS64_DR3", offsetof(struct x86_debug_state64 *, dr3));
200 DECLARE("DS64_DR4", offsetof(struct x86_debug_state64 *, dr4));
201 DECLARE("DS64_DR5", offsetof(struct x86_debug_state64 *, dr5));
202 DECLARE("DS64_DR6", offsetof(struct x86_debug_state64 *, dr6));
203 DECLARE("DS64_DR7", offsetof(struct x86_debug_state64 *, dr7));
204
205 DECLARE("FP_VALID", offsetof(struct x86_fpsave_state *,fp_valid));
206
207 DECLARE("SS_FLAVOR", offsetof(x86_saved_state_t *, flavor));
208 DECLARE("SS_32", x86_SAVED_STATE32);
209 DECLARE("SS_64", x86_SAVED_STATE64);
210
211 #define R_(x) offsetof(x86_saved_state_t *, ss_32.x)
212 DECLARE("R_CS", R_(cs));
213 DECLARE("R_SS", R_(ss));
214 DECLARE("R_DS", R_(ds));
215 DECLARE("R_ES", R_(es));
216 DECLARE("R_FS", R_(fs));
217 DECLARE("R_GS", R_(gs));
218 DECLARE("R_UESP", R_(uesp));
219 DECLARE("R_EBP", R_(ebp));
220 DECLARE("R_EAX", R_(eax));
221 DECLARE("R_EBX", R_(ebx));
222 DECLARE("R_ECX", R_(ecx));
223 DECLARE("R_EDX", R_(edx));
224 DECLARE("R_ESI", R_(esi));
225 DECLARE("R_EDI", R_(edi));
226 DECLARE("R_TRAPNO", R_(trapno));
227 DECLARE("R_ERR", R_(err));
228 DECLARE("R_EFLAGS", R_(efl));
229 DECLARE("R_EIP", R_(eip));
230 DECLARE("R_CR2", R_(cr2));
231 DECLARE("ISS32_SIZE", sizeof (x86_saved_state32_t));
232
233 #define R64_(x) offsetof(x86_saved_state_t *, ss_64.x)
234 DECLARE("R64_FS", R64_(fs));
235 DECLARE("R64_GS", R64_(gs));
236 DECLARE("R64_R8", R64_(r8));
237 DECLARE("R64_R9", R64_(r9));
238 DECLARE("R64_R10", R64_(r10));
239 DECLARE("R64_R11", R64_(r11));
240 DECLARE("R64_R12", R64_(r12));
241 DECLARE("R64_R13", R64_(r13));
242 DECLARE("R64_R14", R64_(r14));
243 DECLARE("R64_R15", R64_(r15));
244 DECLARE("R64_RBP", R64_(rbp));
245 DECLARE("R64_RAX", R64_(rax));
246 DECLARE("R64_RBX", R64_(rbx));
247 DECLARE("R64_RCX", R64_(rcx));
248 DECLARE("R64_RDX", R64_(rdx));
249 DECLARE("R64_RSI", R64_(rsi));
250 DECLARE("R64_RDI", R64_(rdi));
251 DECLARE("R64_V_ARG6", R64_(v_arg6));
252 DECLARE("R64_V_ARG7", R64_(v_arg7));
253 DECLARE("R64_V_ARG8", R64_(v_arg8));
254 DECLARE("R64_CS", R64_(isf.cs));
255 DECLARE("R64_SS", R64_(isf.ss));
256 DECLARE("R64_RSP", R64_(isf.rsp));
257 DECLARE("R64_TRAPNO", R64_(isf.trapno));
258 DECLARE("R64_TRAPFN", R64_(isf.trapfn));
259 DECLARE("R64_ERR", R64_(isf.err));
260 DECLARE("R64_RFLAGS", R64_(isf.rflags));
261 DECLARE("R64_RIP", R64_(isf.rip));
262 DECLARE("R64_CR2", R64_(cr2));
263 DECLARE("ISS64_OFFSET", R64_(isf));
264 DECLARE("ISS64_SIZE", sizeof (x86_saved_state64_t));
265
266 #define ISF64_(x) offsetof(x86_64_intr_stack_frame_t *, x)
267 DECLARE("ISF64_TRAPNO", ISF64_(trapno));
268 DECLARE("ISF64_TRAPFN", ISF64_(trapfn));
269 DECLARE("ISF64_ERR", ISF64_(err));
270 DECLARE("ISF64_RIP", ISF64_(rip));
271 DECLARE("ISF64_CS", ISF64_(cs));
272 DECLARE("ISF64_RFLAGS", ISF64_(rflags));
273 DECLARE("ISF64_RSP", ISF64_(rsp));
274 DECLARE("ISF64_SS", ISF64_(ss));
275 DECLARE("ISF64_SIZE", sizeof(x86_64_intr_stack_frame_t));
276
277 DECLARE("ISC32_OFFSET", offsetof(x86_saved_state_compat32_t *, isf64));
278 #define ISC32_(x) offsetof(x86_saved_state_compat32_t *, isf64.x)
279 DECLARE("ISC32_TRAPNO", ISC32_(trapno));
280 DECLARE("ISC32_TRAPFN", ISC32_(trapfn));
281 DECLARE("ISC32_ERR", ISC32_(err));
282 DECLARE("ISC32_RIP", ISC32_(rip));
283 DECLARE("ISC32_CS", ISC32_(cs));
284 DECLARE("ISC32_RFLAGS", ISC32_(rflags));
285 DECLARE("ISC32_RSP", ISC32_(rsp));
286 DECLARE("ISC32_SS", ISC32_(ss));
287
288 DECLARE("NBPG", I386_PGBYTES);
289 DECLARE("PAGE_SIZE", I386_PGBYTES);
290 DECLARE("PAGE_MASK", I386_PGBYTES-1);
291 DECLARE("PAGE_SHIFT", 12);
292 DECLARE("NKPT", NKPT);
293 DECLARE("KPTDI", KPTDI);
294 DECLARE("VM_MIN_ADDRESS", VM_MIN_ADDRESS);
295 DECLARE("VM_MAX_ADDRESS", VM_MAX_ADDRESS);
296 DECLARE("KERNELBASE", VM_MIN_KERNEL_ADDRESS);
297 DECLARE("LINEAR_KERNELBASE", LINEAR_KERNEL_ADDRESS);
298 DECLARE("KERNEL_STACK_SIZE", KERNEL_STACK_SIZE);
299 DECLARE("KERNEL_UBER_BASE_HI32", KERNEL_UBER_BASE_HI32);
300
301 DECLARE("COMM_PAGE_BASE_ADDR", _COMM_PAGE_BASE_ADDRESS);
302
303 DECLARE("PDESHIFT", PDESHIFT);
304 DECLARE("PTEMASK", PTEMASK);
305 DECLARE("PTEINDX", PTEINDX);
306 DECLARE("PTE_PFN", INTEL_PTE_PFN);
307 DECLARE("PTE_V", INTEL_PTE_VALID);
308 DECLARE("PTE_W", INTEL_PTE_WRITE);
309 DECLARE("PTE_PS", INTEL_PTE_PS);
310 DECLARE("PTE_U", INTEL_PTE_USER);
311 DECLARE("PTE_INVALID", ~INTEL_PTE_VALID);
312 DECLARE("NPGPTD", NPGPTD);
313
314 DECLARE("IDTSZ", IDTSZ);
315 DECLARE("GDTSZ", GDTSZ);
316 DECLARE("LDTSZ", LDTSZ);
317
318 DECLARE("KERNEL_CS", KERNEL_CS);
319 DECLARE("KERNEL_DS", KERNEL_DS);
320 DECLARE("USER_CS", USER_CS);
321 DECLARE("USER_DS", USER_DS);
322 DECLARE("KERNEL64_CS", KERNEL64_CS);
323 DECLARE("USER64_CS", USER64_CS);
324 DECLARE("KERNEL_TSS", KERNEL_TSS);
325 DECLARE("KERNEL_LDT", KERNEL_LDT);
326 DECLARE("DF_TSS", DF_TSS);
327 DECLARE("MC_TSS", MC_TSS);
328 #if MACH_KDB
329 DECLARE("DEBUG_TSS", DEBUG_TSS);
330 #endif /* MACH_KDB */
331 DECLARE("CPU_DATA_GS", CPU_DATA_GS);
332 DECLARE("SYSENTER_CS", SYSENTER_CS);
333 DECLARE("SYSENTER_TF_CS",SYSENTER_TF_CS);
334 DECLARE("SYSENTER_DS", SYSENTER_DS);
335 DECLARE("SYSCALL_CS", SYSCALL_CS);
336 DECLARE("USER_WINDOW_SEL", USER_WINDOW_SEL);
337 DECLARE("PHYS_WINDOW_SEL", PHYS_WINDOW_SEL);
338
339 DECLARE("CPU_THIS",
340 offsetof(cpu_data_t *, cpu_this));
341 DECLARE("CPU_ACTIVE_THREAD",
342 offsetof(cpu_data_t *, cpu_active_thread));
343 DECLARE("CPU_ACTIVE_STACK",
344 offsetof(cpu_data_t *, cpu_active_stack));
345 DECLARE("CPU_KERNEL_STACK",
346 offsetof(cpu_data_t *, cpu_kernel_stack));
347 DECLARE("CPU_INT_STACK_TOP",
348 offsetof(cpu_data_t *, cpu_int_stack_top));
349 #if MACH_RT
350 DECLARE("CPU_PREEMPTION_LEVEL",
351 offsetof(cpu_data_t *, cpu_preemption_level));
352 #endif /* MACH_RT */
353 DECLARE("CPU_INTERRUPT_LEVEL",
354 offsetof(cpu_data_t *, cpu_interrupt_level));
355 DECLARE("CPU_SIMPLE_LOCK_COUNT",
356 offsetof(cpu_data_t *,cpu_simple_lock_count));
357 DECLARE("CPU_NUMBER_GS",
358 offsetof(cpu_data_t *,cpu_number));
359 DECLARE("CPU_RUNNING",
360 offsetof(cpu_data_t *,cpu_running));
361 DECLARE("CPU_MCOUNT_OFF",
362 offsetof(cpu_data_t *,cpu_mcount_off));
363 DECLARE("CPU_PENDING_AST",
364 offsetof(cpu_data_t *,cpu_pending_ast));
365 DECLARE("CPU_DESC_TABLEP",
366 offsetof(cpu_data_t *,cpu_desc_tablep));
367 DECLARE("CPU_DESC_INDEX",
368 offsetof(cpu_data_t *,cpu_desc_index));
369 DECLARE("CDI_GDT",
370 offsetof(cpu_desc_index_t *,cdi_gdt));
371 DECLARE("CDI_IDT",
372 offsetof(cpu_desc_index_t *,cdi_idt));
373 DECLARE("CPU_PROCESSOR",
374 offsetof(cpu_data_t *,cpu_processor));
375 DECLARE("CPU_INT_STATE",
376 offsetof(cpu_data_t *, cpu_int_state));
377
378 DECLARE("CPU_HI_ISS",
379 offsetof(cpu_data_t *, cpu_hi_iss));
380 DECLARE("CPU_TASK_CR3",
381 offsetof(cpu_data_t *, cpu_task_cr3));
382 DECLARE("CPU_ACTIVE_CR3",
383 offsetof(cpu_data_t *, cpu_active_cr3));
384 DECLARE("CPU_KERNEL_CR3",
385 offsetof(cpu_data_t *, cpu_kernel_cr3));
386
387 DECLARE("CPU_IS64BIT",
388 offsetof(cpu_data_t *, cpu_is64bit));
389 DECLARE("CPU_TASK_MAP",
390 offsetof(cpu_data_t *, cpu_task_map));
391 DECLARE("TASK_MAP_32BIT", TASK_MAP_32BIT);
392 DECLARE("TASK_MAP_64BIT", TASK_MAP_64BIT);
393 DECLARE("TASK_MAP_64BIT_SHARED", TASK_MAP_64BIT_SHARED);
394 DECLARE("CPU_UBER_USER_GS_BASE",
395 offsetof(cpu_data_t *, cpu_uber.cu_user_gs_base));
396 DECLARE("CPU_UBER_ISF",
397 offsetof(cpu_data_t *, cpu_uber.cu_isf));
398 DECLARE("CPU_UBER_TMP",
399 offsetof(cpu_data_t *, cpu_uber.cu_tmp));
400 DECLARE("CPU_DR7",
401 offsetof(cpu_data_t *, cpu_dr7));
402
403 DECLARE("hwIntCnt", offsetof(cpu_data_t *,cpu_hwIntCnt));
404
405 DECLARE("enaExpTrace", enaExpTrace);
406 DECLARE("enaExpTraceb", enaExpTraceb);
407 DECLARE("enaUsrFCall", enaUsrFCall);
408 DECLARE("enaUsrFCallb", enaUsrFCallb);
409 DECLARE("enaUsrPhyMp", enaUsrPhyMp);
410 DECLARE("enaUsrPhyMpb", enaUsrPhyMpb);
411 DECLARE("enaDiagSCs", enaDiagSCs);
412 DECLARE("enaDiagSCsb", enaDiagSCsb);
413 DECLARE("enaDiagEM", enaDiagEM);
414 DECLARE("enaDiagEMb", enaDiagEMb);
415 DECLARE("enaNotifyEM", enaNotifyEM);
416 DECLARE("enaNotifyEMb", enaNotifyEMb);
417 DECLARE("dgLock", offsetof(struct diagWork *, dgLock));
418 DECLARE("dgFlags", offsetof(struct diagWork *, dgFlags));
419 DECLARE("dgMisc1", offsetof(struct diagWork *, dgMisc1));
420 DECLARE("dgMisc2", offsetof(struct diagWork *, dgMisc2));
421 DECLARE("dgMisc3", offsetof(struct diagWork *, dgMisc3));
422 DECLARE("dgMisc4", offsetof(struct diagWork *, dgMisc4));
423 DECLARE("dgMisc5", offsetof(struct diagWork *, dgMisc5));
424
425 DECLARE("INTEL_PTE_KERNEL", INTEL_PTE_VALID|INTEL_PTE_WRITE);
426 DECLARE("PTDPTDI", PTDPTDI);
427 DECLARE("PDESHIFT", PDESHIFT);
428 DECLARE("PDESIZE", PDESIZE);
429 DECLARE("PTESIZE", PTESIZE);
430 DECLARE("APTDPTDI", APTDPTDI);
431 DECLARE("HIGH_MEM_BASE", HIGH_MEM_BASE);
432 DECLARE("HIGH_IDT_BASE", pmap_index_to_virt(HIGH_FIXED_IDT));
433
434 DECLARE("KERNELBASEPDE",
435 (LINEAR_KERNEL_ADDRESS >> PDESHIFT) *
436 sizeof(pt_entry_t));
437
438 DECLARE("TSS_ESP0", offsetof(struct i386_tss *, esp0));
439 DECLARE("TSS_SS0", offsetof(struct i386_tss *, ss0));
440 DECLARE("TSS_LDT", offsetof(struct i386_tss *, ldt));
441 DECLARE("TSS_PDBR", offsetof(struct i386_tss *, cr3));
442 DECLARE("TSS_LINK", offsetof(struct i386_tss *, back_link));
443
444 DECLARE("K_TASK_GATE", ACC_P|ACC_PL_K|ACC_TASK_GATE);
445 DECLARE("K_TRAP_GATE", ACC_P|ACC_PL_K|ACC_TRAP_GATE);
446 DECLARE("U_TRAP_GATE", ACC_P|ACC_PL_U|ACC_TRAP_GATE);
447 DECLARE("K_INTR_GATE", ACC_P|ACC_PL_K|ACC_INTR_GATE);
448 DECLARE("U_INTR_GATE", ACC_P|ACC_PL_U|ACC_INTR_GATE);
449 DECLARE("K_TSS", ACC_P|ACC_PL_K|ACC_TSS);
450
451 /*
452 * usimple_lock fields
453 */
454 DECLARE("USL_INTERLOCK", offsetof(usimple_lock_t, interlock));
455
456 DECLARE("INTSTACK_SIZE", INTSTACK_SIZE);
457 DECLARE("TIMER_LOW", offsetof(struct timer *, low_bits));
458 DECLARE("TIMER_HIGH", offsetof(struct timer *, high_bits));
459 DECLARE("TIMER_HIGHCHK", offsetof(struct timer *, high_bits_check));
460 DECLARE("KADDR", offsetof(struct boot_args *, kaddr));
461 DECLARE("KSIZE", offsetof(struct boot_args *, ksize));
462 DECLARE("MEMORYMAP", offsetof(struct boot_args *, MemoryMap));
463 DECLARE("DEVICETREEP", offsetof(struct boot_args *, deviceTreeP));
464
465 DECLARE("RNT_TSC_BASE",
466 offsetof(rtc_nanotime_t *, tsc_base));
467 DECLARE("RNT_NS_BASE",
468 offsetof(rtc_nanotime_t *, ns_base));
469 DECLARE("RNT_SCALE",
470 offsetof(rtc_nanotime_t *, scale));
471 DECLARE("RNT_SHIFT",
472 offsetof(rtc_nanotime_t *, shift));
473
474 /* values from kern/timer.h */
475 DECLARE("TIMER_LOW",
476 offsetof(struct timer *, low_bits));
477 DECLARE("TIMER_HIGH",
478 offsetof(struct timer *, high_bits));
479 DECLARE("TIMER_HIGHCHK",
480 offsetof(struct timer *, high_bits_check));
481 #if !STAT_TIME
482 DECLARE("TIMER_TSTAMP",
483 offsetof(struct timer *, tstamp));
484
485 DECLARE("CURRENT_TIMER",
486 offsetof(struct processor *, processor_data.current_timer));
487 #endif
488 DECLARE("SYSTEM_TIMER",
489 offsetof(struct thread *, system_timer));
490 DECLARE("USER_TIMER",
491 offsetof(struct thread *, user_timer));
492
493 DECLARE("OnProc", OnProc);
494
495
496 DECLARE("GCAP_ID", offsetof(hpetReg_t *, GCAP_ID));
497 DECLARE("GEN_CONF", offsetof(hpetReg_t *, GEN_CONF));
498 DECLARE("GINTR_STA", offsetof(hpetReg_t *, GINTR_STA));
499 DECLARE("MAIN_CNT", offsetof(hpetReg_t *, MAIN_CNT));
500 DECLARE("TIM0_CONF", offsetof(hpetReg_t *, TIM0_CONF));
501 DECLARE("TIM_CONF", TIM_CONF);
502 DECLARE("Tn_INT_ENB_CNF", Tn_INT_ENB_CNF);
503 DECLARE("TIM0_COMP", offsetof(hpetReg_t *, TIM0_COMP));
504 DECLARE("TIM_COMP", TIM_COMP);
505 DECLARE("TIM1_CONF", offsetof(hpetReg_t *, TIM1_CONF));
506 DECLARE("TIM1_COMP", offsetof(hpetReg_t *, TIM1_COMP));
507 DECLARE("TIM2_CONF", offsetof(hpetReg_t *, TIM2_CONF));
508 DECLARE("TIM2_COMP", offsetof(hpetReg_t *, TIM2_COMP));
509
510 return (0);
511 }