Deleted Added
full compact
locore.s (5603) locore.s (5908)
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.45 1994/11/18 05:27:34 phk Exp $
37 * $Id: locore.s,v 1.46 1995/01/14 13:20:07 bde 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 "assym.s" /* system definitions */
49#include <machine/psl.h> /* processor status longword defs */
50#include <machine/pte.h> /* page table entry definitions */
51#include <sys/errno.h> /* error return codes */
52#include <machine/specialreg.h> /* x86 special registers */
53#include <machine/cputypes.h> /* x86 cpu type definitions */
54#include <sys/syscall.h> /* system call numbers */
55#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 "assym.s" /* system definitions */
49#include <machine/psl.h> /* processor status longword defs */
50#include <machine/pte.h> /* page table entry definitions */
51#include <sys/errno.h> /* error return codes */
52#include <machine/specialreg.h> /* x86 special registers */
53#include <machine/cputypes.h> /* x86 cpu type definitions */
54#include <sys/syscall.h> /* system call numbers */
55#include <machine/asmacros.h> /* miscellaneous asm macros */
56#include <sys/reboot.h>
56#include "apm.h"
57#if NAPM > 0
58#define ASM
59#include <machine/apm_bios.h>
60#include <machine/apm_segments.h>
61#endif /* NAPM */
62
63/*

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

119
120 .globl _boothowto,_bootdev
121
122 .globl _cpu,_cold,_atdevbase,_cpu_vendor,_cpu_id,_bootinfo
123
124_cpu: .long 0 /* are we 386, 386sx, or 486 */
125_cpu_id: .long 0 /* stepping ID */
126_cpu_vendor: .space 20 /* CPU origin code */
57#include "apm.h"
58#if NAPM > 0
59#define ASM
60#include <machine/apm_bios.h>
61#include <machine/apm_segments.h>
62#endif /* NAPM */
63
64/*

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

120
121 .globl _boothowto,_bootdev
122
123 .globl _cpu,_cold,_atdevbase,_cpu_vendor,_cpu_id,_bootinfo
124
125_cpu: .long 0 /* are we 386, 386sx, or 486 */
126_cpu_id: .long 0 /* stepping ID */
127_cpu_vendor: .space 20 /* CPU origin code */
127_bootinfo: .space BOOTINFO_SIZE /* the bootstrapper knew it! */
128_bootinfo: .space BOOTINFO_SIZE /* bootinfo that we can handle */
128_cold: .long 1 /* cold till we are not */
129_atdevbase: .long 0 /* location of start of iomem in virtual */
130_atdevphys: .long 0 /* location of device mapping ptes (phys) */
131
132_KERNend: .long 0 /* phys addr end of kernel (just after bss) */
133
134 .globl _IdlePTD
135_IdlePTD: .long 0 /* phys addr of kernel PTD */

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

238
239 /*
240 * We have been loaded by the new uniform boot code.
241 * Lets check the bootinfo version, and if we do not understand
242 * it we return to the loader with a status of 1 to indicate this error
243 */
2441: /* newboot: */
245 movl 28(%ebp),%ebx /* &bootinfo.version */
129_cold: .long 1 /* cold till we are not */
130_atdevbase: .long 0 /* location of start of iomem in virtual */
131_atdevphys: .long 0 /* location of device mapping ptes (phys) */
132
133_KERNend: .long 0 /* phys addr end of kernel (just after bss) */
134
135 .globl _IdlePTD
136_IdlePTD: .long 0 /* phys addr of kernel PTD */

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

239
240 /*
241 * We have been loaded by the new uniform boot code.
242 * Lets check the bootinfo version, and if we do not understand
243 * it we return to the loader with a status of 1 to indicate this error
244 */
2451: /* newboot: */
246 movl 28(%ebp),%ebx /* &bootinfo.version */
246 movl BOOTINFO_VERSION(%ebx),%eax
247 movl BI_VERSION(%ebx),%eax
247 cmpl $1,%eax /* We only understand version 1 */
248 je 1f
249 movl $1,%eax /* Return status */
250 leave
251 ret
252
2531:
254 /*
255 * If we have a kernelname copy it in
256 */
248 cmpl $1,%eax /* We only understand version 1 */
249 je 1f
250 movl $1,%eax /* Return status */
251 leave
252 ret
253
2541:
255 /*
256 * If we have a kernelname copy it in
257 */
257 movl BOOTINFO_KERNELNAME(%ebx),%esi
258 movl BI_KERNELNAME(%ebx),%esi
258 cmpl $0,%esi
259 je 1f /* No kernelname */
260 lea _kernelname-KERNBASE,%edi
261 movl $MAXPATHLEN,%ecx /* Brute force!!! */
262 cld
263 rep
264 movsb
265
2661:
267 /*
259 cmpl $0,%esi
260 je 1f /* No kernelname */
261 lea _kernelname-KERNBASE,%edi
262 movl $MAXPATHLEN,%ecx /* Brute force!!! */
263 cld
264 rep
265 movsb
266
2671:
268 /*
268 * Copy the bootinfo structure
269 * Determine the size of the boot loader's copy of the bootinfo
270 * struct. This is impossible to do properly because old versions
271 * of the struct don't contain a size field and there are 2 old
272 * versions with the same version number.
269 */
273 */
274 movl $BI_ENDCOMMON,%ecx /* prepare for sizeless version */
275 testl $RB_BOOTINFO,8(%ebp) /* bi_size (and bootinfo) valid? */
276 je got_bi_size /* no, sizeless version */
277 movl BI_SIZE(%ebx),%ecx
278got_bi_size:
279
280 /*
281 * Copy the common part of the bootinfo struct
282 */
270 movl %ebx,%esi
283 movl %ebx,%esi
271 lea _bootinfo-KERNBASE,%edi
284 movl $_bootinfo-KERNBASE,%edi
285 cmpl $BOOTINFO_SIZE,%ecx
286 jbe got_common_bi_size
272 movl $BOOTINFO_SIZE,%ecx
287 movl $BOOTINFO_SIZE,%ecx
288got_common_bi_size:
273 cld
274 rep
275 movsb
276
277#ifdef NFS
278 /*
279 * If we have a nfs_diskless structure copy it in
280 */
289 cld
290 rep
291 movsb
292
293#ifdef NFS
294 /*
295 * If we have a nfs_diskless structure copy it in
296 */
281 movl BOOTINFO_NFS_DISKLESS(%ebx),%esi
297 movl BI_NFS_DISKLESS(%ebx),%esi
282 cmpl $0,%esi
283 je 2f
284 lea _nfs_diskless-KERNBASE,%edi
285 movl $NFSDISKLESS_SIZE,%ecx
286 cld
287 rep
288 movsb
289 lea _nfs_diskless_valid-KERNBASE,%edi

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

512/* clear bss */
513 movl $_edata-KERNBASE,%edi
514 subl %edi,%ecx /* get amount to clear */
515 xorl %eax,%eax /* specify zero fill */
516 cld
517 rep
518 stosb
519
298 cmpl $0,%esi
299 je 2f
300 lea _nfs_diskless-KERNBASE,%edi
301 movl $NFSDISKLESS_SIZE,%ecx
302 cld
303 rep
304 movsb
305 lea _nfs_diskless_valid-KERNBASE,%edi

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

528/* clear bss */
529 movl $_edata-KERNBASE,%edi
530 subl %edi,%ecx /* get amount to clear */
531 xorl %eax,%eax /* specify zero fill */
532 cld
533 rep
534 stosb
535
536#ifdef DDB
537/* include symbols in "kernel image" if they are loaded */
538 movl _bootinfo+BI_ESYMTAB-KERNBASE,%edi
539 testl %edi,%edi
540 je over_symalloc
541 addl $NBPG-1,%edi
542 andl $~(NBPG-1),%edi
543 movl %edi,%esi
544 movl %esi,_KERNend-KERNBASE
545 movl $KERNBASE,%edi
546 addl %edi,_bootinfo+BI_SYMTAB-KERNBASE
547 addl %edi,_bootinfo+BI_ESYMTAB-KERNBASE
548over_symalloc:
549#endif
550
520/*
521 * The value in esi is both the end of the kernel bss and a pointer to
522 * the kernel page directory, and is used by the rest of locore to build
523 * the tables.
524 * esi + 1(page dir) + 2(UPAGES) + 1(p0stack) + NKPT(number of kernel
525 * page table pages) is then passed on the stack to init386(first) as
526 * the value first. esi should ALWAYS be page aligned!!
527 */

--- 290 unchanged lines hidden ---
551/*
552 * The value in esi is both the end of the kernel bss and a pointer to
553 * the kernel page directory, and is used by the rest of locore to build
554 * the tables.
555 * esi + 1(page dir) + 2(UPAGES) + 1(p0stack) + NKPT(number of kernel
556 * page table pages) is then passed on the stack to init386(first) as
557 * the value first. esi should ALWAYS be page aligned!!
558 */

--- 290 unchanged lines hidden ---