1 /*-
2 * Copyright (c) 1982, 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * William Jolitz.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by the University of
19 * California, Berkeley and its contributors.
20 * 4. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91
37 * $FreeBSD$
38 */
39
40 #include "opt_vm86.h"
41 #include "opt_user_ldt.h"
42
43 #include <stddef.h>
44
45 #include <sys/param.h>
46 #include <sys/buf.h>
47 #include <sys/proc.h>
48 #include <sys/mount.h>
49 #include <sys/socket.h>
50 #include <sys/resourcevar.h>
51 #include <machine/frame.h>
52 #include <machine/bootinfo.h>
53 #include <machine/tss.h>
54 #include <sys/vmmeter.h>
55 #include <vm/vm.h>
56 #include <vm/vm_param.h>
57 #include <vm/pmap.h>
58 #include <vm/vm_map.h>
59 #include <sys/user.h>
60 #include <net/if.h>
61 #include <netinet/in.h>
62 #include <nfs/nfsv2.h>
63 #include <nfs/rpcv2.h>
64 #include <nfs/nfs.h>
65 #include <nfs/nfsdiskless.h>
66 #ifdef SMP
67 #include <machine/apic.h>
68 #endif
69 #ifdef VM86
70 #include <machine/segments.h>
71 #endif
72 #include <machine/globaldata.h>
73
74 #define OS(s, m) ((u_int)offsetof(struct s, m))
75
76 int main __P((void));
77 int printf __P((const char *, ...));
78
79 int
80 main()
81 {
82
83 printf("#define\tP_FORW %#x\n", OS(proc, p_procq.tqe_next));
84 printf("#define\tP_BACK %#x\n", OS(proc, p_procq.tqe_prev));
85 printf("#define\tP_VMSPACE %#x\n", OS(proc, p_vmspace));
86 printf("#define\tVM_PMAP %#x\n", OS(vmspace, vm_pmap));
87 printf("#define\tP_ADDR %#x\n", OS(proc, p_addr));
88 printf("#define\tP_PRI %#x\n", OS(proc, p_priority));
89 printf("#define\tP_RTPRIO_TYPE %#x\n", OS(proc, p_rtprio.type));
90 printf("#define\tP_RTPRIO_PRIO %#x\n", OS(proc, p_rtprio.prio));
91 printf("#define\tP_STAT %#x\n", OS(proc, p_stat));
92 printf("#define\tP_WCHAN %#x\n", OS(proc, p_wchan));
93 printf("#define\tP_FLAG %#x\n", OS(proc, p_flag));
94 printf("#define\tP_PID %#x\n", OS(proc, p_pid));
95 printf("#define\tP_SWITCHTIME %#x\n", OS(proc, p_switchtime));
96 #ifdef SMP
97 printf("#define\tP_ONCPU %#x\n", OS(proc, p_oncpu));
98 printf("#define\tP_LASTCPU %#x\n", OS(proc, p_lastcpu));
99 #endif
100 printf("#define\tSSLEEP %d\n", SSLEEP);
101 printf("#define\tSRUN %d\n", SRUN);
102 printf("#define\tV_TRAP %#x\n", OS(vmmeter, v_trap));
103 printf("#define\tV_SYSCALL %#x\n", OS(vmmeter, v_syscall));
104 printf("#define\tV_INTR %#x\n", OS(vmmeter, v_intr));
105 printf("#define\tUPAGES %d\n", UPAGES);
106 printf("#define\tPAGE_SIZE %d\n", PAGE_SIZE);
107 printf("#define\tNPTEPG %d\n", NPTEPG);
108 printf("#define\tNPDEPG %d\n", NPDEPG);
109 printf("#define\tPDESIZE %d\n", PDESIZE);
110 printf("#define\tPTESIZE %d\n", PTESIZE);
111 printf("#define\tNKPDE %d\n", NKPDE);
112 printf("#define\tNKPT %d\n", NKPT);
113 printf("#define\tPAGE_SHIFT %d\n", PAGE_SHIFT);
114 printf("#define\tPAGE_MASK %d\n", PAGE_MASK);
115 printf("#define\tPDRSHIFT %d\n", PDRSHIFT);
116 printf("#define\tUSRSTACK %#x\n", USRSTACK);
117 printf("#define\tVM_MAXUSER_ADDRESS %#x\n", VM_MAXUSER_ADDRESS);
118 printf("#define\tKERNBASE %#x\n", KERNBASE);
119 printf("#define\tMCLBYTES %d\n", MCLBYTES);
120 printf("#define\tPCB_CR3 %#x\n", OS(pcb, pcb_cr3));
121 printf("#define\tPCB_EDI %#x\n", OS(pcb, pcb_edi));
122 printf("#define\tPCB_ESI %#x\n", OS(pcb, pcb_esi));
123 printf("#define\tPCB_EBP %#x\n", OS(pcb, pcb_ebp));
124 printf("#define\tPCB_ESP %#x\n", OS(pcb, pcb_esp));
125 printf("#define\tPCB_EBX %#x\n", OS(pcb, pcb_ebx));
126 printf("#define\tPCB_EIP %#x\n", OS(pcb, pcb_eip));
127 printf("#define\tTSS_ESP0 %#x\n", OS(i386tss, tss_esp0));
128 printf("#define\tPCB_USERLDT %#x\n", OS(pcb, pcb_ldt));
129 printf("#define\tPCB_FS %#x\n", OS(pcb, pcb_fs));
130 printf("#define\tPCB_GS %#x\n", OS(pcb, pcb_gs));
131 #ifdef VM86
132 printf("#define\tPCB_EXT %#x\n", OS(pcb, pcb_ext));
133 #endif
134 #ifdef SMP
135 printf("#define\tPCB_MPNEST %#x\n", OS(pcb, pcb_mpnest));
136 #endif
137 printf("#define\tU_PROF %#x\n", OS(user, u_stats.p_prof));
138 printf("#define\tU_PROFSCALE %#x\n",
139 OS(user, u_stats.p_prof.pr_scale));
140 printf("#define\tPR_BASE %#x\n", OS(uprof, pr_base));
141 printf("#define\tPR_SIZE %#x\n", OS(uprof, pr_size));
142 printf("#define\tPR_OFF %#x\n", OS(uprof, pr_off));
143 printf("#define\tPR_SCALE %#x\n", OS(uprof, pr_scale));
144 printf("#define\tRU_MINFLT %#x\n", OS(rusage, ru_minflt));
145 printf("#define\tPCB_FLAGS %#x\n", OS(pcb, pcb_flags));
146 printf("#define\tPCB_SAVEFPU %#x\n", OS(pcb, pcb_savefpu));
147 printf("#define\tPCB_SAVEFPU_SIZE %u\n", sizeof(struct save87));
148 printf("#define\tPCB_ONFAULT %#x\n", OS(pcb, pcb_onfault));
149 #ifdef SMP
150 printf("#define\tPCB_SIZE %u\n", sizeof(struct pcb));
151 #endif
152
153 printf("#define\tTF_ES %#x\n", OS(trapframe, tf_es));
154 printf("#define\tTF_DS %#x\n", OS(trapframe, tf_ds));
155 printf("#define\tTF_EDI %#x\n", OS(trapframe, tf_edi));
156 printf("#define\tTF_ESI %#x\n", OS(trapframe, tf_esi));
157 printf("#define\tTF_EBP %#x\n", OS(trapframe, tf_ebp));
158 printf("#define\tTF_ISP %#x\n", OS(trapframe, tf_isp));
159 printf("#define\tTF_EBX %#x\n", OS(trapframe, tf_ebx));
160 printf("#define\tTF_EDX %#x\n", OS(trapframe, tf_edx));
161 printf("#define\tTF_ECX %#x\n", OS(trapframe, tf_ecx));
162 printf("#define\tTF_EAX %#x\n", OS(trapframe, tf_eax));
163 printf("#define\tTF_TRAPNO %#x\n", OS(trapframe, tf_trapno));
164 printf("#define\tTF_ERR %#x\n", OS(trapframe, tf_err));
165 printf("#define\tTF_EIP %#x\n", OS(trapframe, tf_eip));
166 printf("#define\tTF_CS %#x\n", OS(trapframe, tf_cs));
167 printf("#define\tTF_EFLAGS %#x\n", OS(trapframe, tf_eflags));
168 printf("#define\tTF_ESP %#x\n", OS(trapframe, tf_esp));
169 printf("#define\tTF_SS %#x\n", OS(trapframe, tf_ss));
170
171 printf("#define\tSIGF_SIGNUM %#x\n", OS(sigframe, sf_signum));
172 printf("#define\tSIGF_CODE %#x\n", OS(sigframe, sf_code));
173 printf("#define\tSIGF_SCP %#x\n", OS(sigframe, sf_scp));
174 printf("#define\tSIGF_HANDLER %#x\n", OS(sigframe, sf_handler));
175 printf("#define\tSIGF_SC %#x\n", OS(sigframe, sf_sc));
176 printf("#define\tSC_PS %#x\n", OS(sigcontext, sc_ps));
177 printf("#define\tSC_FS %#x\n", OS(sigcontext, sc_fs));
178 printf("#define\tSC_GS %#x\n", OS(sigcontext, sc_gs));
179
180 printf("#define\tB_READ %#x\n", B_READ);
181 printf("#define\tENOENT %d\n", ENOENT);
182 printf("#define\tEFAULT %d\n", EFAULT);
183 printf("#define\tENAMETOOLONG %d\n", ENAMETOOLONG);
184 printf("#define\tMAXPATHLEN %d\n", MAXPATHLEN);
185
186 printf("#define\tBOOTINFO_SIZE %u\n", sizeof(struct bootinfo));
187 printf("#define\tBI_VERSION %#x\n", OS(bootinfo, bi_version));
188 printf("#define\tBI_KERNELNAME %#x\n", OS(bootinfo, bi_kernelname));
189 printf("#define\tBI_NFS_DISKLESS %#x\n", OS(bootinfo, bi_nfs_diskless));
190 printf("#define\tBI_ENDCOMMON %#x\n", OS(bootinfo, bi_endcommon));
191 printf("#define\tNFSDISKLESS_SIZE %u\n", sizeof(struct nfs_diskless));
192 printf("#define\tBI_SIZE %#x\n", OS(bootinfo, bi_size));
193 printf("#define\tBI_SYMTAB %#x\n", OS(bootinfo, bi_symtab));
194 printf("#define\tBI_ESYMTAB %#x\n", OS(bootinfo, bi_esymtab));
195 printf("#define\tBI_KERNEND %#x\n", OS(bootinfo, bi_kernend));
196 printf("#define\tBI_ENVP %#x\n", OS(bootinfo, bi_envp));
197 printf("#define\tBI_MODULEP %#x\n", OS(bootinfo, bi_modulep));
198
199 printf("#define\tGD_SIZEOF %u\n", sizeof(struct globaldata));
200 printf("#define\tGD_CURPROC %#x\n", OS(globaldata, curproc));
201 printf("#define\tGD_NPXPROC %#x\n", OS(globaldata, npxproc));
202 printf("#define\tGD_CURPCB %#x\n", OS(globaldata, curpcb));
203 printf("#define\tGD_COMMON_TSS %#x\n", OS(globaldata, common_tss));
204 printf("#define\tGD_SWITCHTIME %#x\n", OS(globaldata, switchtime));
205 printf("#define\tGD_SWITCHTICKS %#x\n", OS(globaldata, switchticks));
206 #ifdef VM86
207 printf("#define\tGD_COMMON_TSSD %#x\n", OS(globaldata, common_tssd));
208 printf("#define\tGD_PRIVATE_TSS %#x\n", OS(globaldata, private_tss));
209 printf("#define\tGD_MY_TR %#x\n", OS(globaldata, my_tr));
210 #endif
211 #ifdef USER_LDT
212 printf("#define\tGD_CURRENTLDT %#x\n", OS(globaldata, currentldt));
213 #endif
214 #ifdef SMP
215 printf("#define\tGD_CPUID %#x\n", OS(globaldata, cpuid));
216 printf("#define\tGD_CPU_LOCKID %#x\n", OS(globaldata, cpu_lockid));
217 printf("#define\tGD_OTHER_CPUS %#x\n", OS(globaldata, other_cpus));
218 printf("#define\tGD_MY_IDLEPTD %#x\n", OS(globaldata, my_idlePTD));
219 printf("#define\tGD_SS_EFLAGS %#x\n", OS(globaldata, ss_eflags));
220 printf("#define\tGD_PRV_CMAP1 %#x\n", OS(globaldata, prv_CMAP1));
221 printf("#define\tGD_PRV_CMAP2 %#x\n", OS(globaldata, prv_CMAP2));
222 printf("#define\tGD_PRV_CMAP3 %#x\n", OS(globaldata, prv_CMAP3));
223 printf("#define\tGD_PRV_PMAP1 %#x\n", OS(globaldata, prv_PMAP1));
224 printf("#define\tGD_INSIDE_INTR %#x\n", OS(globaldata, inside_intr));
225 printf("#define\tPS_GLOBALDATA %#x\n", OS(privatespace, globaldata));
226 printf("#define\tPS_PRVPT %#x\n", OS(privatespace, prvpt));
227 printf("#define\tPS_LAPIC %#x\n", OS(privatespace, lapic));
228 printf("#define\tPS_IDLESTACK %#x\n", OS(privatespace, idlestack));
229 printf("#define\tPS_IDLESTACK_TOP %#x\n", OS(privatespace, CPAGE1));
230 printf("#define\tPS_CPAGE1 %#x\n", OS(privatespace, CPAGE1));
231 printf("#define\tPS_CPAGE2 %#x\n", OS(privatespace, CPAGE2));
232 printf("#define\tPS_CPAGE3 %#x\n", OS(privatespace, CPAGE3));
233 printf("#define\tPS_PPAGE1 %#x\n", OS(privatespace, PPAGE1));
234 printf("#define\tPS_IOAPICS %#x\n", OS(privatespace, ioapics));
235 #endif
236
237 return (0);
238 }
Cache object: c8a7120cc6fd62fe3bf96ec36e0ed93e
|