genassym.c revision 111032
1181847Sjkim/*-
2181847Sjkim * Copyright (c) 2001 Jake Burkholder.
3182219Sjkim * All rights reserved.
4181847Sjkim *
5181847Sjkim * Redistribution and use in source and binary forms, with or without
6181847Sjkim * modification, are permitted provided that the following conditions
7181847Sjkim * are met:
8181847Sjkim * 1. Redistributions of source code must retain the above copyright
9181847Sjkim *    notice, this list of conditions and the following disclaimer.
10181847Sjkim * 2. Redistributions in binary form must reproduce the above copyright
11181847Sjkim *    notice, this list of conditions and the following disclaimer in the
12181847Sjkim *    documentation and/or other materials provided with the distribution.
13181847Sjkim *
14181847Sjkim * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15181847Sjkim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16181847Sjkim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17181847Sjkim * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18181847Sjkim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19181847Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20181847Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21182219Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22182428Sjkim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23199499Sjkim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24181847Sjkim * SUCH DAMAGE.
25181847Sjkim *
26181847Sjkim *	from: @(#)genassym.c	5.11 (Berkeley) 5/10/91
27181847Sjkim * $FreeBSD: head/sys/sparc64/sparc64/genassym.c 111032 2003-02-17 09:55:10Z julian $
28181847Sjkim */
29182185Sjkim
30181847Sjkim#include <sys/param.h>
31182183Sjkim#include <sys/assym.h>
32182183Sjkim#include <sys/errno.h>
33182183Sjkim#include <sys/ktr.h>
34181847Sjkim#include <sys/proc.h>
35181847Sjkim#include <sys/queue.h>
36181847Sjkim#include <sys/lock.h>
37181847Sjkim#include <sys/mutex.h>
38182459Sjkim#include <sys/signal.h>
39181847Sjkim#include <sys/smp.h>
40181847Sjkim#include <sys/systm.h>
41182221Sjkim#include <sys/ucontext.h>
42182221Sjkim#include <sys/user.h>
43182182Sjkim#include <sys/ucontext.h>
44182182Sjkim#include <sys/vmmeter.h>
45182185Sjkim
46199604Sjkim#include <vm/vm.h>
47182219Sjkim#include <vm/vm_param.h>
48181847Sjkim#include <vm/vm_kern.h>
49181847Sjkim#include <vm/vm_page.h>
50182219Sjkim#include <vm/vm_map.h>
51181847Sjkim
52181847Sjkim#include <machine/asi.h>
53181847Sjkim#include <machine/cache.h>
54181847Sjkim#include <machine/vmparam.h>
55182221Sjkim#include <machine/cpufunc.h>
56199604Sjkim#include <machine/fp.h>
57181847Sjkim#include <machine/frame.h>
58181847Sjkim#include <machine/fsr.h>
59181847Sjkim#include <machine/intr_machdep.h>
60181847Sjkim#include <machine/lsu.h>
61182183Sjkim#include <machine/pcb.h>
62181847Sjkim#include <machine/pstate.h>
63181847Sjkim#include <machine/setjmp.h>
64182183Sjkim#include <machine/sigframe.h>
65182183Sjkim#include <machine/smp.h>
66182183Sjkim#include <machine/tte.h>
67182377Sjkim#include <machine/tlb.h>
68182183Sjkim#include <machine/tsb.h>
69181847Sjkim#include <machine/tstate.h>
70181847Sjkim#include <machine/upa.h>
71181847Sjkim#include <machine/utrap.h>
72181847Sjkim
73181847SjkimASSYM(KERNBASE, KERNBASE);
74181847SjkimASSYM(VM_MIN_PROM_ADDRESS, VM_MIN_PROM_ADDRESS);
75181847Sjkim
76181847SjkimASSYM(EFAULT, EFAULT);
77181847SjkimASSYM(ENAMETOOLONG, ENAMETOOLONG);
78
79ASSYM(KSTACK_PAGES, KSTACK_PAGES);
80ASSYM(KSTACK_GUARD_PAGES, KSTACK_GUARD_PAGES);
81ASSYM(PCPU_PAGES, PCPU_PAGES);
82ASSYM(UAREA_PAGES, UAREA_PAGES);
83
84ASSYM(PIL_TICK, PIL_TICK);
85
86ASSYM(FPRS_DL, FPRS_DL);
87ASSYM(FPRS_DU, FPRS_DU);
88ASSYM(FPRS_FEF, FPRS_FEF);
89
90ASSYM(LSU_VW, LSU_VW);
91
92ASSYM(TAR_VPN_SHIFT, TAR_VPN_SHIFT);
93
94ASSYM(TLB_DAR_SLOT_SHIFT, TLB_DAR_SLOT_SHIFT);
95ASSYM(TLB_DEMAP_NUCLEUS, TLB_DEMAP_NUCLEUS);
96ASSYM(TLB_DEMAP_PRIMARY, TLB_DEMAP_PRIMARY);
97ASSYM(TLB_DEMAP_CONTEXT, TLB_DEMAP_CONTEXT);
98ASSYM(TLB_DEMAP_PAGE, TLB_DEMAP_PAGE);
99ASSYM(TLB_DIRECT_TO_TTE_MASK, TLB_DIRECT_TO_TTE_MASK);
100
101ASSYM(TSB_BUCKET_MASK, TSB_BUCKET_MASK);
102ASSYM(TSB_BUCKET_SHIFT, TSB_BUCKET_SHIFT);
103
104ASSYM(INT_SHIFT, INT_SHIFT);
105ASSYM(PTR_SHIFT, PTR_SHIFT);
106
107ASSYM(PAGE_SHIFT, PAGE_SHIFT);
108ASSYM(PAGE_SHIFT_8K, PAGE_SHIFT_8K);
109ASSYM(PAGE_SHIFT_4M, PAGE_SHIFT_4M);
110ASSYM(PAGE_SIZE, PAGE_SIZE);
111
112ASSYM(CPU_CLKSYNC, CPU_CLKSYNC);
113ASSYM(CPU_INIT, CPU_INIT);
114
115ASSYM(CSA_MID, offsetof(struct cpu_start_args, csa_mid));
116ASSYM(CSA_PCPU, offsetof(struct cpu_start_args, csa_pcpu));
117ASSYM(CSA_STATE, offsetof(struct cpu_start_args, csa_state));
118ASSYM(CSA_TICK, offsetof(struct cpu_start_args, csa_tick));
119ASSYM(CSA_VER, offsetof(struct cpu_start_args, csa_ver));
120ASSYM(CSA_TTES, offsetof(struct cpu_start_args, csa_ttes));
121
122ASSYM(DC_TAG_SHIFT, DC_TAG_SHIFT);
123ASSYM(DC_TAG_MASK, DC_TAG_MASK);
124ASSYM(DC_VALID_SHIFT, DC_VALID_SHIFT);
125ASSYM(DC_VALID_MASK, DC_VALID_MASK);
126ASSYM(IC_TAG_SHIFT, IC_TAG_SHIFT);
127ASSYM(IC_TAG_MASK, IC_TAG_MASK);
128ASSYM(IC_VALID_SHIFT, IC_VALID_SHIFT);
129ASSYM(IC_VALID_MASK, IC_VALID_MASK);
130
131ASSYM(DC_SIZE, offsetof(struct cacheinfo, dc_size));
132ASSYM(DC_LINESIZE, offsetof(struct cacheinfo, dc_linesize));
133ASSYM(IC_SIZE, offsetof(struct cacheinfo, ic_size));
134ASSYM(IC_LINESIZE, offsetof(struct cacheinfo, ic_linesize));
135
136ASSYM(ICA_PA, offsetof(struct ipi_cache_args, ica_pa));
137
138ASSYM(KTR_PROC, KTR_PROC);
139ASSYM(KTR_TRAP, KTR_TRAP);
140ASSYM(KTR_SMP, KTR_SMP);
141ASSYM(KTR_SYSC, KTR_SYSC);
142ASSYM(KTR_INTR, KTR_INTR);
143ASSYM(KTR_CT1, KTR_CT1);
144ASSYM(KTR_CT2, KTR_CT2);
145ASSYM(KTR_CT3, KTR_CT3);
146ASSYM(KTR_CT4, KTR_CT4);
147ASSYM(KTR_CT5, KTR_CT5);
148ASSYM(KTR_CT6, KTR_CT6);
149ASSYM(KTR_CT7, KTR_CT7);
150ASSYM(KTR_CT8, KTR_CT8);
151
152ASSYM(KTR_SIZEOF, sizeof(struct ktr_entry));
153ASSYM(KTR_LINE, offsetof(struct ktr_entry, ktr_line));
154ASSYM(KTR_FILE, offsetof(struct ktr_entry, ktr_file));
155ASSYM(KTR_DESC, offsetof(struct ktr_entry, ktr_desc));
156ASSYM(KTR_CPU, offsetof(struct ktr_entry, ktr_cpu));
157ASSYM(KTR_TIMESTAMP, offsetof(struct ktr_entry, ktr_timestamp));
158ASSYM(KTR_PARM1, offsetof(struct ktr_entry, ktr_parms[0]));
159ASSYM(KTR_PARM2, offsetof(struct ktr_entry, ktr_parms[1]));
160ASSYM(KTR_PARM3, offsetof(struct ktr_entry, ktr_parms[2]));
161ASSYM(KTR_PARM4, offsetof(struct ktr_entry, ktr_parms[3]));
162ASSYM(KTR_PARM5, offsetof(struct ktr_entry, ktr_parms[4]));
163ASSYM(KTR_PARM6, offsetof(struct ktr_entry, ktr_parms[5]));
164
165ASSYM(TTE_VPN, offsetof(struct tte, tte_vpn));
166ASSYM(TTE_DATA, offsetof(struct tte, tte_data));
167ASSYM(TTE_SHIFT, TTE_SHIFT);
168
169ASSYM(TD_EXEC, TD_EXEC);
170ASSYM(TD_REF, TD_REF);
171ASSYM(TD_SW, TD_SW);
172ASSYM(TD_V, TD_V);
173ASSYM(TD_8K, TD_8K);
174ASSYM(TD_CP, TD_CP);
175ASSYM(TD_CV, TD_CV);
176ASSYM(TD_L, TD_L);
177ASSYM(TD_W, TD_W);
178
179ASSYM(TS_MIN, TS_MIN);
180ASSYM(TS_MAX, TS_MAX);
181
182ASSYM(TV_SIZE_BITS, TV_SIZE_BITS);
183
184ASSYM(V_INTR, offsetof(struct vmmeter, v_intr));
185
186ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread));
187ASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb));
188ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid));
189ASSYM(PC_CPUMASK, offsetof(struct pcpu, pc_cpumask));
190ASSYM(PC_IRHEAD, offsetof(struct pcpu, pc_irhead));
191ASSYM(PC_IRTAIL, offsetof(struct pcpu, pc_irtail));
192ASSYM(PC_IRFREE, offsetof(struct pcpu, pc_irfree));
193ASSYM(PC_MID, offsetof(struct pcpu, pc_mid));
194ASSYM(PC_TLB_CTX, offsetof(struct pcpu, pc_tlb_ctx));
195ASSYM(PC_TLB_CTX_MAX, offsetof(struct pcpu, pc_tlb_ctx_max));
196ASSYM(PC_TLB_CTX_MIN, offsetof(struct pcpu, pc_tlb_ctx_min));
197ASSYM(PC_VMSPACE, offsetof(struct pcpu, pc_vmspace));
198ASSYM(PC_SIZEOF, sizeof(struct pcpu));
199
200ASSYM(IH_SHIFT, IH_SHIFT);
201
202ASSYM(IRSR_BUSY, IRSR_BUSY);
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_SHIFT, IV_SHIFT);
217ASSYM(IV_FUNC, offsetof(struct intr_vector, iv_func));
218ASSYM(IV_ARG, offsetof(struct intr_vector, iv_arg));
219ASSYM(IV_PRI, offsetof(struct intr_vector, iv_pri));
220
221ASSYM(IV_MAX, IV_MAX);
222
223ASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
224ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
225
226ASSYM(MD_UTRAP, offsetof(struct mdproc, md_utrap));
227
228ASSYM(MTX_LOCK, offsetof(struct mtx, mtx_lock));
229
230ASSYM(P_COMM, offsetof(struct proc, p_comm));
231ASSYM(P_MD, offsetof(struct proc, p_md));
232ASSYM(P_PID, offsetof(struct proc, p_pid));
233ASSYM(P_SFLAG, offsetof(struct proc, p_sflag));
234ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace));
235
236ASSYM(RW_SHIFT, RW_SHIFT);
237
238ASSYM(TD_FLAGS, offsetof(struct thread, td_flags));
239
240ASSYM(TD_FRAME, offsetof(struct thread, td_frame));
241ASSYM(TD_KSTACK, offsetof(struct thread, td_kstack));
242ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
243ASSYM(TD_PROC, offsetof(struct thread, td_proc));
244
245ASSYM(PCB_SIZEOF, sizeof(struct pcb));
246ASSYM(PCB_FPSTATE, offsetof(struct pcb, pcb_fpstate));
247ASSYM(PCB_FP, offsetof(struct pcb, pcb_fp));
248ASSYM(PCB_PC, offsetof(struct pcb, pcb_pc));
249ASSYM(PCB_NSAVED, offsetof(struct pcb, pcb_nsaved));
250ASSYM(PCB_RWSP, offsetof(struct pcb, pcb_rwsp));
251ASSYM(PCB_RW, offsetof(struct pcb, pcb_rw));
252
253ASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap));
254ASSYM(PM_ACTIVE, offsetof(struct pmap, pm_active));
255ASSYM(PM_CONTEXT, offsetof(struct pmap, pm_context));
256ASSYM(PM_TSB, offsetof(struct pmap, pm_tsb));
257
258ASSYM(FP_FB0, offsetof(struct fpstate, fp_fb[0]));
259ASSYM(FP_FB1, offsetof(struct fpstate, fp_fb[1]));
260ASSYM(FP_FB2, offsetof(struct fpstate, fp_fb[2]));
261ASSYM(FP_FB3, offsetof(struct fpstate, fp_fb[3]));
262
263ASSYM(CCFSZ, sizeof(struct frame));
264ASSYM(SPOFF, SPOFF);
265
266ASSYM(SF_UC, offsetof(struct sigframe, sf_uc));
267
268ASSYM(_JB_FP, offsetof(struct _jmp_buf, _jb[_JB_FP]));
269ASSYM(_JB_PC, offsetof(struct _jmp_buf, _jb[_JB_PC]));
270ASSYM(_JB_SP, offsetof(struct _jmp_buf, _jb[_JB_SP]));
271ASSYM(_JB_SIGFLAG, offsetof(struct _jmp_buf, _jb[_JB_SIGFLAG]));
272ASSYM(_JB_SIGMASK, offsetof(struct _jmp_buf, _jb[_JB_SIGMASK]));
273
274ASSYM(TF_G0, offsetof(struct trapframe, tf_global[0]));
275ASSYM(TF_G1, offsetof(struct trapframe, tf_global[1]));
276ASSYM(TF_G2, offsetof(struct trapframe, tf_global[2]));
277ASSYM(TF_G3, offsetof(struct trapframe, tf_global[3]));
278ASSYM(TF_G4, offsetof(struct trapframe, tf_global[4]));
279ASSYM(TF_G5, offsetof(struct trapframe, tf_global[5]));
280ASSYM(TF_G6, offsetof(struct trapframe, tf_global[6]));
281ASSYM(TF_G7, offsetof(struct trapframe, tf_global[7]));
282ASSYM(TF_O0, offsetof(struct trapframe, tf_out[0]));
283ASSYM(TF_O1, offsetof(struct trapframe, tf_out[1]));
284ASSYM(TF_O2, offsetof(struct trapframe, tf_out[2]));
285ASSYM(TF_O3, offsetof(struct trapframe, tf_out[3]));
286ASSYM(TF_O4, offsetof(struct trapframe, tf_out[4]));
287ASSYM(TF_O5, offsetof(struct trapframe, tf_out[5]));
288ASSYM(TF_O6, offsetof(struct trapframe, tf_out[6]));
289ASSYM(TF_O7, offsetof(struct trapframe, tf_out[7]));
290ASSYM(TF_FPRS, offsetof(struct trapframe, tf_fprs));
291ASSYM(TF_FSR, offsetof(struct trapframe, tf_fsr));
292ASSYM(TF_GSR, offsetof(struct trapframe, tf_gsr));
293ASSYM(TF_LEVEL, offsetof(struct trapframe, tf_level));
294ASSYM(TF_PIL, offsetof(struct trapframe, tf_pil));
295ASSYM(TF_SFAR, offsetof(struct trapframe, tf_sfar));
296ASSYM(TF_SFSR, offsetof(struct trapframe, tf_sfsr));
297ASSYM(TF_TAR, offsetof(struct trapframe, tf_tar));
298ASSYM(TF_TNPC, offsetof(struct trapframe, tf_tnpc));
299ASSYM(TF_TPC, offsetof(struct trapframe, tf_tpc));
300ASSYM(TF_TSTATE, offsetof(struct trapframe, tf_tstate));
301ASSYM(TF_TYPE, offsetof(struct trapframe, tf_type));
302ASSYM(TF_Y, offsetof(struct trapframe, tf_y));
303ASSYM(TF_WSTATE, offsetof(struct trapframe, tf_wstate));
304ASSYM(TF_SIZEOF, sizeof(struct trapframe));
305
306ASSYM(UT_MAX, UT_MAX);
307