genassym.c revision 205258
180709Sjake/*-
280709Sjake * Copyright (c) 2001 Jake Burkholder.
380709Sjake * All rights reserved.
480709Sjake *
580709Sjake * Redistribution and use in source and binary forms, with or without
680709Sjake * modification, are permitted provided that the following conditions
780709Sjake * are met:
880709Sjake * 1. Redistributions of source code must retain the above copyright
980709Sjake *    notice, this list of conditions and the following disclaimer.
1080709Sjake * 2. Redistributions in binary form must reproduce the above copyright
1180709Sjake *    notice, this list of conditions and the following disclaimer in the
1280709Sjake *    documentation and/or other materials provided with the distribution.
1380709Sjake *
1481337Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1580709Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1680709Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1781337Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1880709Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1980709Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2080709Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2180709Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2280709Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2380709Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2480709Sjake * SUCH DAMAGE.
2580709Sjake *
2680709Sjake *	from: @(#)genassym.c	5.11 (Berkeley) 5/10/91
2780709Sjake */
2880709Sjake
29145153Smarius#include <sys/cdefs.h>
30145153Smarius__FBSDID("$FreeBSD: head/sys/sparc64/sparc64/genassym.c 205258 2010-03-17 20:23:14Z marius $");
31145153Smarius
32118239Speter#include "opt_kstack_pages.h"
33118239Speter
3480709Sjake#include <sys/param.h>
3580709Sjake#include <sys/assym.h>
3682910Sjake#include <sys/ktr.h>
3780709Sjake#include <sys/proc.h>
3891783Sjake#include <sys/smp.h>
3984186Sjake#include <sys/vmmeter.h>
4080709Sjake
4180709Sjake#include <vm/vm.h>
4281381Sjake#include <vm/vm_page.h>
4381381Sjake#include <vm/vm_map.h>
4480709Sjake
45166105Smarius#ifdef SUN4U
4697001Sjake#include <machine/cache.h>
47166105Smarius#endif
48166105Smarius#ifdef SUN4V
49166105Smarius#include <machine/mmu.h>
50166105Smarius#endif
5180709Sjake#include <machine/pcb.h>
5280709Sjake#include <machine/setjmp.h>
5389052Sjake#include <machine/smp.h>
54166105Smarius#include <machine/tlb.h>
5580709Sjake#include <machine/tte.h>
56163146Skmacy#ifdef SUN4V
57163965Skmacy#include <machine/trap.h>
58163146Skmacy#include <machine/tte_hash.h>
59163146Skmacy#endif
60166105Smarius#include <machine/vmparam.h>
6180709Sjake
6283756SjakeASSYM(KERNBASE, KERNBASE);
6383756Sjake
6483366SjulianASSYM(KSTACK_PAGES, KSTACK_PAGES);
6591360SjakeASSYM(PCPU_PAGES, PCPU_PAGES);
6680709Sjake
6791224SjakeASSYM(TAR_VPN_SHIFT, TAR_VPN_SHIFT);
6891224Sjake
69182768Smarius#ifdef SUN4U
70182768SmariusASSYM(TLB_DEMAP_ALL, TLB_DEMAP_ALL);
71182768Smarius#endif
72182768SmariusASSYM(TLB_DEMAP_CONTEXT, TLB_DEMAP_CONTEXT);
7381381SjakeASSYM(TLB_DEMAP_NUCLEUS, TLB_DEMAP_NUCLEUS);
74182768SmariusASSYM(TLB_DEMAP_PAGE, TLB_DEMAP_PAGE);
7591783SjakeASSYM(TLB_DEMAP_PRIMARY, TLB_DEMAP_PRIMARY);
7681381Sjake
7791336SjakeASSYM(INT_SHIFT, INT_SHIFT);
7891336SjakeASSYM(PTR_SHIFT, PTR_SHIFT);
7991336Sjake
8080709SjakeASSYM(PAGE_SHIFT, PAGE_SHIFT);
81102040SjakeASSYM(PAGE_SHIFT_8K, PAGE_SHIFT_8K);
82102040SjakeASSYM(PAGE_SHIFT_4M, PAGE_SHIFT_4M);
83102040SjakeASSYM(PAGE_SIZE, PAGE_SIZE);
84163146SkmacyASSYM(PAGE_SIZE_4M, PAGE_SIZE_4M);
8580709Sjake
86183142Smarius#ifdef SMP
8791783SjakeASSYM(CSA_PCPU, offsetof(struct cpu_start_args, csa_pcpu));
8889052SjakeASSYM(CSA_STATE, offsetof(struct cpu_start_args, csa_state));
89166105Smarius#ifdef SUN4U
90182730SmariusASSYM(CSA_MID, offsetof(struct cpu_start_args, csa_mid));
91182730SmariusASSYM(CSA_STICK, offsetof(struct cpu_start_args, csa_stick));
9291617SjakeASSYM(CSA_TICK, offsetof(struct cpu_start_args, csa_tick));
93182730SmariusASSYM(CSA_TTES, offsetof(struct cpu_start_args, csa_ttes));
9491617SjakeASSYM(CSA_VER, offsetof(struct cpu_start_args, csa_ver));
95166105Smarius#endif
96166105Smarius#ifdef SUN4V
97163152SkmacyASSYM(CSA_CPUID, offsetof(struct cpu_start_args, csa_cpuid));
98163146Skmacy#endif
99183142Smarius#endif
10097001Sjake
101166105Smarius#ifdef SUN4U
10297001SjakeASSYM(DC_SIZE, offsetof(struct cacheinfo, dc_size));
10397001SjakeASSYM(DC_LINESIZE, offsetof(struct cacheinfo, dc_linesize));
10497001SjakeASSYM(IC_SIZE, offsetof(struct cacheinfo, ic_size));
10597001SjakeASSYM(IC_LINESIZE, offsetof(struct cacheinfo, ic_linesize));
106166105Smarius#endif
10797001Sjake
108183142Smarius#ifdef SMP
10997001SjakeASSYM(ICA_PA, offsetof(struct ipi_cache_args, ica_pa));
110183142Smarius#endif
11197001Sjake
11282910SjakeASSYM(KTR_SIZEOF, sizeof(struct ktr_entry));
11393949SjakeASSYM(KTR_LINE, offsetof(struct ktr_entry, ktr_line));
11493949SjakeASSYM(KTR_FILE, offsetof(struct ktr_entry, ktr_file));
11582910SjakeASSYM(KTR_DESC, offsetof(struct ktr_entry, ktr_desc));
11692199SjakeASSYM(KTR_CPU, offsetof(struct ktr_entry, ktr_cpu));
11793503SjakeASSYM(KTR_TIMESTAMP, offsetof(struct ktr_entry, ktr_timestamp));
11893503SjakeASSYM(KTR_PARM1, offsetof(struct ktr_entry, ktr_parms[0]));
11993503SjakeASSYM(KTR_PARM2, offsetof(struct ktr_entry, ktr_parms[1]));
12093503SjakeASSYM(KTR_PARM3, offsetof(struct ktr_entry, ktr_parms[2]));
12193503SjakeASSYM(KTR_PARM4, offsetof(struct ktr_entry, ktr_parms[3]));
12293503SjakeASSYM(KTR_PARM5, offsetof(struct ktr_entry, ktr_parms[4]));
12393503SjakeASSYM(KTR_PARM6, offsetof(struct ktr_entry, ktr_parms[5]));
12482910Sjake
125163146SkmacyASSYM(TTE_SHIFT, TTE_SHIFT);
126166105Smarius#ifdef SUN4U
12791224SjakeASSYM(TTE_VPN, offsetof(struct tte, tte_vpn));
12880709SjakeASSYM(TTE_DATA, offsetof(struct tte, tte_data));
12980709Sjake
130182916SmariusASSYM(TD_V, TD_V);
13181614SjakeASSYM(TD_EXEC, TD_EXEC);
13280709SjakeASSYM(TD_REF, TD_REF);
13388657SjakeASSYM(TD_SW, TD_SW);
134182916SmariusASSYM(TD_L, TD_L);
135100771SjakeASSYM(TD_CP, TD_CP);
136100771SjakeASSYM(TD_CV, TD_CV);
13780709SjakeASSYM(TD_W, TD_W);
13880709Sjake
139102040SjakeASSYM(TS_MIN, TS_MIN);
140102040SjakeASSYM(TS_MAX, TS_MAX);
141182916SmariusASSYM(TLB_DAR_SLOT_SHIFT, TLB_DAR_SLOT_SHIFT);
142205258SmariusASSYM(TLB_CXR_PGSZ_MASK, TLB_CXR_PGSZ_MASK);
143163146SkmacyASSYM(TLB_DIRECT_TO_TTE_MASK, TLB_DIRECT_TO_TTE_MASK);
144102040SjakeASSYM(TV_SIZE_BITS, TV_SIZE_BITS);
145166105Smarius#endif
146166105Smarius
147166105Smarius#ifdef SUN4V
148163146SkmacyASSYM(VTD_REF, VTD_REF);
149163146SkmacyASSYM(VTD_W, VTD_W);
150163146SkmacyASSYM(VTD_SW_W, VTD_SW_W);
151163146SkmacyASSYM(VTD_LOCK, VTD_LOCK);
152102040Sjake
153163146SkmacyASSYM(THE_SHIFT, THE_SHIFT);
154163146SkmacyASSYM(PM_HASHSCRATCH, offsetof(struct pmap, pm_hashscratch));
155163146SkmacyASSYM(PM_TSBSCRATCH, offsetof(struct pmap, pm_tsbscratch));
156163146SkmacyASSYM(PM_TSB_RA, offsetof(struct pmap, pm_tsb_ra));
157163146SkmacyASSYM(PM_TLBACTIVE, offsetof(struct pmap, pm_tlbactive));
158163146SkmacyASSYM(HASH_ENTRY_SHIFT, HASH_ENTRY_SHIFT);
159163146Skmacy#endif
160163146Skmacy
16184186SjakeASSYM(V_INTR, offsetof(struct vmmeter, v_intr));
16284186Sjake
16387702SjhbASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread));
16487702SjhbASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb));
16587702SjhbASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid));
16691337SjakeASSYM(PC_CPUMASK, offsetof(struct pcpu, pc_cpumask));
16797265SjakeASSYM(PC_IRHEAD, offsetof(struct pcpu, pc_irhead));
16897265SjakeASSYM(PC_IRTAIL, offsetof(struct pcpu, pc_irtail));
16997265SjakeASSYM(PC_IRFREE, offsetof(struct pcpu, pc_irfree));
170163146SkmacyASSYM(PC_CNT, offsetof(struct pcpu, pc_cnt));
171163146SkmacyASSYM(PC_SIZEOF, sizeof(struct pcpu));
172163146Skmacy
173163146Skmacy#ifdef SUN4V
174163146SkmacyASSYM(PC_CPU_Q_RA, offsetof(struct pcpu, pc_cpu_q_ra));
175163146SkmacyASSYM(PC_CPU_Q_SIZE, offsetof(struct pcpu, pc_cpu_q_size));
176163146SkmacyASSYM(PC_DEV_Q_RA, offsetof(struct pcpu, pc_dev_q_ra));
177163146SkmacyASSYM(PC_DEV_Q_SIZE, offsetof(struct pcpu, pc_dev_q_size));
178163146Skmacy
179163146SkmacyASSYM(PC_RQ_BASE, offsetof(struct pcpu, pc_rq_ra));
180163146SkmacyASSYM(PC_RQ_SIZE, offsetof(struct pcpu, pc_rq_size));
181163146SkmacyASSYM(PC_NRQ_BASE, offsetof(struct pcpu, pc_nrq_ra));
182163146SkmacyASSYM(PC_NRQ_SIZE, offsetof(struct pcpu, pc_nrq_size));
183163146SkmacyASSYM(PC_MONDO_DATA, offsetof(struct pcpu, pc_mondo_data));
184163146SkmacyASSYM(PC_MONDO_DATA_RA, offsetof(struct pcpu, pc_mondo_data_ra));
185163146Skmacy
186163146SkmacyASSYM(PC_KWBUF_FULL, offsetof(struct pcpu, pc_kwbuf_full));
187163146SkmacyASSYM(PC_KWBUF_SP, offsetof(struct pcpu, pc_kwbuf_sp));
188163146SkmacyASSYM(PC_KWBUF, offsetof(struct pcpu, pc_kwbuf));
189163146SkmacyASSYM(PC_PAD, offsetof(struct pcpu, pad));
190163146SkmacyASSYM(PC_PMAP, offsetof(struct pcpu, pc_curpmap));
191163146SkmacyASSYM(PC_TSBWBUF, offsetof(struct pcpu, pc_tsbwbuf));
192163146Skmacy
193163146SkmacyASSYM(PCB_KSTACK, offsetof(struct pcb, pcb_kstack));
194164737SkmacyASSYM(PCB_TSTATE, offsetof(struct pcb, pcb_tstate));
195164737SkmacyASSYM(PCB_TPC, offsetof(struct pcb, pcb_tpc));
196164737SkmacyASSYM(PCB_TNPC, offsetof(struct pcb, pcb_tnpc));
197164737SkmacyASSYM(PCB_TT, offsetof(struct pcb, pcb_tt));
198164737SkmacyASSYM(PCB_SFAR, offsetof(struct pcb, pcb_sfar));
199164485SkmacyASSYM(PM_TSB_MISS_COUNT, offsetof(struct pmap, pm_tsb_miss_count));
200164485SkmacyASSYM(PM_TSB_CAP_MISS_COUNT, offsetof(struct pmap, pm_tsb_cap_miss_count));
201166105Smarius#endif
202166105Smarius#ifdef SUN4U
203182689SmariusASSYM(PC_CACHE, offsetof(struct pcpu, pc_cache));
20489052SjakeASSYM(PC_MID, offsetof(struct pcpu, pc_mid));
205182689SmariusASSYM(PC_PMAP, offsetof(struct pcpu, pc_pmap));
20691613SjakeASSYM(PC_TLB_CTX, offsetof(struct pcpu, pc_tlb_ctx));
20791613SjakeASSYM(PC_TLB_CTX_MAX, offsetof(struct pcpu, pc_tlb_ctx_max));
20891613SjakeASSYM(PC_TLB_CTX_MIN, offsetof(struct pcpu, pc_tlb_ctx_min));
209166105Smarius#endif
21080709Sjake
21197265SjakeASSYM(IR_NEXT, offsetof(struct intr_request, ir_next));
21297265SjakeASSYM(IR_FUNC, offsetof(struct intr_request, ir_func));
21397265SjakeASSYM(IR_ARG, offsetof(struct intr_request, ir_arg));
21497265SjakeASSYM(IR_PRI, offsetof(struct intr_request, ir_pri));
21597265SjakeASSYM(IR_VEC, offsetof(struct intr_request, ir_vec));
21681614Sjake
217183142Smarius#ifdef SMP
21892199SjakeASSYM(ITA_MASK, offsetof(struct ipi_tlb_args, ita_mask));
21991783SjakeASSYM(ITA_PMAP, offsetof(struct ipi_tlb_args, ita_pmap));
22089052SjakeASSYM(ITA_START, offsetof(struct ipi_tlb_args, ita_start));
22189052SjakeASSYM(ITA_END, offsetof(struct ipi_tlb_args, ita_end));
22289052SjakeASSYM(ITA_VA, offsetof(struct ipi_tlb_args, ita_va));
223183142Smarius#endif
22489052Sjake
22581614SjakeASSYM(IV_FUNC, offsetof(struct intr_vector, iv_func));
22681614SjakeASSYM(IV_ARG, offsetof(struct intr_vector, iv_arg));
22781614SjakeASSYM(IV_PRI, offsetof(struct intr_vector, iv_pri));
22881614Sjake
229111032SjulianASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
230111032SjulianASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
23182910Sjake
23288788SjakeASSYM(MD_UTRAP, offsetof(struct mdproc, md_utrap));
23388788Sjake
23482910SjakeASSYM(P_COMM, offsetof(struct proc, p_comm));
23588657SjakeASSYM(P_MD, offsetof(struct proc, p_md));
23688657SjakeASSYM(P_PID, offsetof(struct proc, p_pid));
23780709SjakeASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace));
23880709Sjake
239111032SjulianASSYM(TD_FLAGS, offsetof(struct thread, td_flags));
24083366SjulianASSYM(TD_FRAME, offsetof(struct thread, td_frame));
24183366SjulianASSYM(TD_KSTACK, offsetof(struct thread, td_kstack));
242203185SmariusASSYM(TD_LOCK, offsetof(struct thread, td_lock));
24383366SjulianASSYM(TD_PCB, offsetof(struct thread, td_pcb));
24483366SjulianASSYM(TD_PROC, offsetof(struct thread, td_proc));
245163146SkmacyASSYM(TD_MD, offsetof(struct thread, td_md));
246163146SkmacyASSYM(MD_SAVED_PIL, offsetof(struct mdthread, md_saved_pil));
24783366Sjulian
24884186SjakeASSYM(PCB_SIZEOF, sizeof(struct pcb));
249113023SjakeASSYM(PCB_RW, offsetof(struct pcb, pcb_rw));
250113023SjakeASSYM(PCB_KFP, offsetof(struct pcb, pcb_kfp));
251112920SjakeASSYM(PCB_UFP, offsetof(struct pcb, pcb_ufp));
252113023SjakeASSYM(PCB_RWSP, offsetof(struct pcb, pcb_rwsp));
253112924SjakeASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags));
25482910SjakeASSYM(PCB_NSAVED, offsetof(struct pcb, pcb_nsaved));
255113023SjakeASSYM(PCB_PC, offsetof(struct pcb, pcb_pc));
256113023SjakeASSYM(PCB_SP, offsetof(struct pcb, pcb_sp));
257163965SkmacyASSYM(PCB_PAD, offsetof(struct pcb, pcb_pad));
258163146Skmacy
25981381SjakeASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap));
26088657SjakeASSYM(PM_ACTIVE, offsetof(struct pmap, pm_active));
26181381SjakeASSYM(PM_CONTEXT, offsetof(struct pmap, pm_context));
26288657SjakeASSYM(PM_TSB, offsetof(struct pmap, pm_tsb));
26381381Sjake
26488657SjakeASSYM(_JB_FP, offsetof(struct _jmp_buf, _jb[_JB_FP]));
26588657SjakeASSYM(_JB_PC, offsetof(struct _jmp_buf, _jb[_JB_PC]));
26688657SjakeASSYM(_JB_SP, offsetof(struct _jmp_buf, _jb[_JB_SP]));
26788657SjakeASSYM(_JB_SIGFLAG, offsetof(struct _jmp_buf, _jb[_JB_SIGFLAG]));
26888657SjakeASSYM(_JB_SIGMASK, offsetof(struct _jmp_buf, _jb[_JB_SIGMASK]));
26980709Sjake
27080709SjakeASSYM(TF_G0, offsetof(struct trapframe, tf_global[0]));
27180709SjakeASSYM(TF_G1, offsetof(struct trapframe, tf_global[1]));
27280709SjakeASSYM(TF_G2, offsetof(struct trapframe, tf_global[2]));
27380709SjakeASSYM(TF_G3, offsetof(struct trapframe, tf_global[3]));
27480709SjakeASSYM(TF_G4, offsetof(struct trapframe, tf_global[4]));
27580709SjakeASSYM(TF_G5, offsetof(struct trapframe, tf_global[5]));
27680709SjakeASSYM(TF_G6, offsetof(struct trapframe, tf_global[6]));
27780709SjakeASSYM(TF_G7, offsetof(struct trapframe, tf_global[7]));
27880709SjakeASSYM(TF_O0, offsetof(struct trapframe, tf_out[0]));
27980709SjakeASSYM(TF_O1, offsetof(struct trapframe, tf_out[1]));
28080709SjakeASSYM(TF_O2, offsetof(struct trapframe, tf_out[2]));
28180709SjakeASSYM(TF_O3, offsetof(struct trapframe, tf_out[3]));
28280709SjakeASSYM(TF_O4, offsetof(struct trapframe, tf_out[4]));
28380709SjakeASSYM(TF_O5, offsetof(struct trapframe, tf_out[5]));
28480709SjakeASSYM(TF_O6, offsetof(struct trapframe, tf_out[6]));
28580709SjakeASSYM(TF_O7, offsetof(struct trapframe, tf_out[7]));
286105733SjakeASSYM(TF_FPRS, offsetof(struct trapframe, tf_fprs));
28788657SjakeASSYM(TF_FSR, offsetof(struct trapframe, tf_fsr));
288105733SjakeASSYM(TF_GSR, offsetof(struct trapframe, tf_gsr));
289163146SkmacyASSYM(TF_PIL, offsetof(struct trapframe, tf_pil));
290166105Smarius#ifdef SUN4U
291105733SjakeASSYM(TF_LEVEL, offsetof(struct trapframe, tf_level));
29288657SjakeASSYM(TF_SFAR, offsetof(struct trapframe, tf_sfar));
293105733SjakeASSYM(TF_SFSR, offsetof(struct trapframe, tf_sfsr));
29488657SjakeASSYM(TF_TAR, offsetof(struct trapframe, tf_tar));
295163152SkmacyASSYM(TF_TYPE, offsetof(struct trapframe, tf_type));
296163152SkmacyASSYM(TF_Y, offsetof(struct trapframe, tf_y));
297166105Smarius#endif
298166105Smarius#ifdef SUN4V
299163146SkmacyASSYM(TF_ASI, offsetof(struct trapframe, tf_asi));
300163146Skmacy#endif
30188657SjakeASSYM(TF_TNPC, offsetof(struct trapframe, tf_tnpc));
30288657SjakeASSYM(TF_TPC, offsetof(struct trapframe, tf_tpc));
30380709SjakeASSYM(TF_TSTATE, offsetof(struct trapframe, tf_tstate));
30482910SjakeASSYM(TF_WSTATE, offsetof(struct trapframe, tf_wstate));
30580709SjakeASSYM(TF_SIZEOF, sizeof(struct trapframe));
30688788Sjake
307163146SkmacyASSYM(VM_MIN_DIRECT_ADDRESS, VM_MIN_DIRECT_ADDRESS);
308163146SkmacyASSYM(VM_MIN_PROM_ADDRESS, VM_MIN_PROM_ADDRESS);
309163146SkmacyASSYM(VM_MAX_PROM_ADDRESS, VM_MAX_PROM_ADDRESS);
310