genassym.c revision 164760
1/*- 2 * Copyright (c) 2001 Jake Burkholder. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 27 */ 28 29#include <sys/cdefs.h> 30__FBSDID("$FreeBSD: head/sys/sparc64/sparc64/genassym.c 164760 2006-11-30 04:17:05Z jb $"); 31 32#include "opt_kstack_pages.h" 33 34#include <sys/param.h> 35#include <sys/assym.h> 36#include <sys/errno.h> 37#include <sys/ktr.h> 38#include <sys/proc.h> 39#include <sys/queue.h> 40#include <sys/lock.h> 41#include <sys/mutex.h> 42#include <sys/signal.h> 43#include <sys/smp.h> 44#include <sys/systm.h> 45#include <sys/ucontext.h> 46#include <sys/ucontext.h> 47#include <sys/vmmeter.h> 48 49#include <vm/vm.h> 50#include <vm/vm_param.h> 51#include <vm/vm_kern.h> 52#include <vm/vm_page.h> 53#include <vm/vm_map.h> 54 55#include <machine/asi.h> 56#include <machine/cache.h> 57#include <machine/vmparam.h> 58#include <machine/cpufunc.h> 59#include <machine/fp.h> 60#include <machine/frame.h> 61#include <machine/fsr.h> 62#include <machine/intr_machdep.h> 63#include <machine/lsu.h> 64#include <machine/pcb.h> 65#include <machine/pstate.h> 66#include <machine/setjmp.h> 67#include <machine/sigframe.h> 68#include <machine/smp.h> 69#include <machine/tte.h> 70#include <machine/tlb.h> 71#include <machine/tsb.h> 72#include <machine/tstate.h> 73#include <machine/utrap.h> 74#ifdef SUN4V 75#include <machine/mmu.h> 76#include <machine/trap.h> 77#include <machine/tte_hash.h> 78#endif 79 80 81ASSYM(KERNBASE, KERNBASE); 82 83ASSYM(EFAULT, EFAULT); 84ASSYM(ENAMETOOLONG, ENAMETOOLONG); 85 86ASSYM(KSTACK_PAGES, KSTACK_PAGES); 87ASSYM(KSTACK_GUARD_PAGES, KSTACK_GUARD_PAGES); 88ASSYM(PCPU_PAGES, PCPU_PAGES); 89 90ASSYM(PIL_TICK, PIL_TICK); 91 92ASSYM(FPRS_DL, FPRS_DL); 93ASSYM(FPRS_DU, FPRS_DU); 94ASSYM(FPRS_FEF, FPRS_FEF); 95 96ASSYM(LSU_VW, LSU_VW); 97ASSYM(LSU_IC, LSU_IC); 98ASSYM(LSU_DC, LSU_DC); 99 100ASSYM(TAR_VPN_SHIFT, TAR_VPN_SHIFT); 101 102ASSYM(TLB_DAR_SLOT_SHIFT, TLB_DAR_SLOT_SHIFT); 103ASSYM(TLB_DEMAP_NUCLEUS, TLB_DEMAP_NUCLEUS); 104ASSYM(TLB_DEMAP_PRIMARY, TLB_DEMAP_PRIMARY); 105ASSYM(TLB_DEMAP_CONTEXT, TLB_DEMAP_CONTEXT); 106ASSYM(TLB_DEMAP_PAGE, TLB_DEMAP_PAGE); 107 108#ifndef SUN4V 109ASSYM(TSB_BUCKET_MASK, TSB_BUCKET_MASK); 110ASSYM(TSB_BUCKET_SHIFT, TSB_BUCKET_SHIFT); 111#endif 112ASSYM(INT_SHIFT, INT_SHIFT); 113ASSYM(PTR_SHIFT, PTR_SHIFT); 114 115ASSYM(PAGE_SHIFT, PAGE_SHIFT); 116ASSYM(PAGE_MASK, PAGE_MASK); 117ASSYM(PAGE_MASK_4M, PAGE_MASK_4M); 118ASSYM(PAGE_SHIFT_8K, PAGE_SHIFT_8K); 119ASSYM(PAGE_SHIFT_4M, PAGE_SHIFT_4M); 120ASSYM(PAGE_SIZE, PAGE_SIZE); 121ASSYM(PAGE_SIZE_4M, PAGE_SIZE_4M); 122 123ASSYM(CPU_CLKSYNC, CPU_CLKSYNC); 124ASSYM(CPU_INIT, CPU_INIT); 125 126ASSYM(CSA_PCPU, offsetof(struct cpu_start_args, csa_pcpu)); 127ASSYM(CSA_STATE, offsetof(struct cpu_start_args, csa_state)); 128#ifndef SUN4V 129ASSYM(CSA_TICK, offsetof(struct cpu_start_args, csa_tick)); 130ASSYM(CSA_VER, offsetof(struct cpu_start_args, csa_ver)); 131ASSYM(CSA_MID, offsetof(struct cpu_start_args, csa_mid)); 132ASSYM(CSA_TTES, offsetof(struct cpu_start_args, csa_ttes)); 133#else 134ASSYM(CSA_CPUID, offsetof(struct cpu_start_args, csa_cpuid)); 135#endif 136ASSYM(DC_TAG_SHIFT, DC_TAG_SHIFT); 137ASSYM(DC_TAG_MASK, DC_TAG_MASK); 138ASSYM(DC_VALID_SHIFT, DC_VALID_SHIFT); 139ASSYM(DC_VALID_MASK, DC_VALID_MASK); 140ASSYM(IC_TAG_SHIFT, IC_TAG_SHIFT); 141ASSYM(IC_TAG_MASK, IC_TAG_MASK); 142ASSYM(IC_VALID_SHIFT, IC_VALID_SHIFT); 143ASSYM(IC_VALID_MASK, IC_VALID_MASK); 144 145ASSYM(DC_SIZE, offsetof(struct cacheinfo, dc_size)); 146ASSYM(DC_LINESIZE, offsetof(struct cacheinfo, dc_linesize)); 147ASSYM(IC_SIZE, offsetof(struct cacheinfo, ic_size)); 148ASSYM(IC_LINESIZE, offsetof(struct cacheinfo, ic_linesize)); 149 150ASSYM(ICA_PA, offsetof(struct ipi_cache_args, ica_pa)); 151 152ASSYM(KTR_SIZEOF, sizeof(struct ktr_entry)); 153ASSYM(KTR_LINE, offsetof(struct ktr_entry, ktr_line)); 154ASSYM(KTR_FILE, offsetof(struct ktr_entry, ktr_file)); 155ASSYM(KTR_DESC, offsetof(struct ktr_entry, ktr_desc)); 156ASSYM(KTR_CPU, offsetof(struct ktr_entry, ktr_cpu)); 157ASSYM(KTR_TIMESTAMP, offsetof(struct ktr_entry, ktr_timestamp)); 158ASSYM(KTR_PARM1, offsetof(struct ktr_entry, ktr_parms[0])); 159ASSYM(KTR_PARM2, offsetof(struct ktr_entry, ktr_parms[1])); 160ASSYM(KTR_PARM3, offsetof(struct ktr_entry, ktr_parms[2])); 161ASSYM(KTR_PARM4, offsetof(struct ktr_entry, ktr_parms[3])); 162ASSYM(KTR_PARM5, offsetof(struct ktr_entry, ktr_parms[4])); 163ASSYM(KTR_PARM6, offsetof(struct ktr_entry, ktr_parms[5])); 164 165ASSYM(TTE_SHIFT, TTE_SHIFT); 166#ifndef SUN4V 167ASSYM(TTE_VPN, offsetof(struct tte, tte_vpn)); 168ASSYM(TTE_DATA, offsetof(struct tte, tte_data)); 169 170ASSYM(TD_EXEC, TD_EXEC); 171ASSYM(TD_REF, TD_REF); 172ASSYM(TD_SW, TD_SW); 173ASSYM(TD_V, TD_V); 174ASSYM(TD_8K, TD_8K); 175ASSYM(TD_CP, TD_CP); 176ASSYM(TD_CV, TD_CV); 177ASSYM(TD_L, TD_L); 178ASSYM(TD_W, TD_W); 179 180ASSYM(TS_MIN, TS_MIN); 181ASSYM(TS_MAX, TS_MAX); 182ASSYM(TLB_DIRECT_TO_TTE_MASK, TLB_DIRECT_TO_TTE_MASK); 183ASSYM(TV_SIZE_BITS, TV_SIZE_BITS); 184#else 185ASSYM(VTD_REF, VTD_REF); 186ASSYM(VTD_W, VTD_W); 187ASSYM(VTD_SW_W, VTD_SW_W); 188ASSYM(VTD_LOCK, VTD_LOCK); 189 190ASSYM(THE_SHIFT, THE_SHIFT); 191ASSYM(TH_COLLISION_SHIFT, TH_COLLISION_SHIFT); 192ASSYM(PM_HASHSCRATCH, offsetof(struct pmap, pm_hashscratch)); 193ASSYM(PM_TSBSCRATCH, offsetof(struct pmap, pm_tsbscratch)); 194ASSYM(PM_TSB_RA, offsetof(struct pmap, pm_tsb_ra)); 195ASSYM(PM_TLBACTIVE, offsetof(struct pmap, pm_tlbactive)); 196ASSYM(HASH_ENTRY_SHIFT, HASH_ENTRY_SHIFT); 197#endif 198 199ASSYM(V_INTR, offsetof(struct vmmeter, v_intr)); 200 201ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread)); 202ASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb)); 203ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid)); 204ASSYM(PC_CPUMASK, offsetof(struct pcpu, pc_cpumask)); 205ASSYM(PC_IRHEAD, offsetof(struct pcpu, pc_irhead)); 206ASSYM(PC_IRTAIL, offsetof(struct pcpu, pc_irtail)); 207ASSYM(PC_IRFREE, offsetof(struct pcpu, pc_irfree)); 208ASSYM(PC_CNT, offsetof(struct pcpu, pc_cnt)); 209ASSYM(PC_SIZEOF, sizeof(struct pcpu)); 210 211#ifdef SUN4V 212ASSYM(PC_CALLER, offsetof(struct pcpu, pc_caller)); 213ASSYM(PC_CPU_Q_RA, offsetof(struct pcpu, pc_cpu_q_ra)); 214ASSYM(PC_CPU_Q_SIZE, offsetof(struct pcpu, pc_cpu_q_size)); 215ASSYM(PC_DEV_Q_RA, offsetof(struct pcpu, pc_dev_q_ra)); 216ASSYM(PC_DEV_Q_SIZE, offsetof(struct pcpu, pc_dev_q_size)); 217 218ASSYM(PC_RQ_BASE, offsetof(struct pcpu, pc_rq_ra)); 219ASSYM(PC_RQ_SIZE, offsetof(struct pcpu, pc_rq_size)); 220ASSYM(PC_NRQ_BASE, offsetof(struct pcpu, pc_nrq_ra)); 221ASSYM(PC_NRQ_SIZE, offsetof(struct pcpu, pc_nrq_size)); 222ASSYM(PC_MONDO_DATA, offsetof(struct pcpu, pc_mondo_data)); 223ASSYM(PC_MONDO_DATA_RA, offsetof(struct pcpu, pc_mondo_data_ra)); 224 225ASSYM(PC_KWBUF_FULL, offsetof(struct pcpu, pc_kwbuf_full)); 226ASSYM(PC_KWBUF_SP, offsetof(struct pcpu, pc_kwbuf_sp)); 227ASSYM(PC_KWBUF, offsetof(struct pcpu, pc_kwbuf)); 228ASSYM(PC_PAD, offsetof(struct pcpu, pad)); 229ASSYM(PC_PMAP, offsetof(struct pcpu, pc_curpmap)); 230ASSYM(PC_TSBWBUF, offsetof(struct pcpu, pc_tsbwbuf)); 231 232ASSYM(PCB_KSTACK, offsetof(struct pcb, pcb_kstack)); 233ASSYM(PCB_TSTATE, offsetof(struct pcb, pcb_tstate)); 234ASSYM(PCB_TPC, offsetof(struct pcb, pcb_tpc)); 235ASSYM(PCB_TNPC, offsetof(struct pcb, pcb_tnpc)); 236ASSYM(PCB_TT, offsetof(struct pcb, pcb_tt)); 237ASSYM(PCB_SFAR, offsetof(struct pcb, pcb_sfar)); 238ASSYM(INTR_REPORT_SIZE, INTR_REPORT_SIZE); 239ASSYM(PM_TSB_MISS_COUNT, offsetof(struct pmap, pm_tsb_miss_count)); 240ASSYM(PM_TSB_CAP_MISS_COUNT, offsetof(struct pmap, pm_tsb_cap_miss_count)); 241#else 242ASSYM(PC_MID, offsetof(struct pcpu, pc_mid)); 243ASSYM(PC_TLB_CTX, offsetof(struct pcpu, pc_tlb_ctx)); 244ASSYM(PC_TLB_CTX_MAX, offsetof(struct pcpu, pc_tlb_ctx_max)); 245ASSYM(PC_TLB_CTX_MIN, offsetof(struct pcpu, pc_tlb_ctx_min)); 246ASSYM(PC_PMAP, offsetof(struct pcpu, pc_pmap)); 247#endif 248 249 250 251ASSYM(IH_SHIFT, IH_SHIFT); 252 253ASSYM(IRSR_BUSY, IRSR_BUSY); 254 255ASSYM(IR_NEXT, offsetof(struct intr_request, ir_next)); 256ASSYM(IR_FUNC, offsetof(struct intr_request, ir_func)); 257ASSYM(IR_ARG, offsetof(struct intr_request, ir_arg)); 258ASSYM(IR_PRI, offsetof(struct intr_request, ir_pri)); 259ASSYM(IR_VEC, offsetof(struct intr_request, ir_vec)); 260 261ASSYM(ITA_MASK, offsetof(struct ipi_tlb_args, ita_mask)); 262ASSYM(ITA_PMAP, offsetof(struct ipi_tlb_args, ita_pmap)); 263ASSYM(ITA_START, offsetof(struct ipi_tlb_args, ita_start)); 264ASSYM(ITA_END, offsetof(struct ipi_tlb_args, ita_end)); 265ASSYM(ITA_VA, offsetof(struct ipi_tlb_args, ita_va)); 266 267ASSYM(IV_SHIFT, IV_SHIFT); 268ASSYM(IV_FUNC, offsetof(struct intr_vector, iv_func)); 269ASSYM(IV_ARG, offsetof(struct intr_vector, iv_arg)); 270ASSYM(IV_PRI, offsetof(struct intr_vector, iv_pri)); 271 272ASSYM(IV_NAMLEN, IV_NAMLEN); 273ASSYM(IV_MAX, IV_MAX); 274 275ASSYM(TDF_ASTPENDING, TDF_ASTPENDING); 276ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED); 277 278ASSYM(MD_UTRAP, offsetof(struct mdproc, md_utrap)); 279 280ASSYM(MTX_LOCK, offsetof(struct mtx, mtx_lock)); 281 282ASSYM(P_COMM, offsetof(struct proc, p_comm)); 283ASSYM(P_MD, offsetof(struct proc, p_md)); 284ASSYM(P_PID, offsetof(struct proc, p_pid)); 285ASSYM(P_SFLAG, offsetof(struct proc, p_sflag)); 286ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace)); 287 288ASSYM(RW_SHIFT, RW_SHIFT); 289 290ASSYM(TD_FLAGS, offsetof(struct thread, td_flags)); 291 292ASSYM(TD_FRAME, offsetof(struct thread, td_frame)); 293ASSYM(TD_KSTACK, offsetof(struct thread, td_kstack)); 294ASSYM(TD_PCB, offsetof(struct thread, td_pcb)); 295ASSYM(TD_PROC, offsetof(struct thread, td_proc)); 296ASSYM(TD_MD, offsetof(struct thread, td_md)); 297ASSYM(MD_SAVED_PIL, offsetof(struct mdthread, md_saved_pil)); 298 299 300ASSYM(PCB_SIZEOF, sizeof(struct pcb)); 301ASSYM(PCB_RW, offsetof(struct pcb, pcb_rw)); 302ASSYM(PCB_KFP, offsetof(struct pcb, pcb_kfp)); 303ASSYM(PCB_UFP, offsetof(struct pcb, pcb_ufp)); 304ASSYM(PCB_RWSP, offsetof(struct pcb, pcb_rwsp)); 305ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags)); 306ASSYM(PCB_NSAVED, offsetof(struct pcb, pcb_nsaved)); 307ASSYM(PCB_PC, offsetof(struct pcb, pcb_pc)); 308ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp)); 309ASSYM(PCB_PAD, offsetof(struct pcb, pcb_pad)); 310 311 312 313 314ASSYM(PCB_FEF, PCB_FEF); 315 316ASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap)); 317ASSYM(PM_ACTIVE, offsetof(struct pmap, pm_active)); 318ASSYM(PM_CONTEXT, offsetof(struct pmap, pm_context)); 319ASSYM(PM_TSB, offsetof(struct pmap, pm_tsb)); 320 321ASSYM(SF_UC, offsetof(struct sigframe, sf_uc)); 322 323ASSYM(_JB_FP, offsetof(struct _jmp_buf, _jb[_JB_FP])); 324ASSYM(_JB_PC, offsetof(struct _jmp_buf, _jb[_JB_PC])); 325ASSYM(_JB_SP, offsetof(struct _jmp_buf, _jb[_JB_SP])); 326ASSYM(_JB_SIGFLAG, offsetof(struct _jmp_buf, _jb[_JB_SIGFLAG])); 327ASSYM(_JB_SIGMASK, offsetof(struct _jmp_buf, _jb[_JB_SIGMASK])); 328 329ASSYM(TF_G0, offsetof(struct trapframe, tf_global[0])); 330ASSYM(TF_G1, offsetof(struct trapframe, tf_global[1])); 331ASSYM(TF_G2, offsetof(struct trapframe, tf_global[2])); 332ASSYM(TF_G3, offsetof(struct trapframe, tf_global[3])); 333ASSYM(TF_G4, offsetof(struct trapframe, tf_global[4])); 334ASSYM(TF_G5, offsetof(struct trapframe, tf_global[5])); 335ASSYM(TF_G6, offsetof(struct trapframe, tf_global[6])); 336ASSYM(TF_G7, offsetof(struct trapframe, tf_global[7])); 337ASSYM(TF_O0, offsetof(struct trapframe, tf_out[0])); 338ASSYM(TF_O1, offsetof(struct trapframe, tf_out[1])); 339ASSYM(TF_O2, offsetof(struct trapframe, tf_out[2])); 340ASSYM(TF_O3, offsetof(struct trapframe, tf_out[3])); 341ASSYM(TF_O4, offsetof(struct trapframe, tf_out[4])); 342ASSYM(TF_O5, offsetof(struct trapframe, tf_out[5])); 343ASSYM(TF_O6, offsetof(struct trapframe, tf_out[6])); 344ASSYM(TF_O7, offsetof(struct trapframe, tf_out[7])); 345ASSYM(TF_FPRS, offsetof(struct trapframe, tf_fprs)); 346ASSYM(TF_FSR, offsetof(struct trapframe, tf_fsr)); 347ASSYM(TF_GSR, offsetof(struct trapframe, tf_gsr)); 348ASSYM(TF_PIL, offsetof(struct trapframe, tf_pil)); 349#ifndef SUN4V 350ASSYM(TF_LEVEL, offsetof(struct trapframe, tf_level)); 351ASSYM(TF_SFAR, offsetof(struct trapframe, tf_sfar)); 352ASSYM(TF_SFSR, offsetof(struct trapframe, tf_sfsr)); 353ASSYM(TF_TAR, offsetof(struct trapframe, tf_tar)); 354ASSYM(TF_TYPE, offsetof(struct trapframe, tf_type)); 355ASSYM(TF_Y, offsetof(struct trapframe, tf_y)); 356#else 357ASSYM(TF_ASI, offsetof(struct trapframe, tf_asi)); 358#endif 359ASSYM(TF_TNPC, offsetof(struct trapframe, tf_tnpc)); 360ASSYM(TF_TPC, offsetof(struct trapframe, tf_tpc)); 361ASSYM(TF_TSTATE, offsetof(struct trapframe, tf_tstate)); 362ASSYM(TF_WSTATE, offsetof(struct trapframe, tf_wstate)); 363ASSYM(TF_SIZEOF, sizeof(struct trapframe)); 364 365ASSYM(UT_MAX, UT_MAX); 366ASSYM(VM_MIN_DIRECT_ADDRESS, VM_MIN_DIRECT_ADDRESS); 367ASSYM(VM_MIN_PROM_ADDRESS, VM_MIN_PROM_ADDRESS); 368ASSYM(VM_MAX_PROM_ADDRESS, VM_MAX_PROM_ADDRESS); 369 370