genassym.c revision 211073
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: head/sys/sparc64/sparc64/genassym.c 211073 2010-08-08 14:37:16Z marius $"); 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> 4080709Sjake 4180709Sjake#include <vm/vm.h> 4281381Sjake#include <vm/vm_page.h> 4381381Sjake#include <vm/vm_map.h> 4480709Sjake 45166105Smarius#ifdef SUN4U 4697001Sjake#include <machine/cache.h> 47166105Smarius#endif 48166105Smarius#ifdef SUN4V 49166105Smarius#include <machine/mmu.h> 50166105Smarius#endif 5180709Sjake#include <machine/pcb.h> 5280709Sjake#include <machine/setjmp.h> 5389052Sjake#include <machine/smp.h> 54166105Smarius#include <machine/tlb.h> 5580709Sjake#include <machine/tte.h> 56163146Skmacy#ifdef SUN4V 57163965Skmacy#include <machine/trap.h> 58163146Skmacy#include <machine/tte_hash.h> 59163146Skmacy#endif 60166105Smarius#include <machine/vmparam.h> 6180709Sjake 6283756SjakeASSYM(KERNBASE, KERNBASE); 6383756Sjake 6483366SjulianASSYM(KSTACK_PAGES, KSTACK_PAGES); 6591360SjakeASSYM(PCPU_PAGES, PCPU_PAGES); 6680709Sjake 6791224SjakeASSYM(TAR_VPN_SHIFT, TAR_VPN_SHIFT); 6891224Sjake 69182768Smarius#ifdef SUN4U 70182768SmariusASSYM(TLB_DEMAP_ALL, TLB_DEMAP_ALL); 71182768Smarius#endif 72182768SmariusASSYM(TLB_DEMAP_CONTEXT, TLB_DEMAP_CONTEXT); 7381381SjakeASSYM(TLB_DEMAP_NUCLEUS, TLB_DEMAP_NUCLEUS); 74182768SmariusASSYM(TLB_DEMAP_PAGE, TLB_DEMAP_PAGE); 7591783SjakeASSYM(TLB_DEMAP_PRIMARY, TLB_DEMAP_PRIMARY); 7681381Sjake 7791336SjakeASSYM(INT_SHIFT, INT_SHIFT); 7891336SjakeASSYM(PTR_SHIFT, PTR_SHIFT); 7991336Sjake 8080709SjakeASSYM(PAGE_SHIFT, PAGE_SHIFT); 81102040SjakeASSYM(PAGE_SHIFT_8K, PAGE_SHIFT_8K); 82102040SjakeASSYM(PAGE_SHIFT_4M, PAGE_SHIFT_4M); 83102040SjakeASSYM(PAGE_SIZE, PAGE_SIZE); 84163146SkmacyASSYM(PAGE_SIZE_4M, PAGE_SIZE_4M); 8580709Sjake 86183142Smarius#ifdef SMP 8791783SjakeASSYM(CSA_PCPU, offsetof(struct cpu_start_args, csa_pcpu)); 8889052SjakeASSYM(CSA_STATE, offsetof(struct cpu_start_args, csa_state)); 89166105Smarius#ifdef SUN4U 90182730SmariusASSYM(CSA_MID, offsetof(struct cpu_start_args, csa_mid)); 91182730SmariusASSYM(CSA_STICK, offsetof(struct cpu_start_args, csa_stick)); 9291617SjakeASSYM(CSA_TICK, offsetof(struct cpu_start_args, csa_tick)); 93182730SmariusASSYM(CSA_TTES, offsetof(struct cpu_start_args, csa_ttes)); 9491617SjakeASSYM(CSA_VER, offsetof(struct cpu_start_args, csa_ver)); 95166105Smarius#endif 96166105Smarius#ifdef SUN4V 97163152SkmacyASSYM(CSA_CPUID, offsetof(struct cpu_start_args, csa_cpuid)); 98163146Skmacy#endif 99183142Smarius#endif 10097001Sjake 101166105Smarius#ifdef SUN4U 10297001SjakeASSYM(DC_SIZE, offsetof(struct cacheinfo, dc_size)); 10397001SjakeASSYM(DC_LINESIZE, offsetof(struct cacheinfo, dc_linesize)); 10497001SjakeASSYM(IC_SIZE, offsetof(struct cacheinfo, ic_size)); 10597001SjakeASSYM(IC_LINESIZE, offsetof(struct cacheinfo, ic_linesize)); 106166105Smarius#endif 10797001Sjake 10882910SjakeASSYM(KTR_SIZEOF, sizeof(struct ktr_entry)); 10993949SjakeASSYM(KTR_LINE, offsetof(struct ktr_entry, ktr_line)); 11093949SjakeASSYM(KTR_FILE, offsetof(struct ktr_entry, ktr_file)); 11182910SjakeASSYM(KTR_DESC, offsetof(struct ktr_entry, ktr_desc)); 11292199SjakeASSYM(KTR_CPU, offsetof(struct ktr_entry, ktr_cpu)); 11393503SjakeASSYM(KTR_TIMESTAMP, offsetof(struct ktr_entry, ktr_timestamp)); 11493503SjakeASSYM(KTR_PARM1, offsetof(struct ktr_entry, ktr_parms[0])); 11593503SjakeASSYM(KTR_PARM2, offsetof(struct ktr_entry, ktr_parms[1])); 11693503SjakeASSYM(KTR_PARM3, offsetof(struct ktr_entry, ktr_parms[2])); 11793503SjakeASSYM(KTR_PARM4, offsetof(struct ktr_entry, ktr_parms[3])); 11893503SjakeASSYM(KTR_PARM5, offsetof(struct ktr_entry, ktr_parms[4])); 11993503SjakeASSYM(KTR_PARM6, offsetof(struct ktr_entry, ktr_parms[5])); 12082910Sjake 121163146SkmacyASSYM(TTE_SHIFT, TTE_SHIFT); 122166105Smarius#ifdef SUN4U 12391224SjakeASSYM(TTE_VPN, offsetof(struct tte, tte_vpn)); 12480709SjakeASSYM(TTE_DATA, offsetof(struct tte, tte_data)); 12580709Sjake 126182916SmariusASSYM(TD_V, TD_V); 12781614SjakeASSYM(TD_EXEC, TD_EXEC); 12880709SjakeASSYM(TD_REF, TD_REF); 12988657SjakeASSYM(TD_SW, TD_SW); 130182916SmariusASSYM(TD_L, TD_L); 131100771SjakeASSYM(TD_CP, TD_CP); 132100771SjakeASSYM(TD_CV, TD_CV); 13380709SjakeASSYM(TD_W, TD_W); 13480709Sjake 135102040SjakeASSYM(TS_MIN, TS_MIN); 136102040SjakeASSYM(TS_MAX, TS_MAX); 137182916SmariusASSYM(TLB_DAR_SLOT_SHIFT, TLB_DAR_SLOT_SHIFT); 138205258SmariusASSYM(TLB_CXR_PGSZ_MASK, TLB_CXR_PGSZ_MASK); 139163146SkmacyASSYM(TLB_DIRECT_TO_TTE_MASK, TLB_DIRECT_TO_TTE_MASK); 140102040SjakeASSYM(TV_SIZE_BITS, TV_SIZE_BITS); 141166105Smarius#endif 142166105Smarius 143166105Smarius#ifdef SUN4V 144163146SkmacyASSYM(VTD_REF, VTD_REF); 145163146SkmacyASSYM(VTD_W, VTD_W); 146163146SkmacyASSYM(VTD_SW_W, VTD_SW_W); 147163146SkmacyASSYM(VTD_LOCK, VTD_LOCK); 148102040Sjake 149163146SkmacyASSYM(THE_SHIFT, THE_SHIFT); 150163146SkmacyASSYM(PM_HASHSCRATCH, offsetof(struct pmap, pm_hashscratch)); 151163146SkmacyASSYM(PM_TSBSCRATCH, offsetof(struct pmap, pm_tsbscratch)); 152163146SkmacyASSYM(PM_TSB_RA, offsetof(struct pmap, pm_tsb_ra)); 153163146SkmacyASSYM(PM_TLBACTIVE, offsetof(struct pmap, pm_tlbactive)); 154163146SkmacyASSYM(HASH_ENTRY_SHIFT, HASH_ENTRY_SHIFT); 155163146Skmacy#endif 156163146Skmacy 15784186SjakeASSYM(V_INTR, offsetof(struct vmmeter, v_intr)); 15884186Sjake 159210176SmavASSYM(MAXCOMLEN, MAXCOMLEN); 16087702SjhbASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread)); 16187702SjhbASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb)); 16287702SjhbASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid)); 16391337SjakeASSYM(PC_CPUMASK, offsetof(struct pcpu, pc_cpumask)); 16497265SjakeASSYM(PC_IRHEAD, offsetof(struct pcpu, pc_irhead)); 16597265SjakeASSYM(PC_IRTAIL, offsetof(struct pcpu, pc_irtail)); 16697265SjakeASSYM(PC_IRFREE, offsetof(struct pcpu, pc_irfree)); 167163146SkmacyASSYM(PC_CNT, offsetof(struct pcpu, pc_cnt)); 168163146SkmacyASSYM(PC_SIZEOF, sizeof(struct pcpu)); 169163146Skmacy 170163146Skmacy#ifdef SUN4V 171163146SkmacyASSYM(PC_CPU_Q_RA, offsetof(struct pcpu, pc_cpu_q_ra)); 172163146SkmacyASSYM(PC_CPU_Q_SIZE, offsetof(struct pcpu, pc_cpu_q_size)); 173163146SkmacyASSYM(PC_DEV_Q_RA, offsetof(struct pcpu, pc_dev_q_ra)); 174163146SkmacyASSYM(PC_DEV_Q_SIZE, offsetof(struct pcpu, pc_dev_q_size)); 175163146Skmacy 176163146SkmacyASSYM(PC_RQ_BASE, offsetof(struct pcpu, pc_rq_ra)); 177163146SkmacyASSYM(PC_RQ_SIZE, offsetof(struct pcpu, pc_rq_size)); 178163146SkmacyASSYM(PC_NRQ_BASE, offsetof(struct pcpu, pc_nrq_ra)); 179163146SkmacyASSYM(PC_NRQ_SIZE, offsetof(struct pcpu, pc_nrq_size)); 180163146SkmacyASSYM(PC_MONDO_DATA, offsetof(struct pcpu, pc_mondo_data)); 181163146SkmacyASSYM(PC_MONDO_DATA_RA, offsetof(struct pcpu, pc_mondo_data_ra)); 182163146Skmacy 183163146SkmacyASSYM(PC_KWBUF_FULL, offsetof(struct pcpu, pc_kwbuf_full)); 184163146SkmacyASSYM(PC_KWBUF_SP, offsetof(struct pcpu, pc_kwbuf_sp)); 185163146SkmacyASSYM(PC_KWBUF, offsetof(struct pcpu, pc_kwbuf)); 186163146SkmacyASSYM(PC_PAD, offsetof(struct pcpu, pad)); 187163146SkmacyASSYM(PC_PMAP, offsetof(struct pcpu, pc_curpmap)); 188163146SkmacyASSYM(PC_TSBWBUF, offsetof(struct pcpu, pc_tsbwbuf)); 189163146Skmacy 190163146SkmacyASSYM(PCB_KSTACK, offsetof(struct pcb, pcb_kstack)); 191164737SkmacyASSYM(PCB_TSTATE, offsetof(struct pcb, pcb_tstate)); 192164737SkmacyASSYM(PCB_TPC, offsetof(struct pcb, pcb_tpc)); 193164737SkmacyASSYM(PCB_TNPC, offsetof(struct pcb, pcb_tnpc)); 194164737SkmacyASSYM(PCB_TT, offsetof(struct pcb, pcb_tt)); 195164737SkmacyASSYM(PCB_SFAR, offsetof(struct pcb, pcb_sfar)); 196164485SkmacyASSYM(PM_TSB_MISS_COUNT, offsetof(struct pmap, pm_tsb_miss_count)); 197164485SkmacyASSYM(PM_TSB_CAP_MISS_COUNT, offsetof(struct pmap, pm_tsb_cap_miss_count)); 198166105Smarius#endif 199166105Smarius#ifdef SUN4U 200182689SmariusASSYM(PC_CACHE, offsetof(struct pcpu, pc_cache)); 20189052SjakeASSYM(PC_MID, offsetof(struct pcpu, pc_mid)); 202182689SmariusASSYM(PC_PMAP, offsetof(struct pcpu, pc_pmap)); 20391613SjakeASSYM(PC_TLB_CTX, offsetof(struct pcpu, pc_tlb_ctx)); 20491613SjakeASSYM(PC_TLB_CTX_MAX, offsetof(struct pcpu, pc_tlb_ctx_max)); 20591613SjakeASSYM(PC_TLB_CTX_MIN, offsetof(struct pcpu, pc_tlb_ctx_min)); 206166105Smarius#endif 20780709Sjake 20897265SjakeASSYM(IR_NEXT, offsetof(struct intr_request, ir_next)); 20997265SjakeASSYM(IR_FUNC, offsetof(struct intr_request, ir_func)); 21097265SjakeASSYM(IR_ARG, offsetof(struct intr_request, ir_arg)); 21197265SjakeASSYM(IR_PRI, offsetof(struct intr_request, ir_pri)); 21297265SjakeASSYM(IR_VEC, offsetof(struct intr_request, ir_vec)); 21381614Sjake 214211073Smarius#if defined(SUN4U) && defined(SMP) 215211073SmariusASSYM(ICA_PA, offsetof(struct ipi_cache_args, ica_pa)); 216211073Smarius 217211071SmariusASSYM(IRA_MASK, offsetof(struct ipi_rd_args, ira_mask)); 218211071SmariusASSYM(IRA_VAL, offsetof(struct ipi_rd_args, ira_val)); 219211071Smarius 22092199SjakeASSYM(ITA_MASK, offsetof(struct ipi_tlb_args, ita_mask)); 22191783SjakeASSYM(ITA_PMAP, offsetof(struct ipi_tlb_args, ita_pmap)); 22289052SjakeASSYM(ITA_START, offsetof(struct ipi_tlb_args, ita_start)); 22389052SjakeASSYM(ITA_END, offsetof(struct ipi_tlb_args, ita_end)); 22489052SjakeASSYM(ITA_VA, offsetof(struct ipi_tlb_args, ita_va)); 225183142Smarius#endif 22689052Sjake 22781614SjakeASSYM(IV_FUNC, offsetof(struct intr_vector, iv_func)); 22881614SjakeASSYM(IV_ARG, offsetof(struct intr_vector, iv_arg)); 22981614SjakeASSYM(IV_PRI, offsetof(struct intr_vector, iv_pri)); 23081614Sjake 231111032SjulianASSYM(TDF_ASTPENDING, TDF_ASTPENDING); 232111032SjulianASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED); 23382910Sjake 23488788SjakeASSYM(MD_UTRAP, offsetof(struct mdproc, md_utrap)); 23588788Sjake 23682910SjakeASSYM(P_COMM, offsetof(struct proc, p_comm)); 23788657SjakeASSYM(P_MD, offsetof(struct proc, p_md)); 23888657SjakeASSYM(P_PID, offsetof(struct proc, p_pid)); 23980709SjakeASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace)); 24080709Sjake 241111032SjulianASSYM(TD_FLAGS, offsetof(struct thread, td_flags)); 24283366SjulianASSYM(TD_FRAME, offsetof(struct thread, td_frame)); 24383366SjulianASSYM(TD_KSTACK, offsetof(struct thread, td_kstack)); 244203185SmariusASSYM(TD_LOCK, offsetof(struct thread, td_lock)); 24583366SjulianASSYM(TD_PCB, offsetof(struct thread, td_pcb)); 24683366SjulianASSYM(TD_PROC, offsetof(struct thread, td_proc)); 247163146SkmacyASSYM(TD_MD, offsetof(struct thread, td_md)); 248163146SkmacyASSYM(MD_SAVED_PIL, offsetof(struct mdthread, md_saved_pil)); 24983366Sjulian 25084186SjakeASSYM(PCB_SIZEOF, sizeof(struct pcb)); 251113023SjakeASSYM(PCB_RW, offsetof(struct pcb, pcb_rw)); 252113023SjakeASSYM(PCB_KFP, offsetof(struct pcb, pcb_kfp)); 253112920SjakeASSYM(PCB_UFP, offsetof(struct pcb, pcb_ufp)); 254113023SjakeASSYM(PCB_RWSP, offsetof(struct pcb, pcb_rwsp)); 255112924SjakeASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags)); 25682910SjakeASSYM(PCB_NSAVED, offsetof(struct pcb, pcb_nsaved)); 257113023SjakeASSYM(PCB_PC, offsetof(struct pcb, pcb_pc)); 258113023SjakeASSYM(PCB_SP, offsetof(struct pcb, pcb_sp)); 259163965SkmacyASSYM(PCB_PAD, offsetof(struct pcb, pcb_pad)); 260163146Skmacy 26181381SjakeASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap)); 26288657SjakeASSYM(PM_ACTIVE, offsetof(struct pmap, pm_active)); 26381381SjakeASSYM(PM_CONTEXT, offsetof(struct pmap, pm_context)); 26488657SjakeASSYM(PM_TSB, offsetof(struct pmap, pm_tsb)); 26581381Sjake 26688657SjakeASSYM(_JB_FP, offsetof(struct _jmp_buf, _jb[_JB_FP])); 26788657SjakeASSYM(_JB_PC, offsetof(struct _jmp_buf, _jb[_JB_PC])); 26888657SjakeASSYM(_JB_SP, offsetof(struct _jmp_buf, _jb[_JB_SP])); 26988657SjakeASSYM(_JB_SIGFLAG, offsetof(struct _jmp_buf, _jb[_JB_SIGFLAG])); 27088657SjakeASSYM(_JB_SIGMASK, offsetof(struct _jmp_buf, _jb[_JB_SIGMASK])); 27180709Sjake 27280709SjakeASSYM(TF_G0, offsetof(struct trapframe, tf_global[0])); 27380709SjakeASSYM(TF_G1, offsetof(struct trapframe, tf_global[1])); 27480709SjakeASSYM(TF_G2, offsetof(struct trapframe, tf_global[2])); 27580709SjakeASSYM(TF_G3, offsetof(struct trapframe, tf_global[3])); 27680709SjakeASSYM(TF_G4, offsetof(struct trapframe, tf_global[4])); 27780709SjakeASSYM(TF_G5, offsetof(struct trapframe, tf_global[5])); 27880709SjakeASSYM(TF_G6, offsetof(struct trapframe, tf_global[6])); 27980709SjakeASSYM(TF_G7, offsetof(struct trapframe, tf_global[7])); 28080709SjakeASSYM(TF_O0, offsetof(struct trapframe, tf_out[0])); 28180709SjakeASSYM(TF_O1, offsetof(struct trapframe, tf_out[1])); 28280709SjakeASSYM(TF_O2, offsetof(struct trapframe, tf_out[2])); 28380709SjakeASSYM(TF_O3, offsetof(struct trapframe, tf_out[3])); 28480709SjakeASSYM(TF_O4, offsetof(struct trapframe, tf_out[4])); 28580709SjakeASSYM(TF_O5, offsetof(struct trapframe, tf_out[5])); 28680709SjakeASSYM(TF_O6, offsetof(struct trapframe, tf_out[6])); 28780709SjakeASSYM(TF_O7, offsetof(struct trapframe, tf_out[7])); 288105733SjakeASSYM(TF_FPRS, offsetof(struct trapframe, tf_fprs)); 28988657SjakeASSYM(TF_FSR, offsetof(struct trapframe, tf_fsr)); 290105733SjakeASSYM(TF_GSR, offsetof(struct trapframe, tf_gsr)); 291163146SkmacyASSYM(TF_PIL, offsetof(struct trapframe, tf_pil)); 292166105Smarius#ifdef SUN4U 293105733SjakeASSYM(TF_LEVEL, offsetof(struct trapframe, tf_level)); 29488657SjakeASSYM(TF_SFAR, offsetof(struct trapframe, tf_sfar)); 295105733SjakeASSYM(TF_SFSR, offsetof(struct trapframe, tf_sfsr)); 29688657SjakeASSYM(TF_TAR, offsetof(struct trapframe, tf_tar)); 297163152SkmacyASSYM(TF_TYPE, offsetof(struct trapframe, tf_type)); 298163152SkmacyASSYM(TF_Y, offsetof(struct trapframe, tf_y)); 299166105Smarius#endif 300166105Smarius#ifdef SUN4V 301163146SkmacyASSYM(TF_ASI, offsetof(struct trapframe, tf_asi)); 302163146Skmacy#endif 30388657SjakeASSYM(TF_TNPC, offsetof(struct trapframe, tf_tnpc)); 30488657SjakeASSYM(TF_TPC, offsetof(struct trapframe, tf_tpc)); 30580709SjakeASSYM(TF_TSTATE, offsetof(struct trapframe, tf_tstate)); 30682910SjakeASSYM(TF_WSTATE, offsetof(struct trapframe, tf_wstate)); 30780709SjakeASSYM(TF_SIZEOF, sizeof(struct trapframe)); 30888788Sjake 309163146SkmacyASSYM(VM_MIN_DIRECT_ADDRESS, VM_MIN_DIRECT_ADDRESS); 310163146SkmacyASSYM(VM_MIN_PROM_ADDRESS, VM_MIN_PROM_ADDRESS); 311163146SkmacyASSYM(VM_MAX_PROM_ADDRESS, VM_MAX_PROM_ADDRESS); 312