genassym.c revision 182878
11556Srgrimes/*-
21556Srgrimes * Copyright (c) 2001 Jake Burkholder.
31556Srgrimes * All rights reserved.
41556Srgrimes *
51556Srgrimes * Redistribution and use in source and binary forms, with or without
61556Srgrimes * modification, are permitted provided that the following conditions
71556Srgrimes * are met:
81556Srgrimes * 1. Redistributions of source code must retain the above copyright
91556Srgrimes *    notice, this list of conditions and the following disclaimer.
101556Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
111556Srgrimes *    notice, this list of conditions and the following disclaimer in the
121556Srgrimes *    documentation and/or other materials provided with the distribution.
131556Srgrimes *
141556Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
151556Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
161556Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
171556Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
181556Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
191556Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
201556Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
211556Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
221556Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
231556Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
241556Srgrimes * SUCH DAMAGE.
251556Srgrimes *
261556Srgrimes *	from: @(#)genassym.c	5.11 (Berkeley) 5/10/91
271556Srgrimes */
281556Srgrimes
291556Srgrimes#include <sys/cdefs.h>
301556Srgrimes__FBSDID("$FreeBSD: head/sys/sparc64/sparc64/genassym.c 182878 2008-09-08 21:24:25Z marius $");
311556Srgrimes
3217987Speter#include "opt_kstack_pages.h"
3350471Speter
341556Srgrimes#include <sys/param.h>
351556Srgrimes#include <sys/assym.h>
361556Srgrimes#include <sys/ktr.h>
371556Srgrimes#include <sys/proc.h>
381556Srgrimes#include <sys/smp.h>
391556Srgrimes#include <sys/vmmeter.h>
401556Srgrimes
4138536Scracauer#include <vm/vm.h>
421556Srgrimes#include <vm/vm_page.h>
431556Srgrimes#include <vm/vm_map.h>
441556Srgrimes
451556Srgrimes#ifdef SUN4U
461556Srgrimes#include <machine/cache.h>
471556Srgrimes#endif
481556Srgrimes#ifdef SUN4V
491556Srgrimes#include <machine/mmu.h>
501556Srgrimes#endif
5128346Ssteve#include <machine/pcb.h>
5228346Ssteve#include <machine/setjmp.h>
531556Srgrimes#include <machine/smp.h>
541556Srgrimes#include <machine/tlb.h>
551556Srgrimes#include <machine/tte.h>
561556Srgrimes#ifdef SUN4V
571556Srgrimes#include <machine/trap.h>
581556Srgrimes#include <machine/tte_hash.h>
591556Srgrimes#endif
601556Srgrimes#include <machine/vmparam.h>
611556Srgrimes
621556SrgrimesASSYM(KERNBASE, KERNBASE);
631556Srgrimes
641556SrgrimesASSYM(KSTACK_PAGES, KSTACK_PAGES);
651556SrgrimesASSYM(PCPU_PAGES, PCPU_PAGES);
66100308Stjr
671556SrgrimesASSYM(TAR_VPN_SHIFT, TAR_VPN_SHIFT);
681556Srgrimes
691556Srgrimes#ifdef SUN4U
70100305StjrASSYM(TLB_DEMAP_ALL, TLB_DEMAP_ALL);
711556Srgrimes#endif
721556SrgrimesASSYM(TLB_DEMAP_CONTEXT, TLB_DEMAP_CONTEXT);
7397659StjrASSYM(TLB_DEMAP_NUCLEUS, TLB_DEMAP_NUCLEUS);
741556SrgrimesASSYM(TLB_DEMAP_PAGE, TLB_DEMAP_PAGE);
751556SrgrimesASSYM(TLB_DEMAP_PRIMARY, TLB_DEMAP_PRIMARY);
761556Srgrimes
77163085SstefanfASSYM(INT_SHIFT, INT_SHIFT);
78163085SstefanfASSYM(PTR_SHIFT, PTR_SHIFT);
79163085Sstefanf
80163085SstefanfASSYM(PAGE_SHIFT, PAGE_SHIFT);
81163085SstefanfASSYM(PAGE_SHIFT_8K, PAGE_SHIFT_8K);
82163085SstefanfASSYM(PAGE_SHIFT_4M, PAGE_SHIFT_4M);
83163085SstefanfASSYM(PAGE_SIZE, PAGE_SIZE);
8428346SsteveASSYM(PAGE_SIZE_4M, PAGE_SIZE_4M);
851556Srgrimes
8638536ScracauerASSYM(CSA_PCPU, offsetof(struct cpu_start_args, csa_pcpu));
8738950ScracauerASSYM(CSA_STATE, offsetof(struct cpu_start_args, csa_state));
8839056Scracauer#ifdef SUN4U
891556SrgrimesASSYM(CSA_MID, offsetof(struct cpu_start_args, csa_mid));
9090111SimpASSYM(CSA_STICK, offsetof(struct cpu_start_args, csa_stick));
9190111SimpASSYM(CSA_TICK, offsetof(struct cpu_start_args, csa_tick));
9290111SimpASSYM(CSA_TTES, offsetof(struct cpu_start_args, csa_ttes));
9390111SimpASSYM(CSA_VER, offsetof(struct cpu_start_args, csa_ver));
94163085Sstefanf#endif
9590111Simp#ifdef SUN4V
9690111SimpASSYM(CSA_CPUID, offsetof(struct cpu_start_args, csa_cpuid));
9790111Simp#endif
98100308Stjr
9990111Simp#ifdef SUN4U
10090111SimpASSYM(DC_SIZE, offsetof(struct cacheinfo, dc_size));
10190111SimpASSYM(DC_LINESIZE, offsetof(struct cacheinfo, dc_linesize));
1021556SrgrimesASSYM(IC_SIZE, offsetof(struct cacheinfo, ic_size));
1031556SrgrimesASSYM(IC_LINESIZE, offsetof(struct cacheinfo, ic_linesize));
1041556Srgrimes#endif
1051556Srgrimes
106ASSYM(ICA_PA, offsetof(struct ipi_cache_args, ica_pa));
107
108ASSYM(KTR_SIZEOF, sizeof(struct ktr_entry));
109ASSYM(KTR_LINE, offsetof(struct ktr_entry, ktr_line));
110ASSYM(KTR_FILE, offsetof(struct ktr_entry, ktr_file));
111ASSYM(KTR_DESC, offsetof(struct ktr_entry, ktr_desc));
112ASSYM(KTR_CPU, offsetof(struct ktr_entry, ktr_cpu));
113ASSYM(KTR_TIMESTAMP, offsetof(struct ktr_entry, ktr_timestamp));
114ASSYM(KTR_PARM1, offsetof(struct ktr_entry, ktr_parms[0]));
115ASSYM(KTR_PARM2, offsetof(struct ktr_entry, ktr_parms[1]));
116ASSYM(KTR_PARM3, offsetof(struct ktr_entry, ktr_parms[2]));
117ASSYM(KTR_PARM4, offsetof(struct ktr_entry, ktr_parms[3]));
118ASSYM(KTR_PARM5, offsetof(struct ktr_entry, ktr_parms[4]));
119ASSYM(KTR_PARM6, offsetof(struct ktr_entry, ktr_parms[5]));
120
121ASSYM(TTE_SHIFT, TTE_SHIFT);
122#ifdef SUN4U
123ASSYM(TTE_VPN, offsetof(struct tte, tte_vpn));
124ASSYM(TTE_DATA, offsetof(struct tte, tte_data));
125
126ASSYM(TD_EXEC, TD_EXEC);
127ASSYM(TD_REF, TD_REF);
128ASSYM(TD_SW, TD_SW);
129ASSYM(TD_CP, TD_CP);
130ASSYM(TD_CV, TD_CV);
131ASSYM(TD_W, TD_W);
132
133ASSYM(TS_MIN, TS_MIN);
134ASSYM(TS_MAX, TS_MAX);
135ASSYM(TLB_PCXR_PGSZ_MASK, TLB_PCXR_PGSZ_MASK);
136ASSYM(TLB_DIRECT_TO_TTE_MASK, TLB_DIRECT_TO_TTE_MASK);
137ASSYM(TV_SIZE_BITS, TV_SIZE_BITS);
138#endif
139
140#ifdef SUN4V
141ASSYM(VTD_REF, VTD_REF);
142ASSYM(VTD_W, VTD_W);
143ASSYM(VTD_SW_W, VTD_SW_W);
144ASSYM(VTD_LOCK, VTD_LOCK);
145
146ASSYM(THE_SHIFT, THE_SHIFT);
147ASSYM(PM_HASHSCRATCH, offsetof(struct pmap, pm_hashscratch));
148ASSYM(PM_TSBSCRATCH, offsetof(struct pmap, pm_tsbscratch));
149ASSYM(PM_TSB_RA, offsetof(struct pmap, pm_tsb_ra));
150ASSYM(PM_TLBACTIVE, offsetof(struct pmap, pm_tlbactive));
151ASSYM(HASH_ENTRY_SHIFT, HASH_ENTRY_SHIFT);
152#endif
153
154ASSYM(V_INTR, offsetof(struct vmmeter, v_intr));
155
156ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread));
157ASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb));
158ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid));
159ASSYM(PC_CPUMASK, offsetof(struct pcpu, pc_cpumask));
160ASSYM(PC_IRHEAD, offsetof(struct pcpu, pc_irhead));
161ASSYM(PC_IRTAIL, offsetof(struct pcpu, pc_irtail));
162ASSYM(PC_IRFREE, offsetof(struct pcpu, pc_irfree));
163ASSYM(PC_CNT, offsetof(struct pcpu, pc_cnt));
164ASSYM(PC_SIZEOF, sizeof(struct pcpu));
165
166#ifdef SUN4V
167ASSYM(PC_CPU_Q_RA, offsetof(struct pcpu, pc_cpu_q_ra));
168ASSYM(PC_CPU_Q_SIZE, offsetof(struct pcpu, pc_cpu_q_size));
169ASSYM(PC_DEV_Q_RA, offsetof(struct pcpu, pc_dev_q_ra));
170ASSYM(PC_DEV_Q_SIZE, offsetof(struct pcpu, pc_dev_q_size));
171
172ASSYM(PC_RQ_BASE, offsetof(struct pcpu, pc_rq_ra));
173ASSYM(PC_RQ_SIZE, offsetof(struct pcpu, pc_rq_size));
174ASSYM(PC_NRQ_BASE, offsetof(struct pcpu, pc_nrq_ra));
175ASSYM(PC_NRQ_SIZE, offsetof(struct pcpu, pc_nrq_size));
176ASSYM(PC_MONDO_DATA, offsetof(struct pcpu, pc_mondo_data));
177ASSYM(PC_MONDO_DATA_RA, offsetof(struct pcpu, pc_mondo_data_ra));
178
179ASSYM(PC_KWBUF_FULL, offsetof(struct pcpu, pc_kwbuf_full));
180ASSYM(PC_KWBUF_SP, offsetof(struct pcpu, pc_kwbuf_sp));
181ASSYM(PC_KWBUF, offsetof(struct pcpu, pc_kwbuf));
182ASSYM(PC_PAD, offsetof(struct pcpu, pad));
183ASSYM(PC_PMAP, offsetof(struct pcpu, pc_curpmap));
184ASSYM(PC_TSBWBUF, offsetof(struct pcpu, pc_tsbwbuf));
185
186ASSYM(PCB_KSTACK, offsetof(struct pcb, pcb_kstack));
187ASSYM(PCB_TSTATE, offsetof(struct pcb, pcb_tstate));
188ASSYM(PCB_TPC, offsetof(struct pcb, pcb_tpc));
189ASSYM(PCB_TNPC, offsetof(struct pcb, pcb_tnpc));
190ASSYM(PCB_TT, offsetof(struct pcb, pcb_tt));
191ASSYM(PCB_SFAR, offsetof(struct pcb, pcb_sfar));
192ASSYM(PM_TSB_MISS_COUNT, offsetof(struct pmap, pm_tsb_miss_count));
193ASSYM(PM_TSB_CAP_MISS_COUNT, offsetof(struct pmap, pm_tsb_cap_miss_count));
194#endif
195#ifdef SUN4U
196ASSYM(PC_CACHE, offsetof(struct pcpu, pc_cache));
197ASSYM(PC_MID, offsetof(struct pcpu, pc_mid));
198ASSYM(PC_PMAP, offsetof(struct pcpu, pc_pmap));
199ASSYM(PC_TLB_CTX, offsetof(struct pcpu, pc_tlb_ctx));
200ASSYM(PC_TLB_CTX_MAX, offsetof(struct pcpu, pc_tlb_ctx_max));
201ASSYM(PC_TLB_CTX_MIN, offsetof(struct pcpu, pc_tlb_ctx_min));
202#endif
203
204ASSYM(IR_NEXT, offsetof(struct intr_request, ir_next));
205ASSYM(IR_FUNC, offsetof(struct intr_request, ir_func));
206ASSYM(IR_ARG, offsetof(struct intr_request, ir_arg));
207ASSYM(IR_PRI, offsetof(struct intr_request, ir_pri));
208ASSYM(IR_VEC, offsetof(struct intr_request, ir_vec));
209
210ASSYM(ITA_MASK, offsetof(struct ipi_tlb_args, ita_mask));
211ASSYM(ITA_PMAP, offsetof(struct ipi_tlb_args, ita_pmap));
212ASSYM(ITA_START, offsetof(struct ipi_tlb_args, ita_start));
213ASSYM(ITA_END, offsetof(struct ipi_tlb_args, ita_end));
214ASSYM(ITA_VA, offsetof(struct ipi_tlb_args, ita_va));
215
216ASSYM(IV_FUNC, offsetof(struct intr_vector, iv_func));
217ASSYM(IV_ARG, offsetof(struct intr_vector, iv_arg));
218ASSYM(IV_PRI, offsetof(struct intr_vector, iv_pri));
219
220ASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
221ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
222
223ASSYM(MD_UTRAP, offsetof(struct mdproc, md_utrap));
224
225ASSYM(P_COMM, offsetof(struct proc, p_comm));
226ASSYM(P_MD, offsetof(struct proc, p_md));
227ASSYM(P_PID, offsetof(struct proc, p_pid));
228ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace));
229
230ASSYM(TD_FLAGS, offsetof(struct thread, td_flags));
231ASSYM(TD_FRAME, offsetof(struct thread, td_frame));
232ASSYM(TD_KSTACK, offsetof(struct thread, td_kstack));
233ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
234ASSYM(TD_PROC, offsetof(struct thread, td_proc));
235ASSYM(TD_MD, offsetof(struct thread, td_md));
236ASSYM(MD_SAVED_PIL, offsetof(struct mdthread, md_saved_pil));
237
238ASSYM(PCB_SIZEOF, sizeof(struct pcb));
239ASSYM(PCB_RW, offsetof(struct pcb, pcb_rw));
240ASSYM(PCB_KFP, offsetof(struct pcb, pcb_kfp));
241ASSYM(PCB_UFP, offsetof(struct pcb, pcb_ufp));
242ASSYM(PCB_RWSP, offsetof(struct pcb, pcb_rwsp));
243ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags));
244ASSYM(PCB_NSAVED, offsetof(struct pcb, pcb_nsaved));
245ASSYM(PCB_PC, offsetof(struct pcb, pcb_pc));
246ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp));
247ASSYM(PCB_PAD, offsetof(struct pcb, pcb_pad));
248
249ASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap));
250ASSYM(PM_ACTIVE, offsetof(struct pmap, pm_active));
251ASSYM(PM_CONTEXT, offsetof(struct pmap, pm_context));
252ASSYM(PM_TSB, offsetof(struct pmap, pm_tsb));
253
254ASSYM(_JB_FP, offsetof(struct _jmp_buf, _jb[_JB_FP]));
255ASSYM(_JB_PC, offsetof(struct _jmp_buf, _jb[_JB_PC]));
256ASSYM(_JB_SP, offsetof(struct _jmp_buf, _jb[_JB_SP]));
257ASSYM(_JB_SIGFLAG, offsetof(struct _jmp_buf, _jb[_JB_SIGFLAG]));
258ASSYM(_JB_SIGMASK, offsetof(struct _jmp_buf, _jb[_JB_SIGMASK]));
259
260ASSYM(TF_G0, offsetof(struct trapframe, tf_global[0]));
261ASSYM(TF_G1, offsetof(struct trapframe, tf_global[1]));
262ASSYM(TF_G2, offsetof(struct trapframe, tf_global[2]));
263ASSYM(TF_G3, offsetof(struct trapframe, tf_global[3]));
264ASSYM(TF_G4, offsetof(struct trapframe, tf_global[4]));
265ASSYM(TF_G5, offsetof(struct trapframe, tf_global[5]));
266ASSYM(TF_G6, offsetof(struct trapframe, tf_global[6]));
267ASSYM(TF_G7, offsetof(struct trapframe, tf_global[7]));
268ASSYM(TF_O0, offsetof(struct trapframe, tf_out[0]));
269ASSYM(TF_O1, offsetof(struct trapframe, tf_out[1]));
270ASSYM(TF_O2, offsetof(struct trapframe, tf_out[2]));
271ASSYM(TF_O3, offsetof(struct trapframe, tf_out[3]));
272ASSYM(TF_O4, offsetof(struct trapframe, tf_out[4]));
273ASSYM(TF_O5, offsetof(struct trapframe, tf_out[5]));
274ASSYM(TF_O6, offsetof(struct trapframe, tf_out[6]));
275ASSYM(TF_O7, offsetof(struct trapframe, tf_out[7]));
276ASSYM(TF_FPRS, offsetof(struct trapframe, tf_fprs));
277ASSYM(TF_FSR, offsetof(struct trapframe, tf_fsr));
278ASSYM(TF_GSR, offsetof(struct trapframe, tf_gsr));
279ASSYM(TF_PIL, offsetof(struct trapframe, tf_pil));
280#ifdef SUN4U
281ASSYM(TF_LEVEL, offsetof(struct trapframe, tf_level));
282ASSYM(TF_SFAR, offsetof(struct trapframe, tf_sfar));
283ASSYM(TF_SFSR, offsetof(struct trapframe, tf_sfsr));
284ASSYM(TF_TAR, offsetof(struct trapframe, tf_tar));
285ASSYM(TF_TYPE, offsetof(struct trapframe, tf_type));
286ASSYM(TF_Y, offsetof(struct trapframe, tf_y));
287#endif
288#ifdef SUN4V
289ASSYM(TF_ASI, offsetof(struct trapframe, tf_asi));
290#endif
291ASSYM(TF_TNPC, offsetof(struct trapframe, tf_tnpc));
292ASSYM(TF_TPC, offsetof(struct trapframe, tf_tpc));
293ASSYM(TF_TSTATE, offsetof(struct trapframe, tf_tstate));
294ASSYM(TF_WSTATE, offsetof(struct trapframe, tf_wstate));
295ASSYM(TF_SIZEOF, sizeof(struct trapframe));
296
297ASSYM(VM_MIN_DIRECT_ADDRESS, VM_MIN_DIRECT_ADDRESS);
298ASSYM(VM_MIN_PROM_ADDRESS, VM_MIN_PROM_ADDRESS);
299ASSYM(VM_MAX_PROM_ADDRESS, VM_MAX_PROM_ADDRESS);
300