Deleted Added
full compact
locore.s (3117) locore.s (3258)
1/*-
2 * Copyright (c) 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

--- 20 unchanged lines hidden (view full) ---

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: @(#)locore.s 7.3 (Berkeley) 5/13/91
1/*-
2 * Copyright (c) 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

--- 20 unchanged lines hidden (view full) ---

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: @(#)locore.s 7.3 (Berkeley) 5/13/91
37 * $Id: locore.s,v 1.28 1994/09/15 07:26:31 sos Exp $
37 * $Id: locore.s,v 1.29 1994/09/26 16:56:22 pst Exp $
38 */
39
40/*
41 * locore.s: FreeBSD machine support for the Intel 386
42 * originally from: locore.s, by William F. Jolitz
43 *
44 * Substantially rewritten by David Greenman, Rod Grimes,
45 * Bruce Evans, Wolfgang Solfrank, and many others.
46 */
47
48#include "npx.h" /* for NNPX */
49#include "assym.s" /* system definitions */
50#include <machine/psl.h> /* processor status longword defs */
51#include <machine/pte.h> /* page table entry definitions */
52#include <sys/errno.h> /* error return codes */
53#include <machine/specialreg.h> /* x86 special registers */
54#include <machine/cputypes.h> /* x86 cpu type definitions */
55#include <sys/syscall.h> /* system call numbers */
56#include <machine/asmacros.h> /* miscellaneous asm macros */
38 */
39
40/*
41 * locore.s: FreeBSD machine support for the Intel 386
42 * originally from: locore.s, by William F. Jolitz
43 *
44 * Substantially rewritten by David Greenman, Rod Grimes,
45 * Bruce Evans, Wolfgang Solfrank, and many others.
46 */
47
48#include "npx.h" /* for NNPX */
49#include "assym.s" /* system definitions */
50#include <machine/psl.h> /* processor status longword defs */
51#include <machine/pte.h> /* page table entry definitions */
52#include <sys/errno.h> /* error return codes */
53#include <machine/specialreg.h> /* x86 special registers */
54#include <machine/cputypes.h> /* x86 cpu type definitions */
55#include <sys/syscall.h> /* system call numbers */
56#include <machine/asmacros.h> /* miscellaneous asm macros */
57#ifdef APM
58#define ASM
59#include <machine/apm_bios.h>
60#include <machine/apm_segments.h>
61#endif
57
58/*
59 * XXX
60 *
61 * Note: This version greatly munged to avoid various assembler errors
62 * that may be fixed in newer versions of gas. Perhaps newer versions
63 * will have more pleasant appearance.
64 */

--- 60 unchanged lines hidden (view full) ---

125
126 .globl _proc0paddr
127_proc0paddr: .long 0 /* address of proc 0 address space */
128
129#ifdef BDE_DEBUGGER
130 .globl _bdb_exists /* flag to indicate BDE debugger is available */
131_bdb_exists: .long 0
132#endif
62
63/*
64 * XXX
65 *
66 * Note: This version greatly munged to avoid various assembler errors
67 * that may be fixed in newer versions of gas. Perhaps newer versions
68 * will have more pleasant appearance.
69 */

--- 60 unchanged lines hidden (view full) ---

130
131 .globl _proc0paddr
132_proc0paddr: .long 0 /* address of proc 0 address space */
133
134#ifdef BDE_DEBUGGER
135 .globl _bdb_exists /* flag to indicate BDE debugger is available */
136_bdb_exists: .long 0
137#endif
138#ifdef APM
139 .globl _apm_current_gdt_pdesc /* current GDT pseudo desc. */
140_apm_current_gdt_pdesc:
141 .byte 0, 0, 0
133
142
143 .globl _bootstrap_gdt
144_bootstrap_gdt:
145 .space SIZEOF_GDT * BOOTSTRAP_GDT_NUM
146#endif /* APM */
134 .globl tmpstk
135 .space 0x1000
136tmpstk:
137
138
139/*
140 * System Initialization
141 */

--- 48 unchanged lines hidden (view full) ---

190#ifdef DISKLESS /* Copy diskless structure */
191 movl _nfs_diskless_size-KERNBASE,%ecx
192 movl 20(%esp),%esi
193 movl $(_nfs_diskless-KERNBASE),%edi
194 cld
195 rep
196 movsb
197#endif
147 .globl tmpstk
148 .space 0x1000
149tmpstk:
150
151
152/*
153 * System Initialization
154 */

--- 48 unchanged lines hidden (view full) ---

203#ifdef DISKLESS /* Copy diskless structure */
204 movl _nfs_diskless_size-KERNBASE,%ecx
205 movl 20(%esp),%esi
206 movl $(_nfs_diskless-KERNBASE),%edi
207 cld
208 rep
209 movsb
210#endif
211#ifdef APM
212 /*
213 * Setup APM BIOS:
214 *
215 * APM BIOS initialization should be done from real mode or V86 mode.
216 *
217 * (by HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp>)
218 */
198
219
220 /*
221 * Copy APM initializer under 1MB boundary:
222 *
223 * APM initializer program must switch the CPU to real mode.
224 * But FreeBSD kernel runs above 1MB boundary. So we must
225 * copy the initializer code to conventional memory.
226 */
227 movl _apm_init_image_size-KERNBASE, %ecx /* size */
228 lea _apm_init_image-KERNBASE, %esi /* source */
229 movl $ APM_OURADDR, %edi /* destination */
230 cld
231 rep
232 movsb
233
234 /* get GDT base */
235 sgdt _apm_current_gdt_pdesc-KERNBASE
236
237 /* copy GDT to _bootstrap_gdt */
238 xorl %ecx, %ecx
239 movw _apm_current_gdt_pdesc-KERNBASE, %cx
240 movl _apm_current_gdt_pdesc-KERNBASE+2, %esi
241 lea _bootstrap_gdt-KERNBASE, %edi
242 cld
243 rep
244 movsb
245
246 /* setup GDT pseudo descriptor */
247 movw $(SIZEOF_GDT*BOOTSTRAP_GDT_NUM), %ax
248 movw %ax, _apm_current_gdt_pdesc-KERNBASE
249 leal _bootstrap_gdt-KERNBASE, %eax
250 movl %eax, _apm_current_gdt_pdesc-KERNBASE+2
251
252 /* load new GDTR */
253 lgdt _apm_current_gdt_pdesc-KERNBASE
254
255 /* setup GDT for APM initializer */
256 lea _bootstrap_gdt-KERNBASE, %ecx
257 movl $(APM_OURADDR), %eax /* use %ax for 15..0 */
258 movl %eax, %ebx
259 shrl $16, %ebx /* use %bl for 23..16 */
260 /* use %bh for 31..24 */
261#define APM_SETUP_GDT(index, attrib) \
262 movl $(index), %si ; \
263 lea 0(%ecx,%esi,8), %edx ; \
264 movw $0xffff, (%edx) ; \
265 movw %ax, 2(%edx) ; \
266 movb %bl, 4(%edx) ; \
267 movw $(attrib), 5(%edx) ; \
268 movb %bh, 7(%edx)
269
270 APM_SETUP_GDT(APM_INIT_CS_INDEX , CS32_ATTRIB)
271 APM_SETUP_GDT(APM_INIT_DS_INDEX , DS32_ATTRIB)
272 APM_SETUP_GDT(APM_INIT_CS16_INDEX, CS16_ATTRIB)
273
274 /*
275 * Call the initializer:
276 *
277 * direct intersegment call to conventional memory code
278 */
279 .byte 0x9a /* actually, lcall $APM_INIT_CS_SEL, $0 */
280 .long 0
281 .word APM_INIT_CS_SEL
282
283 movw %ax, _apm_version-KERNBASE
284 movl %ebx, _apm_cs_entry-KERNBASE
285 movw %cx, _apm_cs32_base-KERNBASE
286 shrl $16, %ecx
287 movw %cx, _apm_cs16_base-KERNBASE
288 movw %dx, _apm_ds_base-KERNBASE
289 movw %si, _apm_cs_limit-KERNBASE
290 shrl $16, %esi
291 movw %si, _apm_ds_limit-KERNBASE
292 movw %di, _apm_flags-KERNBASE
293#endif /* APM */
294
199 /* Find out our CPU type. */
200
201 /* Try to toggle alignment check flag; does not exist on 386. */
202 pushfl
203 popl %eax
204 movl %eax,%ecx
205 orl $PSL_AC,%eax
206 pushl %eax

--- 406 unchanged lines hidden ---
295 /* Find out our CPU type. */
296
297 /* Try to toggle alignment check flag; does not exist on 386. */
298 pushfl
299 popl %eax
300 movl %eax,%ecx
301 orl $PSL_AC,%eax
302 pushl %eax

--- 406 unchanged lines hidden ---