genassym.c revision 327667
1129198Scognet/*- 2129198Scognet * Copyright (c) 2004 Olivier Houchard 3129198Scognet * All rights reserved. 4129198Scognet * 5129198Scognet * Redistribution and use in source and binary forms, with or without 6129198Scognet * modification, are permitted provided that the following conditions 7129198Scognet * are met: 8129198Scognet * 1. Redistributions of source code must retain the above copyright 9129198Scognet * notice, this list of conditions and the following disclaimer. 10129198Scognet * 2. Redistributions in binary form must reproduce the above copyright 11129198Scognet * notice, this list of conditions and the following disclaimer in the 12129198Scognet * documentation and/or other materials provided with the distribution. 13129198Scognet * 14129198Scognet * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15129198Scognet * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16129198Scognet * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17129198Scognet * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18129198Scognet * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19129198Scognet * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20129198Scognet * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21129198Scognet * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22129198Scognet * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23129198Scognet * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24129198Scognet * SUCH DAMAGE. 25129198Scognet * 26129198Scognet */ 27129198Scognet 28129198Scognet#include <sys/cdefs.h> 29129198Scognet__FBSDID("$FreeBSD: stable/11/sys/arm/arm/genassym.c 327667 2018-01-07 02:57:35Z ian $"); 30129198Scognet#include <sys/param.h> 31299122Sjhb#include <sys/cpuset.h> 32129198Scognet#include <sys/systm.h> 33129198Scognet#include <sys/assym.h> 34129198Scognet#include <sys/proc.h> 35129198Scognet#include <sys/mbuf.h> 36129198Scognet#include <sys/vmmeter.h> 37261252Simp#include <sys/bus.h> 38129198Scognet#include <vm/vm.h> 39239268Sgonzo#include <vm/vm_param.h> 40129198Scognet#include <vm/pmap.h> 41239268Sgonzo#include <vm/vm_map.h> 42284115Sandrew 43129198Scognet#include <machine/armreg.h> 44257200Sian#include <machine/frame.h> 45129198Scognet#include <machine/pcb.h> 46129198Scognet#include <machine/cpu.h> 47129198Scognet#include <machine/proc.h> 48129198Scognet#include <machine/cpufunc.h> 49279811Sian#include <machine/cpuinfo.h> 50137629Scognet#include <machine/intr.h> 51142570Scognet#include <machine/sysarch.h> 52327658Sian#include <machine/vmparam.h> /* For KERNVIRTADDR */ 53142570Scognet 54129198Scognet#include <netinet/in.h> 55129198Scognet#include <netinet/in_systm.h> 56129198Scognet#include <netinet/ip.h> 57129198Scognet#include <netinet/ip6.h> 58129198Scognet#include <netinet/ip_var.h> 59129198Scognet 60129198ScognetASSYM(KERNBASE, KERNBASE); 61327658SianASSYM(KERNVIRTADDR, KERNVIRTADDR); 62295036Smmel#if __ARM_ARCH >= 6 63280712SianASSYM(CPU_ASID_KERNEL,CPU_ASID_KERNEL); 64280712Sian#endif 65129198ScognetASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault)); 66295036Smmel#if __ARM_ARCH < 6 67129198ScognetASSYM(PCB_DACR, offsetof(struct pcb, pcb_dacr)); 68280712Sian#endif 69129198ScognetASSYM(PCB_PAGEDIR, offsetof(struct pcb, pcb_pagedir)); 70295036Smmel#if __ARM_ARCH < 6 71129198ScognetASSYM(PCB_L1VEC, offsetof(struct pcb, pcb_l1vec)); 72129198ScognetASSYM(PCB_PL1VEC, offsetof(struct pcb, pcb_pl1vec)); 73280712Sian#endif 74276190SianASSYM(PCB_R4, offsetof(struct pcb, pcb_regs.sf_r4)); 75276190SianASSYM(PCB_R5, offsetof(struct pcb, pcb_regs.sf_r5)); 76276190SianASSYM(PCB_R6, offsetof(struct pcb, pcb_regs.sf_r6)); 77276190SianASSYM(PCB_R7, offsetof(struct pcb, pcb_regs.sf_r7)); 78276190SianASSYM(PCB_R8, offsetof(struct pcb, pcb_regs.sf_r8)); 79276190SianASSYM(PCB_R9, offsetof(struct pcb, pcb_regs.sf_r9)); 80276190SianASSYM(PCB_R10, offsetof(struct pcb, pcb_regs.sf_r10)); 81276190SianASSYM(PCB_R11, offsetof(struct pcb, pcb_regs.sf_r11)); 82276190SianASSYM(PCB_R12, offsetof(struct pcb, pcb_regs.sf_r12)); 83276190SianASSYM(PCB_SP, offsetof(struct pcb, pcb_regs.sf_sp)); 84276190SianASSYM(PCB_LR, offsetof(struct pcb, pcb_regs.sf_lr)); 85276190SianASSYM(PCB_PC, offsetof(struct pcb, pcb_regs.sf_pc)); 86307136Sed#if __ARM_ARCH >= 6 87307136SedASSYM(PCB_TPIDRURW, offsetof(struct pcb, pcb_regs.sf_tpidrurw)); 88307136Sed#endif 89129198Scognet 90129198ScognetASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb)); 91129198ScognetASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread)); 92129198ScognetASSYM(M_LEN, offsetof(struct mbuf, m_len)); 93129198ScognetASSYM(M_DATA, offsetof(struct mbuf, m_data)); 94129198ScognetASSYM(M_NEXT, offsetof(struct mbuf, m_next)); 95129198ScognetASSYM(IP_SRC, offsetof(struct ip, ip_src)); 96129198ScognetASSYM(IP_DST, offsetof(struct ip, ip_dst)); 97317002Smmel#if __ARM_ARCH < 6 98129198ScognetASSYM(CF_CONTEXT_SWITCH, offsetof(struct cpu_functions, cf_context_switch)); 99129198ScognetASSYM(CF_DCACHE_WB_RANGE, offsetof(struct cpu_functions, cf_dcache_wb_range)); 100129198ScognetASSYM(CF_IDCACHE_WBINV_ALL, offsetof(struct cpu_functions, cf_idcache_wbinv_all)); 101183838SrajASSYM(CF_L2CACHE_WBINV_ALL, offsetof(struct cpu_functions, cf_l2cache_wbinv_all)); 102129198ScognetASSYM(CF_TLB_FLUSHID_SE, offsetof(struct cpu_functions, cf_tlb_flushID_SE)); 103317002Smmel#endif 104129198Scognet 105129198ScognetASSYM(TD_PCB, offsetof(struct thread, td_pcb)); 106129198ScognetASSYM(TD_FLAGS, offsetof(struct thread, td_flags)); 107129198ScognetASSYM(TD_PROC, offsetof(struct thread, td_proc)); 108142570ScognetASSYM(TD_MD, offsetof(struct thread, td_md)); 109171788ScognetASSYM(TD_LOCK, offsetof(struct thread, td_lock)); 110307136Sed#if __ARM_ARCH < 6 111142570ScognetASSYM(MD_TP, offsetof(struct mdthread, md_tp)); 112188540ScognetASSYM(MD_RAS_START, offsetof(struct mdthread, md_ras_start)); 113188540ScognetASSYM(MD_RAS_END, offsetof(struct mdthread, md_ras_end)); 114301700Sandrew#endif 115129198Scognet 116291852SandrewASSYM(TF_SPSR, offsetof(struct trapframe, tf_spsr)); 117129198ScognetASSYM(TF_R0, offsetof(struct trapframe, tf_r0)); 118129198ScognetASSYM(TF_R1, offsetof(struct trapframe, tf_r1)); 119129198ScognetASSYM(TF_PC, offsetof(struct trapframe, tf_pc)); 120129198ScognetASSYM(P_PID, offsetof(struct proc, p_pid)); 121129198ScognetASSYM(P_FLAG, offsetof(struct proc, p_flag)); 122129198Scognet 123262903SianASSYM(SIGF_UC, offsetof(struct sigframe, sf_uc)); 124262903Sian 125284115Sandrew#if __ARM_ARCH < 6 126142570ScognetASSYM(ARM_TP_ADDRESS, ARM_TP_ADDRESS); 127175982SrajASSYM(ARM_RAS_START, ARM_RAS_START); 128175982SrajASSYM(ARM_RAS_END, ARM_RAS_END); 129239268Sgonzo#endif 130239268Sgonzo 131254461Sandrew#ifdef VFP 132239268SgonzoASSYM(PCB_VFPSTATE, offsetof(struct pcb, pcb_vfpstate)); 133284771Sian#endif 134239268Sgonzo 135284871Sandrew#if __ARM_ARCH >= 6 136239268SgonzoASSYM(PC_CURPMAP, offsetof(struct pcpu, pc_curpmap)); 137284871Sandrew#endif 138239268Sgonzo 139150996ScognetASSYM(PAGE_SIZE, PAGE_SIZE); 140295703Sskra#if __ARM_ARCH < 6 141129198ScognetASSYM(PMAP_DOMAIN_KERNEL, PMAP_DOMAIN_KERNEL); 142295703Sskra#endif 143135651Scognet#ifdef PMAP_INCLUDE_PTE_SYNC 144135651ScognetASSYM(PMAP_INCLUDE_PTE_SYNC, 1); 145135651Scognet#endif 146129198ScognetASSYM(TDF_ASTPENDING, TDF_ASTPENDING); 147135651ScognetASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED); 148137629Scognet 149137629ScognetASSYM(MAXCOMLEN, MAXCOMLEN); 150276395SianASSYM(MAXCPU, MAXCPU); 151280712SianASSYM(_NCPUWORDS, _NCPUWORDS); 152137629ScognetASSYM(NIRQ, NIRQ); 153261415ScognetASSYM(PCPU_SIZE, sizeof(struct pcpu)); 154280712SianASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace)); 155280712SianASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap)); 156280712SianASSYM(PM_ACTIVE, offsetof(struct pmap, pm_active)); 157280712SianASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid)); 158289372SkibASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS); 159279811Sian 160279811SianASSYM(DCACHE_LINE_SIZE, offsetof(struct cpuinfo, dcache_line_size)); 161279811SianASSYM(DCACHE_LINE_MASK, offsetof(struct cpuinfo, dcache_line_mask)); 162279811SianASSYM(ICACHE_LINE_SIZE, offsetof(struct cpuinfo, icache_line_size)); 163279811SianASSYM(ICACHE_LINE_MASK, offsetof(struct cpuinfo, icache_line_mask)); 164327667Sian 165327667Sian/* 166327667Sian * Emit the LOCORE_MAP_MB option as a #define only if the option was set. 167327667Sian */ 168327667Sian#include "opt_locore.h" 169327667Sian 170327667Sian#ifdef LOCORE_MAP_MB 171327667SianASSYM(LOCORE_MAP_MB, LOCORE_MAP_MB); 172327667Sian#endif 173