genassym.c revision 182689
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 182689 2008-09-02 21:13:54Z 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
6981381SjakeASSYM(TLB_DEMAP_NUCLEUS, TLB_DEMAP_NUCLEUS);
7091783SjakeASSYM(TLB_DEMAP_PRIMARY, TLB_DEMAP_PRIMARY);
7189052SjakeASSYM(TLB_DEMAP_CONTEXT, TLB_DEMAP_CONTEXT);
7288657SjakeASSYM(TLB_DEMAP_PAGE, TLB_DEMAP_PAGE);
7381381Sjake
7491336SjakeASSYM(INT_SHIFT, INT_SHIFT);
7591336SjakeASSYM(PTR_SHIFT, PTR_SHIFT);
7691336Sjake
7780709SjakeASSYM(PAGE_SHIFT, PAGE_SHIFT);
78102040SjakeASSYM(PAGE_SHIFT_8K, PAGE_SHIFT_8K);
79102040SjakeASSYM(PAGE_SHIFT_4M, PAGE_SHIFT_4M);
80102040SjakeASSYM(PAGE_SIZE, PAGE_SIZE);
81163146SkmacyASSYM(PAGE_SIZE_4M, PAGE_SIZE_4M);
8280709Sjake
8391783SjakeASSYM(CSA_PCPU, offsetof(struct cpu_start_args, csa_pcpu));
8489052SjakeASSYM(CSA_STATE, offsetof(struct cpu_start_args, csa_state));
85166105Smarius#ifdef SUN4U
8691617SjakeASSYM(CSA_TICK, offsetof(struct cpu_start_args, csa_tick));
8791617SjakeASSYM(CSA_VER, offsetof(struct cpu_start_args, csa_ver));
88163146SkmacyASSYM(CSA_MID, offsetof(struct cpu_start_args, csa_mid));
8991617SjakeASSYM(CSA_TTES, offsetof(struct cpu_start_args, csa_ttes));
90166105Smarius#endif
91166105Smarius#ifdef SUN4V
92163152SkmacyASSYM(CSA_CPUID, offsetof(struct cpu_start_args, csa_cpuid));
93163146Skmacy#endif
9497001Sjake
95166105Smarius#ifdef SUN4U
9697001SjakeASSYM(DC_SIZE, offsetof(struct cacheinfo, dc_size));
9797001SjakeASSYM(DC_LINESIZE, offsetof(struct cacheinfo, dc_linesize));
9897001SjakeASSYM(IC_SIZE, offsetof(struct cacheinfo, ic_size));
9997001SjakeASSYM(IC_LINESIZE, offsetof(struct cacheinfo, ic_linesize));
100166105Smarius#endif
10197001Sjake
10297001SjakeASSYM(ICA_PA, offsetof(struct ipi_cache_args, ica_pa));
10397001Sjake
10482910SjakeASSYM(KTR_SIZEOF, sizeof(struct ktr_entry));
10593949SjakeASSYM(KTR_LINE, offsetof(struct ktr_entry, ktr_line));
10693949SjakeASSYM(KTR_FILE, offsetof(struct ktr_entry, ktr_file));
10782910SjakeASSYM(KTR_DESC, offsetof(struct ktr_entry, ktr_desc));
10892199SjakeASSYM(KTR_CPU, offsetof(struct ktr_entry, ktr_cpu));
10993503SjakeASSYM(KTR_TIMESTAMP, offsetof(struct ktr_entry, ktr_timestamp));
11093503SjakeASSYM(KTR_PARM1, offsetof(struct ktr_entry, ktr_parms[0]));
11193503SjakeASSYM(KTR_PARM2, offsetof(struct ktr_entry, ktr_parms[1]));
11293503SjakeASSYM(KTR_PARM3, offsetof(struct ktr_entry, ktr_parms[2]));
11393503SjakeASSYM(KTR_PARM4, offsetof(struct ktr_entry, ktr_parms[3]));
11493503SjakeASSYM(KTR_PARM5, offsetof(struct ktr_entry, ktr_parms[4]));
11593503SjakeASSYM(KTR_PARM6, offsetof(struct ktr_entry, ktr_parms[5]));
11682910Sjake
117163146SkmacyASSYM(TTE_SHIFT, TTE_SHIFT);
118166105Smarius#ifdef SUN4U
11991224SjakeASSYM(TTE_VPN, offsetof(struct tte, tte_vpn));
12080709SjakeASSYM(TTE_DATA, offsetof(struct tte, tte_data));
12180709Sjake
12281614SjakeASSYM(TD_EXEC, TD_EXEC);
12380709SjakeASSYM(TD_REF, TD_REF);
12488657SjakeASSYM(TD_SW, TD_SW);
125100771SjakeASSYM(TD_CP, TD_CP);
126100771SjakeASSYM(TD_CV, TD_CV);
12780709SjakeASSYM(TD_W, TD_W);
12880709Sjake
129102040SjakeASSYM(TS_MIN, TS_MIN);
130102040SjakeASSYM(TS_MAX, TS_MAX);
131163146SkmacyASSYM(TLB_DIRECT_TO_TTE_MASK, TLB_DIRECT_TO_TTE_MASK);
132102040SjakeASSYM(TV_SIZE_BITS, TV_SIZE_BITS);
133166105Smarius#endif
134166105Smarius
135166105Smarius#ifdef SUN4V
136163146SkmacyASSYM(VTD_REF, VTD_REF);
137163146SkmacyASSYM(VTD_W, VTD_W);
138163146SkmacyASSYM(VTD_SW_W, VTD_SW_W);
139163146SkmacyASSYM(VTD_LOCK, VTD_LOCK);
140102040Sjake
141163146SkmacyASSYM(THE_SHIFT, THE_SHIFT);
142163146SkmacyASSYM(PM_HASHSCRATCH, offsetof(struct pmap, pm_hashscratch));
143163146SkmacyASSYM(PM_TSBSCRATCH, offsetof(struct pmap, pm_tsbscratch));
144163146SkmacyASSYM(PM_TSB_RA, offsetof(struct pmap, pm_tsb_ra));
145163146SkmacyASSYM(PM_TLBACTIVE, offsetof(struct pmap, pm_tlbactive));
146163146SkmacyASSYM(HASH_ENTRY_SHIFT, HASH_ENTRY_SHIFT);
147163146Skmacy#endif
148163146Skmacy
14984186SjakeASSYM(V_INTR, offsetof(struct vmmeter, v_intr));
15084186Sjake
15187702SjhbASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread));
15287702SjhbASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb));
15387702SjhbASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid));
15491337SjakeASSYM(PC_CPUMASK, offsetof(struct pcpu, pc_cpumask));
15597265SjakeASSYM(PC_IRHEAD, offsetof(struct pcpu, pc_irhead));
15697265SjakeASSYM(PC_IRTAIL, offsetof(struct pcpu, pc_irtail));
15797265SjakeASSYM(PC_IRFREE, offsetof(struct pcpu, pc_irfree));
158163146SkmacyASSYM(PC_CNT, offsetof(struct pcpu, pc_cnt));
159163146SkmacyASSYM(PC_SIZEOF, sizeof(struct pcpu));
160163146Skmacy
161163146Skmacy#ifdef SUN4V
162163146SkmacyASSYM(PC_CPU_Q_RA, offsetof(struct pcpu, pc_cpu_q_ra));
163163146SkmacyASSYM(PC_CPU_Q_SIZE, offsetof(struct pcpu, pc_cpu_q_size));
164163146SkmacyASSYM(PC_DEV_Q_RA, offsetof(struct pcpu, pc_dev_q_ra));
165163146SkmacyASSYM(PC_DEV_Q_SIZE, offsetof(struct pcpu, pc_dev_q_size));
166163146Skmacy
167163146SkmacyASSYM(PC_RQ_BASE, offsetof(struct pcpu, pc_rq_ra));
168163146SkmacyASSYM(PC_RQ_SIZE, offsetof(struct pcpu, pc_rq_size));
169163146SkmacyASSYM(PC_NRQ_BASE, offsetof(struct pcpu, pc_nrq_ra));
170163146SkmacyASSYM(PC_NRQ_SIZE, offsetof(struct pcpu, pc_nrq_size));
171163146SkmacyASSYM(PC_MONDO_DATA, offsetof(struct pcpu, pc_mondo_data));
172163146SkmacyASSYM(PC_MONDO_DATA_RA, offsetof(struct pcpu, pc_mondo_data_ra));
173163146Skmacy
174163146SkmacyASSYM(PC_KWBUF_FULL, offsetof(struct pcpu, pc_kwbuf_full));
175163146SkmacyASSYM(PC_KWBUF_SP, offsetof(struct pcpu, pc_kwbuf_sp));
176163146SkmacyASSYM(PC_KWBUF, offsetof(struct pcpu, pc_kwbuf));
177163146SkmacyASSYM(PC_PAD, offsetof(struct pcpu, pad));
178163146SkmacyASSYM(PC_PMAP, offsetof(struct pcpu, pc_curpmap));
179163146SkmacyASSYM(PC_TSBWBUF, offsetof(struct pcpu, pc_tsbwbuf));
180163146Skmacy
181163146SkmacyASSYM(PCB_KSTACK, offsetof(struct pcb, pcb_kstack));
182164737SkmacyASSYM(PCB_TSTATE, offsetof(struct pcb, pcb_tstate));
183164737SkmacyASSYM(PCB_TPC, offsetof(struct pcb, pcb_tpc));
184164737SkmacyASSYM(PCB_TNPC, offsetof(struct pcb, pcb_tnpc));
185164737SkmacyASSYM(PCB_TT, offsetof(struct pcb, pcb_tt));
186164737SkmacyASSYM(PCB_SFAR, offsetof(struct pcb, pcb_sfar));
187164485SkmacyASSYM(PM_TSB_MISS_COUNT, offsetof(struct pmap, pm_tsb_miss_count));
188164485SkmacyASSYM(PM_TSB_CAP_MISS_COUNT, offsetof(struct pmap, pm_tsb_cap_miss_count));
189166105Smarius#endif
190166105Smarius#ifdef SUN4U
191182689SmariusASSYM(PC_CACHE, offsetof(struct pcpu, pc_cache));
19289052SjakeASSYM(PC_MID, offsetof(struct pcpu, pc_mid));
193182689SmariusASSYM(PC_PMAP, offsetof(struct pcpu, pc_pmap));
19491613SjakeASSYM(PC_TLB_CTX, offsetof(struct pcpu, pc_tlb_ctx));
19591613SjakeASSYM(PC_TLB_CTX_MAX, offsetof(struct pcpu, pc_tlb_ctx_max));
19691613SjakeASSYM(PC_TLB_CTX_MIN, offsetof(struct pcpu, pc_tlb_ctx_min));
197166105Smarius#endif
19880709Sjake
19997265SjakeASSYM(IR_NEXT, offsetof(struct intr_request, ir_next));
20097265SjakeASSYM(IR_FUNC, offsetof(struct intr_request, ir_func));
20197265SjakeASSYM(IR_ARG, offsetof(struct intr_request, ir_arg));
20297265SjakeASSYM(IR_PRI, offsetof(struct intr_request, ir_pri));
20397265SjakeASSYM(IR_VEC, offsetof(struct intr_request, ir_vec));
20481614Sjake
20592199SjakeASSYM(ITA_MASK, offsetof(struct ipi_tlb_args, ita_mask));
20691783SjakeASSYM(ITA_PMAP, offsetof(struct ipi_tlb_args, ita_pmap));
20789052SjakeASSYM(ITA_START, offsetof(struct ipi_tlb_args, ita_start));
20889052SjakeASSYM(ITA_END, offsetof(struct ipi_tlb_args, ita_end));
20989052SjakeASSYM(ITA_VA, offsetof(struct ipi_tlb_args, ita_va));
21089052Sjake
21181614SjakeASSYM(IV_FUNC, offsetof(struct intr_vector, iv_func));
21281614SjakeASSYM(IV_ARG, offsetof(struct intr_vector, iv_arg));
21381614SjakeASSYM(IV_PRI, offsetof(struct intr_vector, iv_pri));
21481614Sjake
215111032SjulianASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
216111032SjulianASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
21782910Sjake
21888788SjakeASSYM(MD_UTRAP, offsetof(struct mdproc, md_utrap));
21988788Sjake
22082910SjakeASSYM(P_COMM, offsetof(struct proc, p_comm));
22188657SjakeASSYM(P_MD, offsetof(struct proc, p_md));
22288657SjakeASSYM(P_PID, offsetof(struct proc, p_pid));
22380709SjakeASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace));
22480709Sjake
225111032SjulianASSYM(TD_FLAGS, offsetof(struct thread, td_flags));
22683366SjulianASSYM(TD_FRAME, offsetof(struct thread, td_frame));
22783366SjulianASSYM(TD_KSTACK, offsetof(struct thread, td_kstack));
22883366SjulianASSYM(TD_PCB, offsetof(struct thread, td_pcb));
22983366SjulianASSYM(TD_PROC, offsetof(struct thread, td_proc));
230163146SkmacyASSYM(TD_MD, offsetof(struct thread, td_md));
231163146SkmacyASSYM(MD_SAVED_PIL, offsetof(struct mdthread, md_saved_pil));
23283366Sjulian
23384186SjakeASSYM(PCB_SIZEOF, sizeof(struct pcb));
234113023SjakeASSYM(PCB_RW, offsetof(struct pcb, pcb_rw));
235113023SjakeASSYM(PCB_KFP, offsetof(struct pcb, pcb_kfp));
236112920SjakeASSYM(PCB_UFP, offsetof(struct pcb, pcb_ufp));
237113023SjakeASSYM(PCB_RWSP, offsetof(struct pcb, pcb_rwsp));
238112924SjakeASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags));
23982910SjakeASSYM(PCB_NSAVED, offsetof(struct pcb, pcb_nsaved));
240113023SjakeASSYM(PCB_PC, offsetof(struct pcb, pcb_pc));
241113023SjakeASSYM(PCB_SP, offsetof(struct pcb, pcb_sp));
242163965SkmacyASSYM(PCB_PAD, offsetof(struct pcb, pcb_pad));
243163146Skmacy
24481381SjakeASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap));
24588657SjakeASSYM(PM_ACTIVE, offsetof(struct pmap, pm_active));
24681381SjakeASSYM(PM_CONTEXT, offsetof(struct pmap, pm_context));
24788657SjakeASSYM(PM_TSB, offsetof(struct pmap, pm_tsb));
24881381Sjake
24988657SjakeASSYM(_JB_FP, offsetof(struct _jmp_buf, _jb[_JB_FP]));
25088657SjakeASSYM(_JB_PC, offsetof(struct _jmp_buf, _jb[_JB_PC]));
25188657SjakeASSYM(_JB_SP, offsetof(struct _jmp_buf, _jb[_JB_SP]));
25288657SjakeASSYM(_JB_SIGFLAG, offsetof(struct _jmp_buf, _jb[_JB_SIGFLAG]));
25388657SjakeASSYM(_JB_SIGMASK, offsetof(struct _jmp_buf, _jb[_JB_SIGMASK]));
25480709Sjake
25580709SjakeASSYM(TF_G0, offsetof(struct trapframe, tf_global[0]));
25680709SjakeASSYM(TF_G1, offsetof(struct trapframe, tf_global[1]));
25780709SjakeASSYM(TF_G2, offsetof(struct trapframe, tf_global[2]));
25880709SjakeASSYM(TF_G3, offsetof(struct trapframe, tf_global[3]));
25980709SjakeASSYM(TF_G4, offsetof(struct trapframe, tf_global[4]));
26080709SjakeASSYM(TF_G5, offsetof(struct trapframe, tf_global[5]));
26180709SjakeASSYM(TF_G6, offsetof(struct trapframe, tf_global[6]));
26280709SjakeASSYM(TF_G7, offsetof(struct trapframe, tf_global[7]));
26380709SjakeASSYM(TF_O0, offsetof(struct trapframe, tf_out[0]));
26480709SjakeASSYM(TF_O1, offsetof(struct trapframe, tf_out[1]));
26580709SjakeASSYM(TF_O2, offsetof(struct trapframe, tf_out[2]));
26680709SjakeASSYM(TF_O3, offsetof(struct trapframe, tf_out[3]));
26780709SjakeASSYM(TF_O4, offsetof(struct trapframe, tf_out[4]));
26880709SjakeASSYM(TF_O5, offsetof(struct trapframe, tf_out[5]));
26980709SjakeASSYM(TF_O6, offsetof(struct trapframe, tf_out[6]));
27080709SjakeASSYM(TF_O7, offsetof(struct trapframe, tf_out[7]));
271105733SjakeASSYM(TF_FPRS, offsetof(struct trapframe, tf_fprs));
27288657SjakeASSYM(TF_FSR, offsetof(struct trapframe, tf_fsr));
273105733SjakeASSYM(TF_GSR, offsetof(struct trapframe, tf_gsr));
274163146SkmacyASSYM(TF_PIL, offsetof(struct trapframe, tf_pil));
275166105Smarius#ifdef SUN4U
276105733SjakeASSYM(TF_LEVEL, offsetof(struct trapframe, tf_level));
27788657SjakeASSYM(TF_SFAR, offsetof(struct trapframe, tf_sfar));
278105733SjakeASSYM(TF_SFSR, offsetof(struct trapframe, tf_sfsr));
27988657SjakeASSYM(TF_TAR, offsetof(struct trapframe, tf_tar));
280163152SkmacyASSYM(TF_TYPE, offsetof(struct trapframe, tf_type));
281163152SkmacyASSYM(TF_Y, offsetof(struct trapframe, tf_y));
282166105Smarius#endif
283166105Smarius#ifdef SUN4V
284163146SkmacyASSYM(TF_ASI, offsetof(struct trapframe, tf_asi));
285163146Skmacy#endif
28688657SjakeASSYM(TF_TNPC, offsetof(struct trapframe, tf_tnpc));
28788657SjakeASSYM(TF_TPC, offsetof(struct trapframe, tf_tpc));
28880709SjakeASSYM(TF_TSTATE, offsetof(struct trapframe, tf_tstate));
28982910SjakeASSYM(TF_WSTATE, offsetof(struct trapframe, tf_wstate));
29080709SjakeASSYM(TF_SIZEOF, sizeof(struct trapframe));
29188788Sjake
292163146SkmacyASSYM(VM_MIN_DIRECT_ADDRESS, VM_MIN_DIRECT_ADDRESS);
293163146SkmacyASSYM(VM_MIN_PROM_ADDRESS, VM_MIN_PROM_ADDRESS);
294163146SkmacyASSYM(VM_MAX_PROM_ADDRESS, VM_MAX_PROM_ADDRESS);
295