1/*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2004 Olivier Houchard 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 */ 29 30#include <sys/param.h> 31#include <sys/cpuset.h> 32#include <sys/systm.h> 33#include <sys/assym.h> 34#include <sys/pcpu.h> 35#include <sys/proc.h> 36#include <sys/mbuf.h> 37#include <sys/vmmeter.h> 38#include <sys/bus.h> 39#include <vm/vm.h> 40#include <vm/vm_param.h> 41#include <vm/pmap.h> 42#include <vm/vm_map.h> 43 44#include <machine/armreg.h> 45#include <machine/frame.h> 46#include <machine/pcb.h> 47#include <machine/cpu.h> 48#include <machine/proc.h> 49#include <machine/cpufunc.h> 50#include <machine/cpuinfo.h> 51#include <machine/intr.h> 52#include <machine/sysarch.h> 53#include <machine/vmparam.h> /* For KERNVIRTADDR */ 54 55#include <netinet/in.h> 56#include <netinet/in_systm.h> 57#include <netinet/ip.h> 58#include <netinet/ip6.h> 59#include <netinet/ip_var.h> 60 61ASSYM(KERNBASE, KERNBASE); 62ASSYM(KERNVIRTADDR, KERNVIRTADDR); 63ASSYM(CPU_ASID_KERNEL,CPU_ASID_KERNEL); 64ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault)); 65ASSYM(PCB_PAGEDIR, offsetof(struct pcb, pcb_pagedir)); 66ASSYM(PCB_R4, offsetof(struct pcb, pcb_regs.sf_r4)); 67ASSYM(PCB_R5, offsetof(struct pcb, pcb_regs.sf_r5)); 68ASSYM(PCB_R6, offsetof(struct pcb, pcb_regs.sf_r6)); 69ASSYM(PCB_R7, offsetof(struct pcb, pcb_regs.sf_r7)); 70ASSYM(PCB_R8, offsetof(struct pcb, pcb_regs.sf_r8)); 71ASSYM(PCB_R9, offsetof(struct pcb, pcb_regs.sf_r9)); 72ASSYM(PCB_R10, offsetof(struct pcb, pcb_regs.sf_r10)); 73ASSYM(PCB_R11, offsetof(struct pcb, pcb_regs.sf_r11)); 74ASSYM(PCB_R12, offsetof(struct pcb, pcb_regs.sf_r12)); 75ASSYM(PCB_SP, offsetof(struct pcb, pcb_regs.sf_sp)); 76ASSYM(PCB_LR, offsetof(struct pcb, pcb_regs.sf_lr)); 77ASSYM(PCB_PC, offsetof(struct pcb, pcb_regs.sf_pc)); 78ASSYM(PCB_TPIDRURW, offsetof(struct pcb, pcb_regs.sf_tpidrurw)); 79 80ASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb)); 81ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread)); 82ASSYM(M_LEN, offsetof(struct mbuf, m_len)); 83ASSYM(M_DATA, offsetof(struct mbuf, m_data)); 84ASSYM(M_NEXT, offsetof(struct mbuf, m_next)); 85ASSYM(IP_SRC, offsetof(struct ip, ip_src)); 86ASSYM(IP_DST, offsetof(struct ip, ip_dst)); 87 88ASSYM(TD_PCB, offsetof(struct thread, td_pcb)); 89ASSYM(TD_FLAGS, offsetof(struct thread, td_flags)); 90ASSYM(TD_AST, offsetof(struct thread, td_ast)); 91ASSYM(TD_PROC, offsetof(struct thread, td_proc)); 92ASSYM(TD_MD, offsetof(struct thread, td_md)); 93ASSYM(TD_LOCK, offsetof(struct thread, td_lock)); 94 95ASSYM(TF_SPSR, offsetof(struct trapframe, tf_spsr)); 96ASSYM(TF_R0, offsetof(struct trapframe, tf_r0)); 97ASSYM(TF_R1, offsetof(struct trapframe, tf_r1)); 98ASSYM(TF_PC, offsetof(struct trapframe, tf_pc)); 99ASSYM(P_PID, offsetof(struct proc, p_pid)); 100ASSYM(P_FLAG, offsetof(struct proc, p_flag)); 101 102ASSYM(SIGF_UC, offsetof(struct sigframe, sf_uc)); 103 104#ifdef VFP 105ASSYM(PCB_VFPSTATE, offsetof(struct pcb, pcb_vfpstate)); 106#endif 107 108ASSYM(PC_CURPMAP, offsetof(struct pcpu, pc_curpmap)); 109ASSYM(PC_BP_HARDEN_KIND, offsetof(struct pcpu, pc_bp_harden_kind)); 110ASSYM(PCPU_BP_HARDEN_KIND_NONE, PCPU_BP_HARDEN_KIND_NONE); 111ASSYM(PCPU_BP_HARDEN_KIND_BPIALL, PCPU_BP_HARDEN_KIND_BPIALL); 112ASSYM(PCPU_BP_HARDEN_KIND_ICIALLU, PCPU_BP_HARDEN_KIND_ICIALLU); 113 114ASSYM(PAGE_SIZE, PAGE_SIZE); 115#ifdef PMAP_INCLUDE_PTE_SYNC 116ASSYM(PMAP_INCLUDE_PTE_SYNC, 1); 117#endif 118 119ASSYM(MAXCOMLEN, MAXCOMLEN); 120ASSYM(MAXCPU, MAXCPU); 121ASSYM(_NCPUWORDS, _NCPUWORDS); 122ASSYM(PCPU_SIZE, sizeof(struct pcpu)); 123ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace)); 124ASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap)); 125ASSYM(PM_ACTIVE, offsetof(struct pmap, pm_active)); 126ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid)); 127ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS); 128 129ASSYM(DCACHE_LINE_SIZE, offsetof(struct cpuinfo, dcache_line_size)); 130ASSYM(DCACHE_LINE_MASK, offsetof(struct cpuinfo, dcache_line_mask)); 131ASSYM(ICACHE_LINE_SIZE, offsetof(struct cpuinfo, icache_line_size)); 132ASSYM(ICACHE_LINE_MASK, offsetof(struct cpuinfo, icache_line_mask)); 133 134/* 135 * Emit the LOCORE_MAP_MB option as a #define only if the option was set. 136 */ 137#include "opt_locore.h" 138 139#ifdef LOCORE_MAP_MB 140ASSYM(LOCORE_MAP_MB, LOCORE_MAP_MB); 141#endif 142