summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrgrimes <rgrimes@FreeBSD.org>1994-10-06 09:22:47 +0000
committerrgrimes <rgrimes@FreeBSD.org>1994-10-06 09:22:47 +0000
commit5ff3d9fc6c6b0dafbced34298a171ce745f00f3f (patch)
tree9e7170764111132048ec955a7da25b9073f1e22b
parentcbd22892bf96b0065b1731bc1b2bbfe2baf3cb2c (diff)
downloadFreeBSD-src-5ff3d9fc6c6b0dafbced34298a171ce745f00f3f.zip
FreeBSD-src-5ff3d9fc6c6b0dafbced34298a171ce745f00f3f.tar.gz
1. Eliminate unused esym global from locore, our boot code never supported
that and when it does it will be done differently. 2. The kernel now does a frame setup on entry so it ``looks'' like a real function call. This will be needed by future boot code and debuggers. 3. Clean up stack offsets to all be in decimal and use %ebp when copying parameters in from the boot code. 4. Implement version 1 of the uniform boot code passing mechanism with support for kernelname passing and nfs_diskless structure passing. 5. Document the 3 different ways the kernel is called depending on what code is calling it.
-rw-r--r--sys/amd64/amd64/genassym.c8
-rw-r--r--sys/amd64/amd64/locore.S73
-rw-r--r--sys/amd64/amd64/locore.s73
-rw-r--r--sys/i386/i386/genassym.c8
-rw-r--r--sys/i386/i386/locore.s73
5 files changed, 161 insertions, 74 deletions
diff --git a/sys/amd64/amd64/genassym.c b/sys/amd64/amd64/genassym.c
index 64acf58..35dc109 100644
--- a/sys/amd64/amd64/genassym.c
+++ b/sys/amd64/amd64/genassym.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)genassym.c 5.11 (Berkeley) 5/10/91
- * $Id: genassym.c,v 1.13 1994/10/02 04:45:33 davidg Exp $
+ * $Id: genassym.c,v 1.14 1994/10/02 07:19:43 rgrimes Exp $
*/
#include <sys/param.h>
@@ -55,6 +55,7 @@
#include <machine/trap.h>
#include <machine/psl.h>
#include <machine/reg.h>
+#include <machine/bootinfo.h>
#include <sys/syscall.h>
#include <vm/vm.h>
#include <sys/user.h>
@@ -76,6 +77,7 @@ main()
struct pcb *pcb = (struct pcb *)0;
struct trapframe *tf = (struct trapframe *)0;
struct sigframe *sigf = (struct sigframe *)0;
+ struct bootinfo_t *bootinfo = (struct bootinfo_t *)0;
register unsigned i;
printf("#define\tUDOT_SZ %d\n", sizeof(struct user));
@@ -199,6 +201,10 @@ main()
printf("#define\tENOENT %d\n", ENOENT);
printf("#define\tEFAULT %d\n", EFAULT);
printf("#define\tENAMETOOLONG %d\n", ENAMETOOLONG);
+ printf("#define\tMAXPATHLEN %d\n", MAXPATHLEN);
+ printf("#define\tBOOTINFO_VERSION %d\n", &bootinfo->version);
+ printf("#define\tBOOTINFO_KERNELNAME %d\n", &bootinfo->kernelname);
+ printf("#define\tBOOTINFO_NFS_DISKLESS %d\n", &bootinfo->nfs_diskless);
printf("#define\tNFSDISKLESS_SIZE %d\n", sizeof(struct nfs_diskless));
exit(0);
}
diff --git a/sys/amd64/amd64/locore.S b/sys/amd64/amd64/locore.S
index 80d6caf..d0ea96e 100644
--- a/sys/amd64/amd64/locore.S
+++ b/sys/amd64/amd64/locore.S
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
- * $Id: locore.s,v 1.31 1994/10/02 01:32:50 rgrimes Exp $
+ * $Id: locore.s,v 1.32 1994/10/02 18:57:15 davidg Exp $
*/
/*
@@ -101,8 +101,6 @@
* Globals
*/
.data
- .globl _esym
-_esym: .long 0 /* ptr to end of syms */
.globl _boothowto,_bootdev,_curpcb
@@ -164,6 +162,10 @@ NON_GPROF_ENTRY(btext)
.org 0x500 /* space for BIOS variables */
1:
+ /* Set up a real frame, some day we will be doing returns */
+ pushl %ebp
+ movl %esp, %ebp
+
/* Don't trust what the BIOS gives for eflags. */
pushl $PSL_MBO
popfl
@@ -192,7 +194,8 @@ NON_GPROF_ENTRY(btext)
* [return address != 0, and can be returned to]
*
* There may seem to be a lot of wasted arguments in here, but
- * that is so the newer boot code can still load very old kernels.
+ * that is so the newer boot code can still load very old kernels
+ * and old boot code can load new kernels.
*/
/*
@@ -200,7 +203,7 @@ NON_GPROF_ENTRY(btext)
* did an lret to get here. The frame on the stack has a return
* address of 0.
*/
- cmpl $0,0x00(%esp)
+ cmpl $0,4(%ebp)
je 2f /* olddiskboot: */
/*
@@ -209,7 +212,7 @@ NON_GPROF_ENTRY(btext)
* be detected by looking at the 5th argument, it if is 0 we
* we are being booted by the new unifrom boot code.
*/
- cmpl $0,0x14(%esp)
+ cmpl $0,24(%ebp)
je 1f /* newboot: */
/*
@@ -220,34 +223,56 @@ NON_GPROF_ENTRY(btext)
hlt
/*
- * We have been loaded by the new uniform boot code, this kernel
- * is not yet ready to handle that, so for now fix up the stack
- * like a real subroutine and then return to the boot loader with
- * a status of 1 to indicate this error.
+ * We have been loaded by the new uniform boot code.
+ * Lets check the bootinfo version, and if we do not understand
+ * it we return to the loader with a status of 1 to indicate this error
*/
1: /* newboot: */
- pushl %ebp
- movl %esp,%ebp
- movl $1,%eax
- leave
- ret
+ movl 28(%ebp),%ebx /* &bootinfo.version */
+ movl BOOTINFO_VERSION(%ebx),%eax
+ cmpl $1,%eax /* We only understand version 1 */
+ je 1f
+ movl $1,%eax /* Return status */
+ leave
+ ret
+
+1:
+ /*
+ * If we have a kernelname copy it in
+ */
+ movl BOOTINFO_KERNELNAME(%ebx),%esi
+ cmpl $0,%esi
+ je 1f /* No kernelname */
+ lea _kernelname-KERNBASE,%edi
+ movl $MAXPATHLEN,%ecx /* Brute force!!! */
+ cld
+ rep
+ movsb
+
+1:
+ /*
+ * If we have a nfs_diskless structure copy it in
+ */
+ movl BOOTINFO_NFS_DISKLESS(%ebx),%esi
+ cmpl $0,%esi
+ je 2f
+ lea _nfs_diskless-KERNBASE,%edi
+ movl $NFSDISKLESS_SIZE,%ecx
+ cld
+ rep
+ movsb
/*
* The old style disk boot.
* (*btext)(howto, bootdev, cyloffset, esym);
- * cyloffset is no longer copied
- * XXX Is esym still used for the end of the kernel some place???
- * for now make sure we keep a correct value in it until I
- * can deterimine that.
+ * Note that the newer boot code just falls into here to pick
+ * up howto and bootdev, cyloffset and esym are no longer used
*/
2: /* olddiskboot: */
- movl 4(%esp),%eax
+ movl 8(%ebp),%eax
movl %eax,_boothowto-KERNBASE
- movl 8(%esp),%eax
+ movl 12(%ebp),%eax
movl %eax,_bootdev-KERNBASE
- movl 16(%esp),%eax
- addl $KERNBASE,%eax
- movl %eax,_esym-KERNBASE
/* get the BIOS video mode pointer */
movl $0x4a8, %ecx
diff --git a/sys/amd64/amd64/locore.s b/sys/amd64/amd64/locore.s
index 80d6caf..d0ea96e 100644
--- a/sys/amd64/amd64/locore.s
+++ b/sys/amd64/amd64/locore.s
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
- * $Id: locore.s,v 1.31 1994/10/02 01:32:50 rgrimes Exp $
+ * $Id: locore.s,v 1.32 1994/10/02 18:57:15 davidg Exp $
*/
/*
@@ -101,8 +101,6 @@
* Globals
*/
.data
- .globl _esym
-_esym: .long 0 /* ptr to end of syms */
.globl _boothowto,_bootdev,_curpcb
@@ -164,6 +162,10 @@ NON_GPROF_ENTRY(btext)
.org 0x500 /* space for BIOS variables */
1:
+ /* Set up a real frame, some day we will be doing returns */
+ pushl %ebp
+ movl %esp, %ebp
+
/* Don't trust what the BIOS gives for eflags. */
pushl $PSL_MBO
popfl
@@ -192,7 +194,8 @@ NON_GPROF_ENTRY(btext)
* [return address != 0, and can be returned to]
*
* There may seem to be a lot of wasted arguments in here, but
- * that is so the newer boot code can still load very old kernels.
+ * that is so the newer boot code can still load very old kernels
+ * and old boot code can load new kernels.
*/
/*
@@ -200,7 +203,7 @@ NON_GPROF_ENTRY(btext)
* did an lret to get here. The frame on the stack has a return
* address of 0.
*/
- cmpl $0,0x00(%esp)
+ cmpl $0,4(%ebp)
je 2f /* olddiskboot: */
/*
@@ -209,7 +212,7 @@ NON_GPROF_ENTRY(btext)
* be detected by looking at the 5th argument, it if is 0 we
* we are being booted by the new unifrom boot code.
*/
- cmpl $0,0x14(%esp)
+ cmpl $0,24(%ebp)
je 1f /* newboot: */
/*
@@ -220,34 +223,56 @@ NON_GPROF_ENTRY(btext)
hlt
/*
- * We have been loaded by the new uniform boot code, this kernel
- * is not yet ready to handle that, so for now fix up the stack
- * like a real subroutine and then return to the boot loader with
- * a status of 1 to indicate this error.
+ * We have been loaded by the new uniform boot code.
+ * Lets check the bootinfo version, and if we do not understand
+ * it we return to the loader with a status of 1 to indicate this error
*/
1: /* newboot: */
- pushl %ebp
- movl %esp,%ebp
- movl $1,%eax
- leave
- ret
+ movl 28(%ebp),%ebx /* &bootinfo.version */
+ movl BOOTINFO_VERSION(%ebx),%eax
+ cmpl $1,%eax /* We only understand version 1 */
+ je 1f
+ movl $1,%eax /* Return status */
+ leave
+ ret
+
+1:
+ /*
+ * If we have a kernelname copy it in
+ */
+ movl BOOTINFO_KERNELNAME(%ebx),%esi
+ cmpl $0,%esi
+ je 1f /* No kernelname */
+ lea _kernelname-KERNBASE,%edi
+ movl $MAXPATHLEN,%ecx /* Brute force!!! */
+ cld
+ rep
+ movsb
+
+1:
+ /*
+ * If we have a nfs_diskless structure copy it in
+ */
+ movl BOOTINFO_NFS_DISKLESS(%ebx),%esi
+ cmpl $0,%esi
+ je 2f
+ lea _nfs_diskless-KERNBASE,%edi
+ movl $NFSDISKLESS_SIZE,%ecx
+ cld
+ rep
+ movsb
/*
* The old style disk boot.
* (*btext)(howto, bootdev, cyloffset, esym);
- * cyloffset is no longer copied
- * XXX Is esym still used for the end of the kernel some place???
- * for now make sure we keep a correct value in it until I
- * can deterimine that.
+ * Note that the newer boot code just falls into here to pick
+ * up howto and bootdev, cyloffset and esym are no longer used
*/
2: /* olddiskboot: */
- movl 4(%esp),%eax
+ movl 8(%ebp),%eax
movl %eax,_boothowto-KERNBASE
- movl 8(%esp),%eax
+ movl 12(%ebp),%eax
movl %eax,_bootdev-KERNBASE
- movl 16(%esp),%eax
- addl $KERNBASE,%eax
- movl %eax,_esym-KERNBASE
/* get the BIOS video mode pointer */
movl $0x4a8, %ecx
diff --git a/sys/i386/i386/genassym.c b/sys/i386/i386/genassym.c
index 64acf58..35dc109 100644
--- a/sys/i386/i386/genassym.c
+++ b/sys/i386/i386/genassym.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)genassym.c 5.11 (Berkeley) 5/10/91
- * $Id: genassym.c,v 1.13 1994/10/02 04:45:33 davidg Exp $
+ * $Id: genassym.c,v 1.14 1994/10/02 07:19:43 rgrimes Exp $
*/
#include <sys/param.h>
@@ -55,6 +55,7 @@
#include <machine/trap.h>
#include <machine/psl.h>
#include <machine/reg.h>
+#include <machine/bootinfo.h>
#include <sys/syscall.h>
#include <vm/vm.h>
#include <sys/user.h>
@@ -76,6 +77,7 @@ main()
struct pcb *pcb = (struct pcb *)0;
struct trapframe *tf = (struct trapframe *)0;
struct sigframe *sigf = (struct sigframe *)0;
+ struct bootinfo_t *bootinfo = (struct bootinfo_t *)0;
register unsigned i;
printf("#define\tUDOT_SZ %d\n", sizeof(struct user));
@@ -199,6 +201,10 @@ main()
printf("#define\tENOENT %d\n", ENOENT);
printf("#define\tEFAULT %d\n", EFAULT);
printf("#define\tENAMETOOLONG %d\n", ENAMETOOLONG);
+ printf("#define\tMAXPATHLEN %d\n", MAXPATHLEN);
+ printf("#define\tBOOTINFO_VERSION %d\n", &bootinfo->version);
+ printf("#define\tBOOTINFO_KERNELNAME %d\n", &bootinfo->kernelname);
+ printf("#define\tBOOTINFO_NFS_DISKLESS %d\n", &bootinfo->nfs_diskless);
printf("#define\tNFSDISKLESS_SIZE %d\n", sizeof(struct nfs_diskless));
exit(0);
}
diff --git a/sys/i386/i386/locore.s b/sys/i386/i386/locore.s
index 80d6caf..d0ea96e 100644
--- a/sys/i386/i386/locore.s
+++ b/sys/i386/i386/locore.s
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
- * $Id: locore.s,v 1.31 1994/10/02 01:32:50 rgrimes Exp $
+ * $Id: locore.s,v 1.32 1994/10/02 18:57:15 davidg Exp $
*/
/*
@@ -101,8 +101,6 @@
* Globals
*/
.data
- .globl _esym
-_esym: .long 0 /* ptr to end of syms */
.globl _boothowto,_bootdev,_curpcb
@@ -164,6 +162,10 @@ NON_GPROF_ENTRY(btext)
.org 0x500 /* space for BIOS variables */
1:
+ /* Set up a real frame, some day we will be doing returns */
+ pushl %ebp
+ movl %esp, %ebp
+
/* Don't trust what the BIOS gives for eflags. */
pushl $PSL_MBO
popfl
@@ -192,7 +194,8 @@ NON_GPROF_ENTRY(btext)
* [return address != 0, and can be returned to]
*
* There may seem to be a lot of wasted arguments in here, but
- * that is so the newer boot code can still load very old kernels.
+ * that is so the newer boot code can still load very old kernels
+ * and old boot code can load new kernels.
*/
/*
@@ -200,7 +203,7 @@ NON_GPROF_ENTRY(btext)
* did an lret to get here. The frame on the stack has a return
* address of 0.
*/
- cmpl $0,0x00(%esp)
+ cmpl $0,4(%ebp)
je 2f /* olddiskboot: */
/*
@@ -209,7 +212,7 @@ NON_GPROF_ENTRY(btext)
* be detected by looking at the 5th argument, it if is 0 we
* we are being booted by the new unifrom boot code.
*/
- cmpl $0,0x14(%esp)
+ cmpl $0,24(%ebp)
je 1f /* newboot: */
/*
@@ -220,34 +223,56 @@ NON_GPROF_ENTRY(btext)
hlt
/*
- * We have been loaded by the new uniform boot code, this kernel
- * is not yet ready to handle that, so for now fix up the stack
- * like a real subroutine and then return to the boot loader with
- * a status of 1 to indicate this error.
+ * We have been loaded by the new uniform boot code.
+ * Lets check the bootinfo version, and if we do not understand
+ * it we return to the loader with a status of 1 to indicate this error
*/
1: /* newboot: */
- pushl %ebp
- movl %esp,%ebp
- movl $1,%eax
- leave
- ret
+ movl 28(%ebp),%ebx /* &bootinfo.version */
+ movl BOOTINFO_VERSION(%ebx),%eax
+ cmpl $1,%eax /* We only understand version 1 */
+ je 1f
+ movl $1,%eax /* Return status */
+ leave
+ ret
+
+1:
+ /*
+ * If we have a kernelname copy it in
+ */
+ movl BOOTINFO_KERNELNAME(%ebx),%esi
+ cmpl $0,%esi
+ je 1f /* No kernelname */
+ lea _kernelname-KERNBASE,%edi
+ movl $MAXPATHLEN,%ecx /* Brute force!!! */
+ cld
+ rep
+ movsb
+
+1:
+ /*
+ * If we have a nfs_diskless structure copy it in
+ */
+ movl BOOTINFO_NFS_DISKLESS(%ebx),%esi
+ cmpl $0,%esi
+ je 2f
+ lea _nfs_diskless-KERNBASE,%edi
+ movl $NFSDISKLESS_SIZE,%ecx
+ cld
+ rep
+ movsb
/*
* The old style disk boot.
* (*btext)(howto, bootdev, cyloffset, esym);
- * cyloffset is no longer copied
- * XXX Is esym still used for the end of the kernel some place???
- * for now make sure we keep a correct value in it until I
- * can deterimine that.
+ * Note that the newer boot code just falls into here to pick
+ * up howto and bootdev, cyloffset and esym are no longer used
*/
2: /* olddiskboot: */
- movl 4(%esp),%eax
+ movl 8(%ebp),%eax
movl %eax,_boothowto-KERNBASE
- movl 8(%esp),%eax
+ movl 12(%ebp),%eax
movl %eax,_bootdev-KERNBASE
- movl 16(%esp),%eax
- addl $KERNBASE,%eax
- movl %eax,_esym-KERNBASE
/* get the BIOS video mode pointer */
movl $0x4a8, %ecx
OpenPOWER on IntegriCloud