180709Sjake/*- 280709Sjake * Copyright (c) 2001 Jake Burkholder. 380709Sjake * All rights reserved. 480709Sjake * 580709Sjake * Redistribution and use in source and binary forms, with or without 680709Sjake * modification, are permitted provided that the following conditions 780709Sjake * are met: 880709Sjake * 1. Redistributions of source code must retain the above copyright 980709Sjake * notice, this list of conditions and the following disclaimer. 1080709Sjake * 2. Redistributions in binary form must reproduce the above copyright 1180709Sjake * notice, this list of conditions and the following disclaimer in the 1280709Sjake * documentation and/or other materials provided with the distribution. 1380709Sjake * 1481337Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1580709Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1680709Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1781337Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1880709Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1980709Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2080709Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2180709Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2280709Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2380709Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2480709Sjake * SUCH DAMAGE. 2580709Sjake * 2680709Sjake * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 2780709Sjake */ 2880709Sjake 29145153Smarius#include <sys/cdefs.h> 30145153Smarius__FBSDID("$FreeBSD$"); 31145153Smarius 32118239Speter#include "opt_kstack_pages.h" 33118239Speter 3480709Sjake#include <sys/param.h> 3580709Sjake#include <sys/assym.h> 3682910Sjake#include <sys/ktr.h> 3780709Sjake#include <sys/proc.h> 3891783Sjake#include <sys/smp.h> 3984186Sjake#include <sys/vmmeter.h> 40222813Sattilio#include <sys/_cpuset.h> 4180709Sjake 42254065Skib#include <machine/atomic.h> 4380709Sjake#include <vm/vm.h> 4481381Sjake#include <vm/vm_page.h> 4581381Sjake#include <vm/vm_map.h> 4680709Sjake 4797001Sjake#include <machine/cache.h> 4880709Sjake#include <machine/pcb.h> 4980709Sjake#include <machine/setjmp.h> 5089052Sjake#include <machine/smp.h> 51166105Smarius#include <machine/tlb.h> 5280709Sjake#include <machine/tte.h> 53166105Smarius#include <machine/vmparam.h> 5480709Sjake 5583756SjakeASSYM(KERNBASE, KERNBASE); 5683756Sjake 5783366SjulianASSYM(KSTACK_PAGES, KSTACK_PAGES); 5891360SjakeASSYM(PCPU_PAGES, PCPU_PAGES); 5980709Sjake 6091224SjakeASSYM(TAR_VPN_SHIFT, TAR_VPN_SHIFT); 6191224Sjake 62222813SattilioASSYM(_NCPUBITS, _NCPUBITS); 63222813Sattilio 64182768SmariusASSYM(TLB_DEMAP_ALL, TLB_DEMAP_ALL); 65182768SmariusASSYM(TLB_DEMAP_CONTEXT, TLB_DEMAP_CONTEXT); 6681381SjakeASSYM(TLB_DEMAP_NUCLEUS, TLB_DEMAP_NUCLEUS); 67182768SmariusASSYM(TLB_DEMAP_PAGE, TLB_DEMAP_PAGE); 6891783SjakeASSYM(TLB_DEMAP_PRIMARY, TLB_DEMAP_PRIMARY); 6981381Sjake 7091336SjakeASSYM(INT_SHIFT, INT_SHIFT); 7191336SjakeASSYM(PTR_SHIFT, PTR_SHIFT); 7291336Sjake 7380709SjakeASSYM(PAGE_SHIFT, PAGE_SHIFT); 74102040SjakeASSYM(PAGE_SHIFT_8K, PAGE_SHIFT_8K); 75102040SjakeASSYM(PAGE_SHIFT_4M, PAGE_SHIFT_4M); 76102040SjakeASSYM(PAGE_SIZE, PAGE_SIZE); 77163146SkmacyASSYM(PAGE_SIZE_4M, PAGE_SIZE_4M); 7880709Sjake 79183142Smarius#ifdef SMP 8091783SjakeASSYM(CSA_PCPU, offsetof(struct cpu_start_args, csa_pcpu)); 8189052SjakeASSYM(CSA_STATE, offsetof(struct cpu_start_args, csa_state)); 82182730SmariusASSYM(CSA_MID, offsetof(struct cpu_start_args, csa_mid)); 83182730SmariusASSYM(CSA_STICK, offsetof(struct cpu_start_args, csa_stick)); 8491617SjakeASSYM(CSA_TICK, offsetof(struct cpu_start_args, csa_tick)); 85182730SmariusASSYM(CSA_TTES, offsetof(struct cpu_start_args, csa_ttes)); 8691617SjakeASSYM(CSA_VER, offsetof(struct cpu_start_args, csa_ver)); 87166105Smarius#endif 8897001Sjake 8997001SjakeASSYM(DC_SIZE, offsetof(struct cacheinfo, dc_size)); 9097001SjakeASSYM(DC_LINESIZE, offsetof(struct cacheinfo, dc_linesize)); 9197001SjakeASSYM(IC_SIZE, offsetof(struct cacheinfo, ic_size)); 9297001SjakeASSYM(IC_LINESIZE, offsetof(struct cacheinfo, ic_linesize)); 9397001Sjake 9482910SjakeASSYM(KTR_SIZEOF, sizeof(struct ktr_entry)); 9593949SjakeASSYM(KTR_LINE, offsetof(struct ktr_entry, ktr_line)); 9693949SjakeASSYM(KTR_FILE, offsetof(struct ktr_entry, ktr_file)); 9782910SjakeASSYM(KTR_DESC, offsetof(struct ktr_entry, ktr_desc)); 9892199SjakeASSYM(KTR_CPU, offsetof(struct ktr_entry, ktr_cpu)); 9993503SjakeASSYM(KTR_TIMESTAMP, offsetof(struct ktr_entry, ktr_timestamp)); 10093503SjakeASSYM(KTR_PARM1, offsetof(struct ktr_entry, ktr_parms[0])); 10193503SjakeASSYM(KTR_PARM2, offsetof(struct ktr_entry, ktr_parms[1])); 10293503SjakeASSYM(KTR_PARM3, offsetof(struct ktr_entry, ktr_parms[2])); 10393503SjakeASSYM(KTR_PARM4, offsetof(struct ktr_entry, ktr_parms[3])); 10493503SjakeASSYM(KTR_PARM5, offsetof(struct ktr_entry, ktr_parms[4])); 10593503SjakeASSYM(KTR_PARM6, offsetof(struct ktr_entry, ktr_parms[5])); 10682910Sjake 107163146SkmacyASSYM(TTE_SHIFT, TTE_SHIFT); 10891224SjakeASSYM(TTE_VPN, offsetof(struct tte, tte_vpn)); 10980709SjakeASSYM(TTE_DATA, offsetof(struct tte, tte_data)); 11080709Sjake 111182916SmariusASSYM(TD_V, TD_V); 11281614SjakeASSYM(TD_EXEC, TD_EXEC); 11380709SjakeASSYM(TD_REF, TD_REF); 11488657SjakeASSYM(TD_SW, TD_SW); 115182916SmariusASSYM(TD_L, TD_L); 116100771SjakeASSYM(TD_CP, TD_CP); 117100771SjakeASSYM(TD_CV, TD_CV); 11880709SjakeASSYM(TD_W, TD_W); 11980709Sjake 120102040SjakeASSYM(TS_MIN, TS_MIN); 121102040SjakeASSYM(TS_MAX, TS_MAX); 122182916SmariusASSYM(TLB_DAR_SLOT_SHIFT, TLB_DAR_SLOT_SHIFT); 123205258SmariusASSYM(TLB_CXR_PGSZ_MASK, TLB_CXR_PGSZ_MASK); 124216803SmariusASSYM(TLB_DIRECT_ADDRESS_MASK, TLB_DIRECT_ADDRESS_MASK); 125163146SkmacyASSYM(TLB_DIRECT_TO_TTE_MASK, TLB_DIRECT_TO_TTE_MASK); 126102040SjakeASSYM(TV_SIZE_BITS, TV_SIZE_BITS); 127166105Smarius 12884186SjakeASSYM(V_INTR, offsetof(struct vmmeter, v_intr)); 12984186Sjake 130210176SmavASSYM(MAXCOMLEN, MAXCOMLEN); 13187702SjhbASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread)); 13287702SjhbASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb)); 13387702SjhbASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid)); 13497265SjakeASSYM(PC_IRHEAD, offsetof(struct pcpu, pc_irhead)); 13597265SjakeASSYM(PC_IRTAIL, offsetof(struct pcpu, pc_irtail)); 13697265SjakeASSYM(PC_IRFREE, offsetof(struct pcpu, pc_irfree)); 137163146SkmacyASSYM(PC_CNT, offsetof(struct pcpu, pc_cnt)); 138163146SkmacyASSYM(PC_SIZEOF, sizeof(struct pcpu)); 139163146Skmacy 140182689SmariusASSYM(PC_CACHE, offsetof(struct pcpu, pc_cache)); 14189052SjakeASSYM(PC_MID, offsetof(struct pcpu, pc_mid)); 142182689SmariusASSYM(PC_PMAP, offsetof(struct pcpu, pc_pmap)); 14391613SjakeASSYM(PC_TLB_CTX, offsetof(struct pcpu, pc_tlb_ctx)); 14491613SjakeASSYM(PC_TLB_CTX_MAX, offsetof(struct pcpu, pc_tlb_ctx_max)); 14591613SjakeASSYM(PC_TLB_CTX_MIN, offsetof(struct pcpu, pc_tlb_ctx_min)); 14680709Sjake 14797265SjakeASSYM(IR_NEXT, offsetof(struct intr_request, ir_next)); 14897265SjakeASSYM(IR_FUNC, offsetof(struct intr_request, ir_func)); 14997265SjakeASSYM(IR_ARG, offsetof(struct intr_request, ir_arg)); 15097265SjakeASSYM(IR_PRI, offsetof(struct intr_request, ir_pri)); 15197265SjakeASSYM(IR_VEC, offsetof(struct intr_request, ir_vec)); 15281614Sjake 153225900Smarius#ifdef SMP 154211073SmariusASSYM(ICA_PA, offsetof(struct ipi_cache_args, ica_pa)); 155211073Smarius 156211071SmariusASSYM(IRA_MASK, offsetof(struct ipi_rd_args, ira_mask)); 157211071SmariusASSYM(IRA_VAL, offsetof(struct ipi_rd_args, ira_val)); 158211071Smarius 15992199SjakeASSYM(ITA_MASK, offsetof(struct ipi_tlb_args, ita_mask)); 16091783SjakeASSYM(ITA_PMAP, offsetof(struct ipi_tlb_args, ita_pmap)); 16189052SjakeASSYM(ITA_START, offsetof(struct ipi_tlb_args, ita_start)); 16289052SjakeASSYM(ITA_END, offsetof(struct ipi_tlb_args, ita_end)); 16389052SjakeASSYM(ITA_VA, offsetof(struct ipi_tlb_args, ita_va)); 164183142Smarius#endif 16589052Sjake 16681614SjakeASSYM(IV_FUNC, offsetof(struct intr_vector, iv_func)); 16781614SjakeASSYM(IV_ARG, offsetof(struct intr_vector, iv_arg)); 16881614SjakeASSYM(IV_PRI, offsetof(struct intr_vector, iv_pri)); 16981614Sjake 170111032SjulianASSYM(TDF_ASTPENDING, TDF_ASTPENDING); 171111032SjulianASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED); 17282910Sjake 17388788SjakeASSYM(MD_UTRAP, offsetof(struct mdproc, md_utrap)); 17488788Sjake 17582910SjakeASSYM(P_COMM, offsetof(struct proc, p_comm)); 17688657SjakeASSYM(P_MD, offsetof(struct proc, p_md)); 17788657SjakeASSYM(P_PID, offsetof(struct proc, p_pid)); 17880709SjakeASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace)); 17980709Sjake 180111032SjulianASSYM(TD_FLAGS, offsetof(struct thread, td_flags)); 18183366SjulianASSYM(TD_FRAME, offsetof(struct thread, td_frame)); 18283366SjulianASSYM(TD_KSTACK, offsetof(struct thread, td_kstack)); 183203185SmariusASSYM(TD_LOCK, offsetof(struct thread, td_lock)); 18483366SjulianASSYM(TD_PCB, offsetof(struct thread, td_pcb)); 18583366SjulianASSYM(TD_PROC, offsetof(struct thread, td_proc)); 186163146SkmacyASSYM(TD_MD, offsetof(struct thread, td_md)); 187163146SkmacyASSYM(MD_SAVED_PIL, offsetof(struct mdthread, md_saved_pil)); 18883366Sjulian 18984186SjakeASSYM(PCB_SIZEOF, sizeof(struct pcb)); 190113023SjakeASSYM(PCB_RW, offsetof(struct pcb, pcb_rw)); 191113023SjakeASSYM(PCB_KFP, offsetof(struct pcb, pcb_kfp)); 192112920SjakeASSYM(PCB_UFP, offsetof(struct pcb, pcb_ufp)); 193113023SjakeASSYM(PCB_RWSP, offsetof(struct pcb, pcb_rwsp)); 194112924SjakeASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags)); 19582910SjakeASSYM(PCB_NSAVED, offsetof(struct pcb, pcb_nsaved)); 196113023SjakeASSYM(PCB_PC, offsetof(struct pcb, pcb_pc)); 197113023SjakeASSYM(PCB_SP, offsetof(struct pcb, pcb_sp)); 198163965SkmacyASSYM(PCB_PAD, offsetof(struct pcb, pcb_pad)); 199163146Skmacy 20081381SjakeASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap)); 20188657SjakeASSYM(PM_ACTIVE, offsetof(struct pmap, pm_active)); 20281381SjakeASSYM(PM_CONTEXT, offsetof(struct pmap, pm_context)); 20388657SjakeASSYM(PM_TSB, offsetof(struct pmap, pm_tsb)); 20481381Sjake 20588657SjakeASSYM(_JB_FP, offsetof(struct _jmp_buf, _jb[_JB_FP])); 20688657SjakeASSYM(_JB_PC, offsetof(struct _jmp_buf, _jb[_JB_PC])); 20788657SjakeASSYM(_JB_SP, offsetof(struct _jmp_buf, _jb[_JB_SP])); 20888657SjakeASSYM(_JB_SIGFLAG, offsetof(struct _jmp_buf, _jb[_JB_SIGFLAG])); 20988657SjakeASSYM(_JB_SIGMASK, offsetof(struct _jmp_buf, _jb[_JB_SIGMASK])); 21080709Sjake 21180709SjakeASSYM(TF_G0, offsetof(struct trapframe, tf_global[0])); 21280709SjakeASSYM(TF_G1, offsetof(struct trapframe, tf_global[1])); 21380709SjakeASSYM(TF_G2, offsetof(struct trapframe, tf_global[2])); 21480709SjakeASSYM(TF_G3, offsetof(struct trapframe, tf_global[3])); 21580709SjakeASSYM(TF_G4, offsetof(struct trapframe, tf_global[4])); 21680709SjakeASSYM(TF_G5, offsetof(struct trapframe, tf_global[5])); 21780709SjakeASSYM(TF_G6, offsetof(struct trapframe, tf_global[6])); 21880709SjakeASSYM(TF_G7, offsetof(struct trapframe, tf_global[7])); 21980709SjakeASSYM(TF_O0, offsetof(struct trapframe, tf_out[0])); 22080709SjakeASSYM(TF_O1, offsetof(struct trapframe, tf_out[1])); 22180709SjakeASSYM(TF_O2, offsetof(struct trapframe, tf_out[2])); 22280709SjakeASSYM(TF_O3, offsetof(struct trapframe, tf_out[3])); 22380709SjakeASSYM(TF_O4, offsetof(struct trapframe, tf_out[4])); 22480709SjakeASSYM(TF_O5, offsetof(struct trapframe, tf_out[5])); 22580709SjakeASSYM(TF_O6, offsetof(struct trapframe, tf_out[6])); 22680709SjakeASSYM(TF_O7, offsetof(struct trapframe, tf_out[7])); 227105733SjakeASSYM(TF_FPRS, offsetof(struct trapframe, tf_fprs)); 22888657SjakeASSYM(TF_FSR, offsetof(struct trapframe, tf_fsr)); 229105733SjakeASSYM(TF_GSR, offsetof(struct trapframe, tf_gsr)); 230163146SkmacyASSYM(TF_PIL, offsetof(struct trapframe, tf_pil)); 231105733SjakeASSYM(TF_LEVEL, offsetof(struct trapframe, tf_level)); 23288657SjakeASSYM(TF_SFAR, offsetof(struct trapframe, tf_sfar)); 233105733SjakeASSYM(TF_SFSR, offsetof(struct trapframe, tf_sfsr)); 23488657SjakeASSYM(TF_TAR, offsetof(struct trapframe, tf_tar)); 235163152SkmacyASSYM(TF_TYPE, offsetof(struct trapframe, tf_type)); 236163152SkmacyASSYM(TF_Y, offsetof(struct trapframe, tf_y)); 23788657SjakeASSYM(TF_TNPC, offsetof(struct trapframe, tf_tnpc)); 23888657SjakeASSYM(TF_TPC, offsetof(struct trapframe, tf_tpc)); 23980709SjakeASSYM(TF_TSTATE, offsetof(struct trapframe, tf_tstate)); 24082910SjakeASSYM(TF_WSTATE, offsetof(struct trapframe, tf_wstate)); 24180709SjakeASSYM(TF_SIZEOF, sizeof(struct trapframe)); 24288788Sjake 243163146SkmacyASSYM(VM_MIN_DIRECT_ADDRESS, VM_MIN_DIRECT_ADDRESS); 244163146SkmacyASSYM(VM_MIN_PROM_ADDRESS, VM_MIN_PROM_ADDRESS); 245163146SkmacyASSYM(VM_MAX_PROM_ADDRESS, VM_MAX_PROM_ADDRESS); 246