genassym.c revision 222813
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 222813 2011-06-07 08:46:13Z attilio $");
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>
40222813Sattilio#include <sys/_cpuset.h>
4180709Sjake
4280709Sjake#include <vm/vm.h>
4381381Sjake#include <vm/vm_page.h>
4481381Sjake#include <vm/vm_map.h>
4580709Sjake
46166105Smarius#ifdef SUN4U
4797001Sjake#include <machine/cache.h>
48166105Smarius#endif
4980709Sjake#include <machine/pcb.h>
5080709Sjake#include <machine/setjmp.h>
5189052Sjake#include <machine/smp.h>
52166105Smarius#include <machine/tlb.h>
5380709Sjake#include <machine/tte.h>
54166105Smarius#include <machine/vmparam.h>
5580709Sjake
5683756SjakeASSYM(KERNBASE, KERNBASE);
5783756Sjake
5883366SjulianASSYM(KSTACK_PAGES, KSTACK_PAGES);
5991360SjakeASSYM(PCPU_PAGES, PCPU_PAGES);
6080709Sjake
6191224SjakeASSYM(TAR_VPN_SHIFT, TAR_VPN_SHIFT);
6291224Sjake
63222813SattilioASSYM(_NCPUBITS, _NCPUBITS);
64222813Sattilio
65182768Smarius#ifdef SUN4U
66182768SmariusASSYM(TLB_DEMAP_ALL, TLB_DEMAP_ALL);
67182768Smarius#endif
68182768SmariusASSYM(TLB_DEMAP_CONTEXT, TLB_DEMAP_CONTEXT);
6981381SjakeASSYM(TLB_DEMAP_NUCLEUS, TLB_DEMAP_NUCLEUS);
70182768SmariusASSYM(TLB_DEMAP_PAGE, TLB_DEMAP_PAGE);
7191783SjakeASSYM(TLB_DEMAP_PRIMARY, TLB_DEMAP_PRIMARY);
7281381Sjake
7391336SjakeASSYM(INT_SHIFT, INT_SHIFT);
7491336SjakeASSYM(PTR_SHIFT, PTR_SHIFT);
7591336Sjake
7680709SjakeASSYM(PAGE_SHIFT, PAGE_SHIFT);
77102040SjakeASSYM(PAGE_SHIFT_8K, PAGE_SHIFT_8K);
78102040SjakeASSYM(PAGE_SHIFT_4M, PAGE_SHIFT_4M);
79102040SjakeASSYM(PAGE_SIZE, PAGE_SIZE);
80163146SkmacyASSYM(PAGE_SIZE_4M, PAGE_SIZE_4M);
8180709Sjake
82183142Smarius#ifdef SMP
8391783SjakeASSYM(CSA_PCPU, offsetof(struct cpu_start_args, csa_pcpu));
8489052SjakeASSYM(CSA_STATE, offsetof(struct cpu_start_args, csa_state));
85166105Smarius#ifdef SUN4U
86182730SmariusASSYM(CSA_MID, offsetof(struct cpu_start_args, csa_mid));
87182730SmariusASSYM(CSA_STICK, offsetof(struct cpu_start_args, csa_stick));
8891617SjakeASSYM(CSA_TICK, offsetof(struct cpu_start_args, csa_tick));
89182730SmariusASSYM(CSA_TTES, offsetof(struct cpu_start_args, csa_ttes));
9091617SjakeASSYM(CSA_VER, offsetof(struct cpu_start_args, csa_ver));
91166105Smarius#endif
92163146Skmacy#endif
9397001Sjake
94166105Smarius#ifdef SUN4U
9597001SjakeASSYM(DC_SIZE, offsetof(struct cacheinfo, dc_size));
9697001SjakeASSYM(DC_LINESIZE, offsetof(struct cacheinfo, dc_linesize));
9797001SjakeASSYM(IC_SIZE, offsetof(struct cacheinfo, ic_size));
9897001SjakeASSYM(IC_LINESIZE, offsetof(struct cacheinfo, ic_linesize));
99166105Smarius#endif
10097001Sjake
10182910SjakeASSYM(KTR_SIZEOF, sizeof(struct ktr_entry));
10293949SjakeASSYM(KTR_LINE, offsetof(struct ktr_entry, ktr_line));
10393949SjakeASSYM(KTR_FILE, offsetof(struct ktr_entry, ktr_file));
10482910SjakeASSYM(KTR_DESC, offsetof(struct ktr_entry, ktr_desc));
10592199SjakeASSYM(KTR_CPU, offsetof(struct ktr_entry, ktr_cpu));
10693503SjakeASSYM(KTR_TIMESTAMP, offsetof(struct ktr_entry, ktr_timestamp));
10793503SjakeASSYM(KTR_PARM1, offsetof(struct ktr_entry, ktr_parms[0]));
10893503SjakeASSYM(KTR_PARM2, offsetof(struct ktr_entry, ktr_parms[1]));
10993503SjakeASSYM(KTR_PARM3, offsetof(struct ktr_entry, ktr_parms[2]));
11093503SjakeASSYM(KTR_PARM4, offsetof(struct ktr_entry, ktr_parms[3]));
11193503SjakeASSYM(KTR_PARM5, offsetof(struct ktr_entry, ktr_parms[4]));
11293503SjakeASSYM(KTR_PARM6, offsetof(struct ktr_entry, ktr_parms[5]));
11382910Sjake
114163146SkmacyASSYM(TTE_SHIFT, TTE_SHIFT);
115166105Smarius#ifdef SUN4U
11691224SjakeASSYM(TTE_VPN, offsetof(struct tte, tte_vpn));
11780709SjakeASSYM(TTE_DATA, offsetof(struct tte, tte_data));
11880709Sjake
119182916SmariusASSYM(TD_V, TD_V);
12081614SjakeASSYM(TD_EXEC, TD_EXEC);
12180709SjakeASSYM(TD_REF, TD_REF);
12288657SjakeASSYM(TD_SW, TD_SW);
123182916SmariusASSYM(TD_L, TD_L);
124100771SjakeASSYM(TD_CP, TD_CP);
125100771SjakeASSYM(TD_CV, TD_CV);
12680709SjakeASSYM(TD_W, TD_W);
12780709Sjake
128102040SjakeASSYM(TS_MIN, TS_MIN);
129102040SjakeASSYM(TS_MAX, TS_MAX);
130182916SmariusASSYM(TLB_DAR_SLOT_SHIFT, TLB_DAR_SLOT_SHIFT);
131205258SmariusASSYM(TLB_CXR_PGSZ_MASK, TLB_CXR_PGSZ_MASK);
132216803SmariusASSYM(TLB_DIRECT_ADDRESS_MASK, TLB_DIRECT_ADDRESS_MASK);
133163146SkmacyASSYM(TLB_DIRECT_TO_TTE_MASK, TLB_DIRECT_TO_TTE_MASK);
134102040SjakeASSYM(TV_SIZE_BITS, TV_SIZE_BITS);
135166105Smarius#endif
136166105Smarius
13784186SjakeASSYM(V_INTR, offsetof(struct vmmeter, v_intr));
13884186Sjake
139210176SmavASSYM(MAXCOMLEN, MAXCOMLEN);
14087702SjhbASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread));
14187702SjhbASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb));
14287702SjhbASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid));
14397265SjakeASSYM(PC_IRHEAD, offsetof(struct pcpu, pc_irhead));
14497265SjakeASSYM(PC_IRTAIL, offsetof(struct pcpu, pc_irtail));
14597265SjakeASSYM(PC_IRFREE, offsetof(struct pcpu, pc_irfree));
146163146SkmacyASSYM(PC_CNT, offsetof(struct pcpu, pc_cnt));
147163146SkmacyASSYM(PC_SIZEOF, sizeof(struct pcpu));
148163146Skmacy
149166105Smarius#ifdef SUN4U
150182689SmariusASSYM(PC_CACHE, offsetof(struct pcpu, pc_cache));
15189052SjakeASSYM(PC_MID, offsetof(struct pcpu, pc_mid));
152182689SmariusASSYM(PC_PMAP, offsetof(struct pcpu, pc_pmap));
15391613SjakeASSYM(PC_TLB_CTX, offsetof(struct pcpu, pc_tlb_ctx));
15491613SjakeASSYM(PC_TLB_CTX_MAX, offsetof(struct pcpu, pc_tlb_ctx_max));
15591613SjakeASSYM(PC_TLB_CTX_MIN, offsetof(struct pcpu, pc_tlb_ctx_min));
156166105Smarius#endif
15780709Sjake
15897265SjakeASSYM(IR_NEXT, offsetof(struct intr_request, ir_next));
15997265SjakeASSYM(IR_FUNC, offsetof(struct intr_request, ir_func));
16097265SjakeASSYM(IR_ARG, offsetof(struct intr_request, ir_arg));
16197265SjakeASSYM(IR_PRI, offsetof(struct intr_request, ir_pri));
16297265SjakeASSYM(IR_VEC, offsetof(struct intr_request, ir_vec));
16381614Sjake
164211073Smarius#if defined(SUN4U) && defined(SMP)
165211073SmariusASSYM(ICA_PA, offsetof(struct ipi_cache_args, ica_pa));
166211073Smarius
167211071SmariusASSYM(IRA_MASK, offsetof(struct ipi_rd_args, ira_mask));
168211071SmariusASSYM(IRA_VAL, offsetof(struct ipi_rd_args, ira_val));
169211071Smarius
17092199SjakeASSYM(ITA_MASK, offsetof(struct ipi_tlb_args, ita_mask));
17191783SjakeASSYM(ITA_PMAP, offsetof(struct ipi_tlb_args, ita_pmap));
17289052SjakeASSYM(ITA_START, offsetof(struct ipi_tlb_args, ita_start));
17389052SjakeASSYM(ITA_END, offsetof(struct ipi_tlb_args, ita_end));
17489052SjakeASSYM(ITA_VA, offsetof(struct ipi_tlb_args, ita_va));
175183142Smarius#endif
17689052Sjake
17781614SjakeASSYM(IV_FUNC, offsetof(struct intr_vector, iv_func));
17881614SjakeASSYM(IV_ARG, offsetof(struct intr_vector, iv_arg));
17981614SjakeASSYM(IV_PRI, offsetof(struct intr_vector, iv_pri));
18081614Sjake
181111032SjulianASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
182111032SjulianASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
18382910Sjake
18488788SjakeASSYM(MD_UTRAP, offsetof(struct mdproc, md_utrap));
18588788Sjake
18682910SjakeASSYM(P_COMM, offsetof(struct proc, p_comm));
18788657SjakeASSYM(P_MD, offsetof(struct proc, p_md));
18888657SjakeASSYM(P_PID, offsetof(struct proc, p_pid));
18980709SjakeASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace));
19080709Sjake
191111032SjulianASSYM(TD_FLAGS, offsetof(struct thread, td_flags));
19283366SjulianASSYM(TD_FRAME, offsetof(struct thread, td_frame));
19383366SjulianASSYM(TD_KSTACK, offsetof(struct thread, td_kstack));
194203185SmariusASSYM(TD_LOCK, offsetof(struct thread, td_lock));
19583366SjulianASSYM(TD_PCB, offsetof(struct thread, td_pcb));
19683366SjulianASSYM(TD_PROC, offsetof(struct thread, td_proc));
197163146SkmacyASSYM(TD_MD, offsetof(struct thread, td_md));
198163146SkmacyASSYM(MD_SAVED_PIL, offsetof(struct mdthread, md_saved_pil));
19983366Sjulian
20084186SjakeASSYM(PCB_SIZEOF, sizeof(struct pcb));
201113023SjakeASSYM(PCB_RW, offsetof(struct pcb, pcb_rw));
202113023SjakeASSYM(PCB_KFP, offsetof(struct pcb, pcb_kfp));
203112920SjakeASSYM(PCB_UFP, offsetof(struct pcb, pcb_ufp));
204113023SjakeASSYM(PCB_RWSP, offsetof(struct pcb, pcb_rwsp));
205112924SjakeASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags));
20682910SjakeASSYM(PCB_NSAVED, offsetof(struct pcb, pcb_nsaved));
207113023SjakeASSYM(PCB_PC, offsetof(struct pcb, pcb_pc));
208113023SjakeASSYM(PCB_SP, offsetof(struct pcb, pcb_sp));
209163965SkmacyASSYM(PCB_PAD, offsetof(struct pcb, pcb_pad));
210163146Skmacy
21181381SjakeASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap));
21288657SjakeASSYM(PM_ACTIVE, offsetof(struct pmap, pm_active));
21381381SjakeASSYM(PM_CONTEXT, offsetof(struct pmap, pm_context));
21488657SjakeASSYM(PM_TSB, offsetof(struct pmap, pm_tsb));
21581381Sjake
21688657SjakeASSYM(_JB_FP, offsetof(struct _jmp_buf, _jb[_JB_FP]));
21788657SjakeASSYM(_JB_PC, offsetof(struct _jmp_buf, _jb[_JB_PC]));
21888657SjakeASSYM(_JB_SP, offsetof(struct _jmp_buf, _jb[_JB_SP]));
21988657SjakeASSYM(_JB_SIGFLAG, offsetof(struct _jmp_buf, _jb[_JB_SIGFLAG]));
22088657SjakeASSYM(_JB_SIGMASK, offsetof(struct _jmp_buf, _jb[_JB_SIGMASK]));
22180709Sjake
22280709SjakeASSYM(TF_G0, offsetof(struct trapframe, tf_global[0]));
22380709SjakeASSYM(TF_G1, offsetof(struct trapframe, tf_global[1]));
22480709SjakeASSYM(TF_G2, offsetof(struct trapframe, tf_global[2]));
22580709SjakeASSYM(TF_G3, offsetof(struct trapframe, tf_global[3]));
22680709SjakeASSYM(TF_G4, offsetof(struct trapframe, tf_global[4]));
22780709SjakeASSYM(TF_G5, offsetof(struct trapframe, tf_global[5]));
22880709SjakeASSYM(TF_G6, offsetof(struct trapframe, tf_global[6]));
22980709SjakeASSYM(TF_G7, offsetof(struct trapframe, tf_global[7]));
23080709SjakeASSYM(TF_O0, offsetof(struct trapframe, tf_out[0]));
23180709SjakeASSYM(TF_O1, offsetof(struct trapframe, tf_out[1]));
23280709SjakeASSYM(TF_O2, offsetof(struct trapframe, tf_out[2]));
23380709SjakeASSYM(TF_O3, offsetof(struct trapframe, tf_out[3]));
23480709SjakeASSYM(TF_O4, offsetof(struct trapframe, tf_out[4]));
23580709SjakeASSYM(TF_O5, offsetof(struct trapframe, tf_out[5]));
23680709SjakeASSYM(TF_O6, offsetof(struct trapframe, tf_out[6]));
23780709SjakeASSYM(TF_O7, offsetof(struct trapframe, tf_out[7]));
238105733SjakeASSYM(TF_FPRS, offsetof(struct trapframe, tf_fprs));
23988657SjakeASSYM(TF_FSR, offsetof(struct trapframe, tf_fsr));
240105733SjakeASSYM(TF_GSR, offsetof(struct trapframe, tf_gsr));
241163146SkmacyASSYM(TF_PIL, offsetof(struct trapframe, tf_pil));
242166105Smarius#ifdef SUN4U
243105733SjakeASSYM(TF_LEVEL, offsetof(struct trapframe, tf_level));
24488657SjakeASSYM(TF_SFAR, offsetof(struct trapframe, tf_sfar));
245105733SjakeASSYM(TF_SFSR, offsetof(struct trapframe, tf_sfsr));
24688657SjakeASSYM(TF_TAR, offsetof(struct trapframe, tf_tar));
247163152SkmacyASSYM(TF_TYPE, offsetof(struct trapframe, tf_type));
248163152SkmacyASSYM(TF_Y, offsetof(struct trapframe, tf_y));
249166105Smarius#endif
25088657SjakeASSYM(TF_TNPC, offsetof(struct trapframe, tf_tnpc));
25188657SjakeASSYM(TF_TPC, offsetof(struct trapframe, tf_tpc));
25280709SjakeASSYM(TF_TSTATE, offsetof(struct trapframe, tf_tstate));
25382910SjakeASSYM(TF_WSTATE, offsetof(struct trapframe, tf_wstate));
25480709SjakeASSYM(TF_SIZEOF, sizeof(struct trapframe));
25588788Sjake
256163146SkmacyASSYM(VM_MIN_DIRECT_ADDRESS, VM_MIN_DIRECT_ADDRESS);
257163146SkmacyASSYM(VM_MIN_PROM_ADDRESS, VM_MIN_PROM_ADDRESS);
258163146SkmacyASSYM(VM_MAX_PROM_ADDRESS, VM_MAX_PROM_ADDRESS);
259