FreeBSD/Linux Kernel Cross Reference
sys/i386/genassym.c
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990 Carnegie Mellon University
4 * Copyright (c) 1991 IBM Corporation
5 * All Rights Reserved.
6 *
7 * Permission to use, copy, modify and distribute this software and its
8 * documentation is hereby granted, provided that both the copyright
9 * notice and this permission notice appear in all copies of the
10 * software, derivative works or modified versions, and any portions
11 * thereof, and that both notices appear in supporting documentation,
12 * and that the name IBM not be used in advertising or publicity
13 * pertaining to distribution of the software without specific, written
14 * prior permission.
15 *
16 * CARNEGIE MELLON AND IBM ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17 * CONDITION. CARNEGIE MELLON AND IBM DISCLAIM ANY LIABILITY OF ANY KIND FOR
18 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19 *
20 * Carnegie Mellon requests users of this software to return to
21 *
22 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
23 * School of Computer Science
24 * Carnegie Mellon University
25 * Pittsburgh PA 15213-3890
26 *
27 * any improvements or extensions that they make and grant Carnegie Mellon
28 * the rights to redistribute these changes.
29 */
30
31
32
33 /*
34 * HISTORY
35 * $Log: genassym.c,v $
36 * Revision 2.15 93/02/04 07:56:12 danner
37 * Remove struct i386_fpsave_state (not used).
38 * [92/06/02 dbg@ibm]
39 *
40 * PS2 support.
41 * [92/02/24 dbg@ibm]
42 *
43 * Revision 2.14 93/01/14 17:29:04 danner
44 * Define constants for boot_info.
45 * [92/12/10 17:39:38 af]
46 *
47 * Revision 2.13 92/01/03 20:06:12 dbg
48 * Add DISP_MIN.
49 * [91/10/31 dbg]
50 *
51 * Revision 2.12 91/07/31 17:36:13 dbg
52 * Add microsecond timing.
53 *
54 * Save user registers in PCB and switch to separate kernel stack
55 * on entry.
56 * [91/07/30 16:50:29 dbg]
57 *
58 * Revision 2.11 91/06/19 11:55:05 rvb
59 * cputypes.h->platforms.h
60 * [91/06/12 13:44:45 rvb]
61 *
62 * Revision 2.10 91/05/14 16:08:23 mrt
63 * Correcting copyright
64 *
65 * Revision 2.9 91/05/08 12:37:41 dbg
66 * Add definitions for multiprocessors and for Sequent Symmetry.
67 * Change '#define' to '.set' to help fool GCC preprocessor.
68 * [91/04/26 14:35:03 dbg]
69 *
70 * Revision 2.8 91/03/16 14:44:15 rpd
71 * Removed k_ipl.
72 * [91/03/01 rpd]
73 * Added TH_SWAP_FUNC.
74 * [91/02/24 rpd]
75 *
76 * Added PCB_SIZE.
77 * [91/02/01 rpd]
78 *
79 * Revision 2.7 91/02/05 17:11:56 mrt
80 * Changed to new Mach copyright
81 * [91/02/01 17:34:22 mrt]
82 *
83 * Revision 2.6 91/01/09 22:41:19 rpd
84 * Removed user_regs, k_stack_top.
85 * [91/01/09 rpd]
86 *
87 * Revision 2.5 91/01/08 15:10:36 rpd
88 * Reorganized the pcb.
89 * [90/12/11 rpd]
90 *
91 * Revision 2.4 90/12/04 14:45:58 jsb
92 * Changes for merged intel/pmap.{c,h}.
93 * [90/12/04 11:15:00 jsb]
94 *
95 * Revision 2.3 90/08/27 21:56:44 dbg
96 * Use new names from new seg.h.
97 * [90/07/25 dbg]
98 *
99 * Revision 2.2 90/05/03 15:27:32 dbg
100 * Created.
101 * [90/02/11 dbg]
102 *
103 */
104
105 #include <platforms.h>
106 #include <cpus.h>
107 #include <mach_kdb.h>
108 #include <stat_time.h>
109
110 /*
111 * Pass field offsets to assembly code.
112 */
113 #include <kern/thread.h>
114 #include <kern/task.h>
115 #include <kern/syscall_emulation.h>
116 #include <mach/boot_info.h>
117 #include <i386/thread.h>
118 #include <mach/i386/vm_param.h>
119 #include <i386/seg.h>
120 #include <i386/pmap.h>
121 #include <i386/tss.h>
122 #if MACH_KDB
123 #include <sys/reboot.h>
124 #endif
125 #if NCPUS > 1
126 #include <i386/mp_desc.h>
127 #endif
128 #ifdef SYMMETRY
129 #include <sqt/slic.h>
130 #include <sqt/intctl.h>
131 #endif
132
133 /*ARGSUSED*/
134 main(argc,argv)
135 int argc;
136 char **argv;
137 {
138 struct i386_interrupt_state *iis = (struct i386_interrupt_state *)0;
139 struct i386_kernel_state *iks = STACK_IKS(0);
140 struct i386_saved_state *iss = (struct i386_saved_state *)0;
141 pcb_t pcb = (struct pcb *)0;
142 thread_t th = (thread_t)0;
143 task_t task = (task_t)0;
144 eml_dispatch_t eml = (eml_dispatch_t)0;
145 struct i386_tss *tss = (struct i386_tss *)0;
146 struct boot_info *bi = (struct boot_info *)0;
147 #if NCPUS > 1
148 struct mp_desc_table *mpt = (struct mp_desc_table *)0;
149 #endif
150 #if !STAT_TIME
151 struct timer *timer = (struct timer *)0;
152 #endif
153 #ifdef SYMMETRY
154 struct cpuslic *slic = (struct cpuslic *)0;
155 struct bin_header *bh = (struct bin_header *)0;
156 #endif
157
158 printf("\t.set\tTH_PCB,\t%d\n", &th->pcb);
159 printf("\t.set\tTH_TASK,\t%d\n", &th->task);
160 printf("\t.set\tTH_RECOVER,\t%d\n", &th->recover);
161 printf("\t.set\tTH_KERNEL_STACK,\t%d\n", &th->kernel_stack);
162 printf("\t.set\tTH_SWAP_FUNC,\t%d\n", &th->swap_func);
163
164 printf("\t.set\tTASK_EMUL,\t%d\n", &task->eml_dispatch);
165
166 printf("\t.set\tDISP_MIN,\t%d\n", &eml->disp_min);
167 printf("\t.set\tDISP_COUNT,\t%d\n", &eml->disp_count);
168 printf("\t.set\tDISP_VECTOR,\t%d\n", &eml->disp_vector[0]);
169
170 printf("\t.set\tKSS_EBX,\t%d\n", &iks->k_ebx);
171 printf("\t.set\tKSS_ESP,\t%d\n", &iks->k_esp);
172 printf("\t.set\tKSS_EBP,\t%d\n", &iks->k_ebp);
173 printf("\t.set\tKSS_EDI,\t%d\n", &iks->k_edi);
174 printf("\t.set\tKSS_ESI,\t%d\n", &iks->k_esi);
175 printf("\t.set\tKSS_EIP,\t%d\n", &iks->k_eip);
176
177 printf("\t.set\tIKS_SIZE,\t%d\n", sizeof(struct i386_kernel_state));
178 printf("\t.set\tIEL_SIZE,\t%d\n", sizeof(struct i386_exception_link));
179
180 printf("\t.set\tR_CS,\t%d\n", &iss->cs);
181 printf("\t.set\tR_UESP,\t%d\n", &iss->uesp);
182 printf("\t.set\tR_EAX,\t%d\n", &iss->eax);
183 printf("\t.set\tR_TRAPNO,\t%d\n", &iss->trapno);
184 printf("\t.set\tR_ERR,\t%d\n", &iss->err);
185 printf("\t.set\tR_EFLAGS,\t%d\n", &iss->efl);
186 printf("\t.set\tR_EIP,\t%d\n", &iss->eip);
187 printf("\t.set\tR_CR2,\t%d\n", &iss->cr2);
188
189 printf("\t.set\tI_EIP,\t%d\n", &iis->eip);
190 printf("\t.set\tI_CS,\t%d\n", &iis->cs);
191 printf("\t.set\tI_EFL,\t%d\n", &iis->efl);
192
193 printf("\t.set\tNBPG,\t%d\n", I386_PGBYTES);
194 printf("\t.set\tVM_MIN_ADDRESS,\t%d\n", VM_MIN_ADDRESS);
195 printf("\t.set\tVM_MAX_ADDRESS,\t%d\n", VM_MAX_ADDRESS);
196 printf("\t.set\tKERNELBASE,\t%d\n", VM_MIN_KERNEL_ADDRESS);
197 printf("\t.set\tKERNEL_STACK_SIZE,\t%d\n", KERNEL_STACK_SIZE);
198
199 printf("\t.set\tPDESHIFT,\t%d\n", PDESHIFT);
200 printf("\t.set\tPTESHIFT,\t%d\n", PTESHIFT);
201 printf("\t.set\tPTEMASK,\t%d\n", PTEMASK);
202
203 printf("\t.set\tPTE_PFN,\t%d\n", INTEL_PTE_PFN);
204 printf("\t.set\tPTE_V,\t%d\n", INTEL_PTE_VALID);
205 printf("\t.set\tPTE_W,\t%d\n", INTEL_PTE_WRITE);
206 printf("\t.set\tPTE_INVALID,\t%d\n", ~INTEL_PTE_VALID);
207
208 printf("\t.set\tIDTSZ,\t%d\n", IDTSZ);
209 printf("\t.set\tGDTSZ,\t%d\n", GDTSZ);
210 printf("\t.set\tLDTSZ,\t%d\n", LDTSZ);
211
212 printf("\t.set\tKERNEL_CS,\t%d\n", KERNEL_CS);
213 printf("\t.set\tKERNEL_DS,\t%d\n", KERNEL_DS);
214 printf("\t.set\tKERNEL_TSS,\t%d\n", KERNEL_TSS);
215 printf("\t.set\tKERNEL_LDT,\t%d\n", KERNEL_LDT);
216
217 #ifdef PS2
218 printf("\t.set\tABIOS_INT_RET,\t%d\n", ABIOS_INT_RET);
219 printf("\t.set\tABIOS_TH_RET,\t%d\n", ABIOS_TH_RET);
220 printf("\t.set\tABIOS_INT_SS,\t%d\n", ABIOS_INT_SS);
221 printf("\t.set\tABIOS_TH_SS,\t%d\n", ABIOS_TH_SS);
222 printf("\t.set\tGDTSZ,\t%d\n", GDTSZ);
223 printf("\t.set\tABIOS_FIRST_AVAIL_SEL,\t%d\n", ABIOS_FIRST_AVAIL_SEL);
224 #endif /* PS2 */
225
226 printf("\t.set\tPTES_PER_PAGE,\t%d\n", NPTES);
227 printf("\t.set\tINTEL_PTE_KERNEL,\t%d\n",
228 INTEL_PTE_VALID|INTEL_PTE_WRITE);
229
230 printf("\t.set\tKERNELBASEPDE,\t%d\n",
231 (VM_MIN_KERNEL_ADDRESS >> PDESHIFT)
232 *sizeof(pt_entry_t));
233
234 printf("\t.set\tTSS_ESP0,\t%d\n", &tss->esp0);
235 printf("\t.set\tTSS_SS0,\t%d\n", &tss->ss0);
236
237 printf("\t.set\tBI_SYM_SIZE,\t%d\n", &bi->sym_size);
238 printf("\t.set\tBI_BOOT_SIZE,\t%d\n", &bi->boot_size);
239 printf("\t.set\tBI_LOAD_INFO_SIZE,\t%d\n", &bi->load_info_size);
240 printf("\t.set\tBI_SIZE,\t%d\n", sizeof(*bi));
241
242 #if MACH_KDB
243 printf("\t.set\tRB_KDB,\t%d\n", RB_KDB);
244 #endif MACH_KDB
245
246 printf("\t.set\tK_TRAP_GATE,\t%d\n",
247 ACC_P|ACC_PL_K|ACC_TRAP_GATE);
248 printf("\t.set\tU_TRAP_GATE,\t%d\n",
249 ACC_P|ACC_PL_U|ACC_TRAP_GATE);
250 printf("\t.set\tK_INTR_GATE,\t%d\n",
251 ACC_P|ACC_PL_K|ACC_INTR_GATE);
252 printf("\t.set\tK_TSS, %d\n",
253 ACC_P|ACC_PL_K|ACC_TSS);
254
255 #if NCPUS > 1
256 printf("\t.set\tMP_GDT,\t%d\n", &mpt->gdt[0]);
257 printf("\t.set\tMP_IDT,\t%d\n", &mpt->idt[0]);
258 printf("\t.set\tINTSTACK_SIZE,\t%d\n", INTSTACK_SIZE);
259 #endif NCPUS > 1
260 #if !STAT_TIME
261 printf("\t.set\tLOW_BITS,\t%d\n", &timer->low_bits);
262 printf("\t.set\tHIGH_BITS,\t%d\n", &timer->high_bits);
263 printf("\t.set\tHIGH_BITS_CHECK,\t%d\n", &timer->high_bits_check);
264 printf("\t.set\tTIMER_HIGH_UNIT,\t%d\n", TIMER_HIGH_UNIT);
265 printf("\t.set\tTH_SYS_TIMER,\t%d\n", &th->system_timer);
266 printf("\t.set\tTH_USER_TIMER,\t%d\n", &th->user_timer);
267 #endif
268 #ifdef SYMMETRY
269 printf("\t.set\tVA_SLIC,\t%d\n", VA_SLIC);
270 printf("\t.set\tVA_ETC,\t%d\n", VA_ETC);
271 printf("\t.set\tSL_PROCID,\t%d\n", &slic->sl_procid);
272 printf("\t.set\tSL_LMASK,\t%d\n", &slic->sl_lmask);
273 printf("\t.set\tSL_BININT,\t%d\n", &slic->sl_binint);
274 printf("\t.set\tSL_B0INT,\t%d\n", &slic->sl_b0int);
275 printf("\t.set\tBH_SIZE,\t%d\n", &bh->bh_size);
276 printf("\t.set\tBH_HDLRTAB,\t%d\n", &bh->bh_hdlrtab);
277 #endif SYMMETRY
278
279
280 return (0);
281 }
282
Cache object: 702d4b6fed22dc174ef0ff149d9f8f43
|