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 331988 2018-04-04 06:11:05Z mmel $");
30129198Scognet#include <sys/param.h>
31299122Sjhb#include <sys/cpuset.h>
32129198Scognet#include <sys/systm.h>
33129198Scognet#include <sys/assym.h>
34331988Smmel#include <sys/pcpu.h>
35129198Scognet#include <sys/proc.h>
36129198Scognet#include <sys/mbuf.h>
37129198Scognet#include <sys/vmmeter.h>
38261252Simp#include <sys/bus.h>
39129198Scognet#include <vm/vm.h>
40239268Sgonzo#include <vm/vm_param.h>
41129198Scognet#include <vm/pmap.h>
42239268Sgonzo#include <vm/vm_map.h>
43284115Sandrew
44129198Scognet#include <machine/armreg.h>
45257200Sian#include <machine/frame.h>
46129198Scognet#include <machine/pcb.h>
47129198Scognet#include <machine/cpu.h>
48129198Scognet#include <machine/proc.h>
49129198Scognet#include <machine/cpufunc.h>
50279811Sian#include <machine/cpuinfo.h>
51137629Scognet#include <machine/intr.h>
52142570Scognet#include <machine/sysarch.h>
53327658Sian#include <machine/vmparam.h>	/* For KERNVIRTADDR */
54142570Scognet
55129198Scognet#include <netinet/in.h>
56129198Scognet#include <netinet/in_systm.h>
57129198Scognet#include <netinet/ip.h>
58129198Scognet#include <netinet/ip6.h>
59129198Scognet#include <netinet/ip_var.h>
60129198Scognet
61129198ScognetASSYM(KERNBASE, KERNBASE);
62327658SianASSYM(KERNVIRTADDR, KERNVIRTADDR);
63295036Smmel#if __ARM_ARCH >= 6
64280712SianASSYM(CPU_ASID_KERNEL,CPU_ASID_KERNEL);
65280712Sian#endif
66129198ScognetASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault));
67295036Smmel#if __ARM_ARCH < 6
68129198ScognetASSYM(PCB_DACR, offsetof(struct pcb, pcb_dacr));
69280712Sian#endif
70129198ScognetASSYM(PCB_PAGEDIR, offsetof(struct pcb, pcb_pagedir));
71295036Smmel#if __ARM_ARCH < 6
72129198ScognetASSYM(PCB_L1VEC, offsetof(struct pcb, pcb_l1vec));
73129198ScognetASSYM(PCB_PL1VEC, offsetof(struct pcb, pcb_pl1vec));
74280712Sian#endif
75276190SianASSYM(PCB_R4, offsetof(struct pcb, pcb_regs.sf_r4));
76276190SianASSYM(PCB_R5, offsetof(struct pcb, pcb_regs.sf_r5));
77276190SianASSYM(PCB_R6, offsetof(struct pcb, pcb_regs.sf_r6));
78276190SianASSYM(PCB_R7, offsetof(struct pcb, pcb_regs.sf_r7));
79276190SianASSYM(PCB_R8, offsetof(struct pcb, pcb_regs.sf_r8));
80276190SianASSYM(PCB_R9, offsetof(struct pcb, pcb_regs.sf_r9));
81276190SianASSYM(PCB_R10, offsetof(struct pcb, pcb_regs.sf_r10));
82276190SianASSYM(PCB_R11, offsetof(struct pcb, pcb_regs.sf_r11));
83276190SianASSYM(PCB_R12, offsetof(struct pcb, pcb_regs.sf_r12));
84276190SianASSYM(PCB_SP, offsetof(struct pcb, pcb_regs.sf_sp));
85276190SianASSYM(PCB_LR, offsetof(struct pcb, pcb_regs.sf_lr));
86276190SianASSYM(PCB_PC, offsetof(struct pcb, pcb_regs.sf_pc));
87307136Sed#if __ARM_ARCH >= 6
88307136SedASSYM(PCB_TPIDRURW, offsetof(struct pcb, pcb_regs.sf_tpidrurw));
89307136Sed#endif
90129198Scognet
91129198ScognetASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb));
92129198ScognetASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread));
93129198ScognetASSYM(M_LEN, offsetof(struct mbuf, m_len));
94129198ScognetASSYM(M_DATA, offsetof(struct mbuf, m_data));
95129198ScognetASSYM(M_NEXT, offsetof(struct mbuf, m_next));
96129198ScognetASSYM(IP_SRC, offsetof(struct ip, ip_src));
97129198ScognetASSYM(IP_DST, offsetof(struct ip, ip_dst));
98317002Smmel#if __ARM_ARCH < 6
99129198ScognetASSYM(CF_CONTEXT_SWITCH, offsetof(struct cpu_functions, cf_context_switch));
100129198ScognetASSYM(CF_DCACHE_WB_RANGE, offsetof(struct cpu_functions, cf_dcache_wb_range));
101129198ScognetASSYM(CF_IDCACHE_WBINV_ALL, offsetof(struct cpu_functions, cf_idcache_wbinv_all));
102183838SrajASSYM(CF_L2CACHE_WBINV_ALL, offsetof(struct cpu_functions, cf_l2cache_wbinv_all));
103129198ScognetASSYM(CF_TLB_FLUSHID_SE, offsetof(struct cpu_functions, cf_tlb_flushID_SE));
104317002Smmel#endif
105129198Scognet
106129198ScognetASSYM(TD_PCB, offsetof(struct thread, td_pcb));
107129198ScognetASSYM(TD_FLAGS, offsetof(struct thread, td_flags));
108129198ScognetASSYM(TD_PROC, offsetof(struct thread, td_proc));
109142570ScognetASSYM(TD_MD, offsetof(struct thread, td_md));
110171788ScognetASSYM(TD_LOCK, offsetof(struct thread, td_lock));
111307136Sed#if __ARM_ARCH < 6
112142570ScognetASSYM(MD_TP, offsetof(struct mdthread, md_tp));
113188540ScognetASSYM(MD_RAS_START, offsetof(struct mdthread, md_ras_start));
114188540ScognetASSYM(MD_RAS_END, offsetof(struct mdthread, md_ras_end));
115301700Sandrew#endif
116129198Scognet
117291852SandrewASSYM(TF_SPSR, offsetof(struct trapframe, tf_spsr));
118129198ScognetASSYM(TF_R0, offsetof(struct trapframe, tf_r0));
119129198ScognetASSYM(TF_R1, offsetof(struct trapframe, tf_r1));
120129198ScognetASSYM(TF_PC, offsetof(struct trapframe, tf_pc));
121129198ScognetASSYM(P_PID, offsetof(struct proc, p_pid));
122129198ScognetASSYM(P_FLAG, offsetof(struct proc, p_flag));
123129198Scognet
124262903SianASSYM(SIGF_UC, offsetof(struct sigframe, sf_uc));
125262903Sian
126284115Sandrew#if __ARM_ARCH < 6
127142570ScognetASSYM(ARM_TP_ADDRESS, ARM_TP_ADDRESS);
128175982SrajASSYM(ARM_RAS_START, ARM_RAS_START);
129175982SrajASSYM(ARM_RAS_END, ARM_RAS_END);
130239268Sgonzo#endif
131239268Sgonzo
132254461Sandrew#ifdef VFP
133239268SgonzoASSYM(PCB_VFPSTATE, offsetof(struct pcb, pcb_vfpstate));
134284771Sian#endif
135239268Sgonzo
136284871Sandrew#if __ARM_ARCH >= 6
137239268SgonzoASSYM(PC_CURPMAP, offsetof(struct pcpu, pc_curpmap));
138331988SmmelASSYM(PC_BP_HARDEN_KIND, offsetof(struct pcpu, pc_bp_harden_kind));
139331988SmmelASSYM(PCPU_BP_HARDEN_KIND_NONE, PCPU_BP_HARDEN_KIND_NONE);
140331988SmmelASSYM(PCPU_BP_HARDEN_KIND_BPIALL, PCPU_BP_HARDEN_KIND_BPIALL);
141331988SmmelASSYM(PCPU_BP_HARDEN_KIND_ICIALLU, PCPU_BP_HARDEN_KIND_ICIALLU);
142284871Sandrew#endif
143239268Sgonzo
144150996ScognetASSYM(PAGE_SIZE, PAGE_SIZE);
145295703Sskra#if __ARM_ARCH < 6
146129198ScognetASSYM(PMAP_DOMAIN_KERNEL, PMAP_DOMAIN_KERNEL);
147295703Sskra#endif
148135651Scognet#ifdef PMAP_INCLUDE_PTE_SYNC
149135651ScognetASSYM(PMAP_INCLUDE_PTE_SYNC, 1);
150135651Scognet#endif
151129198ScognetASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
152135651ScognetASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
153137629Scognet
154137629ScognetASSYM(MAXCOMLEN, MAXCOMLEN);
155276395SianASSYM(MAXCPU, MAXCPU);
156280712SianASSYM(_NCPUWORDS, _NCPUWORDS);
157137629ScognetASSYM(NIRQ, NIRQ);
158261415ScognetASSYM(PCPU_SIZE, sizeof(struct pcpu));
159280712SianASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace));
160280712SianASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap));
161280712SianASSYM(PM_ACTIVE, offsetof(struct pmap, pm_active));
162280712SianASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid));
163289372SkibASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS);
164279811Sian
165279811SianASSYM(DCACHE_LINE_SIZE, offsetof(struct cpuinfo, dcache_line_size));
166279811SianASSYM(DCACHE_LINE_MASK, offsetof(struct cpuinfo, dcache_line_mask));
167279811SianASSYM(ICACHE_LINE_SIZE, offsetof(struct cpuinfo, icache_line_size));
168279811SianASSYM(ICACHE_LINE_MASK, offsetof(struct cpuinfo, icache_line_mask));
169327667Sian
170327667Sian/*
171327667Sian * Emit the LOCORE_MAP_MB option as a #define only if the option was set.
172327667Sian */
173327667Sian#include "opt_locore.h"
174327667Sian
175327667Sian#ifdef LOCORE_MAP_MB
176327667SianASSYM(LOCORE_MAP_MB, LOCORE_MAP_MB);
177327667Sian#endif
178