1 /*- 2 * Copyright (c) 1982, 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * William Jolitz. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 4. Neither the name of the University nor the names of its contributors 17 * may be used to endorse or promote products derived from this software 18 * without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 33 * $FreeBSD$ 34 */ 35 36 #include <sys/param.h> 37 #include <sys/assym.h> 38 #include <sys/errno.h> 39 #include <sys/ktr.h> 40 #include <sys/proc.h> 41 #include <sys/queue.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/pmap.h> 52 #include <vm/vm_map.h> 53 54 #include <machine/pcb.h> 55 #include <machine/pmap.h> 56 #include <machine/sigframe.h> 57 58 ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread)); 59 ASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb)); 60 ASSYM(PC_CURPMAP, offsetof(struct pcpu, pc_curpmap)); 61 ASSYM(PC_TEMPSAVE, offsetof(struct pcpu, pc_tempsave)); 62 ASSYM(PC_DISISAVE, offsetof(struct pcpu, pc_disisave)); 63 ASSYM(PC_DBSAVE, offsetof(struct pcpu, pc_dbsave)); 64 65 #ifdef E500 66 ASSYM(PC_BOOKE_CRITSAVE, offsetof(struct pcpu, pc_booke_critsave)); 67 ASSYM(PC_BOOKE_MCHKSAVE, offsetof(struct pcpu, pc_booke_mchksave)); 68 ASSYM(PC_BOOKE_TLBSAVE, offsetof(struct pcpu, pc_booke_tlbsave)); 69 ASSYM(PC_BOOKE_TLB_LEVEL, offsetof(struct pcpu, pc_booke_tlb_level)); 70 #endif 71 72 ASSYM(CPUSAVE_R28, CPUSAVE_R28*4); 73 ASSYM(CPUSAVE_R29, CPUSAVE_R29*4); 74 ASSYM(CPUSAVE_R30, CPUSAVE_R30*4); 75 ASSYM(CPUSAVE_R31, CPUSAVE_R31*4); 76 ASSYM(CPUSAVE_SRR0, CPUSAVE_SRR0*4); 77 ASSYM(CPUSAVE_SRR1, CPUSAVE_SRR1*4); 78 ASSYM(CPUSAVE_AIM_DAR, CPUSAVE_AIM_DAR*4); 79 ASSYM(CPUSAVE_AIM_DSISR, CPUSAVE_AIM_DSISR*4); 80 ASSYM(CPUSAVE_BOOKE_DEAR, CPUSAVE_BOOKE_DEAR*4); 81 ASSYM(CPUSAVE_BOOKE_ESR, CPUSAVE_BOOKE_ESR*4); 82 83 ASSYM(TLBSAVE_BOOKE_LR, TLBSAVE_BOOKE_LR*4); 84 ASSYM(TLBSAVE_BOOKE_CR, TLBSAVE_BOOKE_CR*4); 85 ASSYM(TLBSAVE_BOOKE_SRR0, TLBSAVE_BOOKE_SRR0*4); 86 ASSYM(TLBSAVE_BOOKE_SRR1, TLBSAVE_BOOKE_SRR1*4); 87 ASSYM(TLBSAVE_BOOKE_R20, TLBSAVE_BOOKE_R20*4); 88 ASSYM(TLBSAVE_BOOKE_R21, TLBSAVE_BOOKE_R21*4); 89 ASSYM(TLBSAVE_BOOKE_R22, TLBSAVE_BOOKE_R22*4); 90 ASSYM(TLBSAVE_BOOKE_R23, TLBSAVE_BOOKE_R23*4); 91 ASSYM(TLBSAVE_BOOKE_R24, TLBSAVE_BOOKE_R24*4); 92 ASSYM(TLBSAVE_BOOKE_R25, TLBSAVE_BOOKE_R25*4); 93 ASSYM(TLBSAVE_BOOKE_R26, TLBSAVE_BOOKE_R26*4); 94 ASSYM(TLBSAVE_BOOKE_R27, TLBSAVE_BOOKE_R27*4); 95 ASSYM(TLBSAVE_BOOKE_R28, TLBSAVE_BOOKE_R28*4); 96 ASSYM(TLBSAVE_BOOKE_R29, TLBSAVE_BOOKE_R29*4); 97 ASSYM(TLBSAVE_BOOKE_R30, TLBSAVE_BOOKE_R30*4); 98 ASSYM(TLBSAVE_BOOKE_R31, TLBSAVE_BOOKE_R31*4); 99 100 ASSYM(MTX_LOCK, offsetof(struct mtx, mtx_lock)); 101 102 #if defined(AIM) 103 ASSYM(PM_KERNELSR, offsetof(struct pmap, pm_sr[KERNEL_SR])); 104 ASSYM(PM_USRSR, offsetof(struct pmap, pm_sr[USER_SR])); 105 ASSYM(PM_SR, offsetof(struct pmap, pm_sr)); 106 #elif defined(E500) 107 ASSYM(PM_PDIR, offsetof(struct pmap, pm_pdir)); 108 #endif 109 110 #if defined(E500) 111 ASSYM(PTE_RPN, offsetof(struct pte_entry, rpn)); 112 ASSYM(PTE_FLAGS, offsetof(struct pte_entry, flags)); 113 ASSYM(TLB0TABLE_MAS1, offsetof(struct tlb_entry, mas1)); 114 ASSYM(TLB0TABLE_MAS2, offsetof(struct tlb_entry, mas2)); 115 ASSYM(TLB0TABLE_MAS3, offsetof(struct tlb_entry, mas3)); 116 ASSYM(TLB0_ENTRY_SIZE, sizeof(struct tlb_entry)); 117 #endif 118 119 ASSYM(FSP, 8); 120 ASSYM(FRAMELEN, FRAMELEN); 121 ASSYM(FRAME_0, offsetof(struct trapframe, fixreg[0])); 122 ASSYM(FRAME_1, offsetof(struct trapframe, fixreg[1])); 123 ASSYM(FRAME_2, offsetof(struct trapframe, fixreg[2])); 124 ASSYM(FRAME_3, offsetof(struct trapframe, fixreg[3])); 125 ASSYM(FRAME_4, offsetof(struct trapframe, fixreg[4])); 126 ASSYM(FRAME_5, offsetof(struct trapframe, fixreg[5])); 127 ASSYM(FRAME_6, offsetof(struct trapframe, fixreg[6])); 128 ASSYM(FRAME_7, offsetof(struct trapframe, fixreg[7])); 129 ASSYM(FRAME_8, offsetof(struct trapframe, fixreg[8])); 130 ASSYM(FRAME_9, offsetof(struct trapframe, fixreg[9])); 131 ASSYM(FRAME_10, offsetof(struct trapframe, fixreg[10])); 132 ASSYM(FRAME_11, offsetof(struct trapframe, fixreg[11])); 133 ASSYM(FRAME_12, offsetof(struct trapframe, fixreg[12])); 134 ASSYM(FRAME_13, offsetof(struct trapframe, fixreg[13])); 135 ASSYM(FRAME_14, offsetof(struct trapframe, fixreg[14])); 136 ASSYM(FRAME_15, offsetof(struct trapframe, fixreg[15])); 137 ASSYM(FRAME_16, offsetof(struct trapframe, fixreg[16])); 138 ASSYM(FRAME_17, offsetof(struct trapframe, fixreg[17])); 139 ASSYM(FRAME_18, offsetof(struct trapframe, fixreg[18])); 140 ASSYM(FRAME_19, offsetof(struct trapframe, fixreg[19])); 141 ASSYM(FRAME_20, offsetof(struct trapframe, fixreg[20])); 142 ASSYM(FRAME_21, offsetof(struct trapframe, fixreg[21])); 143 ASSYM(FRAME_22, offsetof(struct trapframe, fixreg[22])); 144 ASSYM(FRAME_23, offsetof(struct trapframe, fixreg[23])); 145 ASSYM(FRAME_24, offsetof(struct trapframe, fixreg[24])); 146 ASSYM(FRAME_25, offsetof(struct trapframe, fixreg[25])); 147 ASSYM(FRAME_26, offsetof(struct trapframe, fixreg[26])); 148 ASSYM(FRAME_27, offsetof(struct trapframe, fixreg[27])); 149 ASSYM(FRAME_28, offsetof(struct trapframe, fixreg[28])); 150 ASSYM(FRAME_29, offsetof(struct trapframe, fixreg[29])); 151 ASSYM(FRAME_30, offsetof(struct trapframe, fixreg[30])); 152 ASSYM(FRAME_31, offsetof(struct trapframe, fixreg[31])); 153 ASSYM(FRAME_LR, offsetof(struct trapframe, lr)); 154 ASSYM(FRAME_CR, offsetof(struct trapframe, cr)); 155 ASSYM(FRAME_CTR, offsetof(struct trapframe, ctr)); 156 ASSYM(FRAME_XER, offsetof(struct trapframe, xer)); 157 ASSYM(FRAME_SRR0, offsetof(struct trapframe, srr0)); 158 ASSYM(FRAME_SRR1, offsetof(struct trapframe, srr1)); 159 ASSYM(FRAME_EXC, offsetof(struct trapframe, exc)); 160 ASSYM(FRAME_AIM_DAR, offsetof(struct trapframe, cpu.aim.dar)); 161 ASSYM(FRAME_AIM_DSISR, offsetof(struct trapframe, cpu.aim.dsisr)); 162 ASSYM(FRAME_BOOKE_DEAR, offsetof(struct trapframe, cpu.booke.dear)); 163 ASSYM(FRAME_BOOKE_ESR, offsetof(struct trapframe, cpu.booke.esr)); 164 165 ASSYM(CF_FUNC, offsetof(struct callframe, cf_func)); 166 ASSYM(CF_ARG0, offsetof(struct callframe, cf_arg0)); 167 ASSYM(CF_ARG1, offsetof(struct callframe, cf_arg1)); 168 ASSYM(CF_SIZE, sizeof(struct callframe)); 169 170 ASSYM(PCB_CONTEXT, offsetof(struct pcb, pcb_context)); 171 ASSYM(PCB_CR, offsetof(struct pcb, pcb_cr)); 172 ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp)); 173 ASSYM(PCB_LR, offsetof(struct pcb, pcb_lr)); 174 ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault)); 175 ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags)); 176 ASSYM(PCB_FPU, PCB_FPU); 177 178 ASSYM(PCB_AIM_USR, offsetof(struct pcb, pcb_cpu.aim.usr)); 179 ASSYM(PCB_BOOKE_CTR, offsetof(struct pcb, pcb_cpu.booke.ctr)); 180 ASSYM(PCB_BOOKE_XER, offsetof(struct pcb, pcb_cpu.booke.xer)); 181 182 ASSYM(TD_LOCK, offsetof(struct thread, td_lock)); 183 ASSYM(TD_PROC, offsetof(struct thread, td_proc)); 184 ASSYM(TD_PCB, offsetof(struct thread, td_pcb)); 185 186 ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace)); 187 188 ASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap)); 189 190 ASSYM(TD_FLAGS, offsetof(struct thread, td_flags)); 191 192 ASSYM(TDF_ASTPENDING, TDF_ASTPENDING); 193 ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED); 194 195 ASSYM(SF_UC, offsetof(struct sigframe, sf_uc)); 196 197 ASSYM(KERNBASE, KERNBASE); 198 ASSYM(MAXCOMLEN, MAXCOMLEN); 199