Fix up the kernel environment and module data pointers in the bootinfo if

they are present.
If we are told where the end of the loaded kernel image is, believe it.
This commit is contained in:
Mike Smith 1998-10-08 21:03:41 +00:00
parent 83eb77e880
commit 8ef367d43c
5 changed files with 83 additions and 8 deletions

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91
* $Id: genassym.c,v 1.60 1998/08/18 07:46:58 msmith Exp $ * $Id: genassym.c,v 1.61 1998/09/24 10:22:21 bde Exp $
*/ */
#include "opt_vm86.h" #include "opt_vm86.h"
@ -189,6 +189,9 @@ main()
printf("#define\tBI_SIZE %#x\n", OS(bootinfo, bi_size)); printf("#define\tBI_SIZE %#x\n", OS(bootinfo, bi_size));
printf("#define\tBI_SYMTAB %#x\n", OS(bootinfo, bi_symtab)); printf("#define\tBI_SYMTAB %#x\n", OS(bootinfo, bi_symtab));
printf("#define\tBI_ESYMTAB %#x\n", OS(bootinfo, bi_esymtab)); printf("#define\tBI_ESYMTAB %#x\n", OS(bootinfo, bi_esymtab));
printf("#define\tBI_KERNEND %#x\n", OS(bootinfo, bi_kernend));
printf("#define\tBI_ENVP %#x\n", OS(bootinfo, bi_envp));
printf("#define\tBI_MODULEP %#x\n", OS(bootinfo, bi_modulep));
printf("#define\tGD_SIZEOF %u\n", sizeof(struct globaldata)); printf("#define\tGD_SIZEOF %u\n", sizeof(struct globaldata));
printf("#define\tGD_CURPROC %#x\n", OS(globaldata, curproc)); printf("#define\tGD_CURPROC %#x\n", OS(globaldata, curproc));

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91 * from: @(#)locore.s 7.3 (Berkeley) 5/13/91
* $Id: locore.s,v 1.112 1998/08/03 21:31:32 msmith Exp $ * $Id: locore.s,v 1.113 1998/09/28 03:26:22 tegge Exp $
* *
* originally from: locore.s, by William F. Jolitz * originally from: locore.s, by William F. Jolitz
* *
@ -569,6 +569,22 @@ got_common_bi_size:
rep rep
movsb movsb
/*
* Fix up the module data and kernel environment pointers.
*/
movl R(_bootinfo+BI_ENVP),%eax
testl %eax,%eax
je no_envp
movl $KERNBASE,%eax
addl %eax,R(_bootinfo+BI_ENVP)
no_envp:
movl R(_bootinfo+BI_MODULEP),%eax
testl %eax,%eax
je no_modulep
movl $KERNBASE,%eax
addl %eax,R(_bootinfo+BI_MODULEP)
no_modulep:
#ifdef NFS_ROOT #ifdef NFS_ROOT
#ifndef BOOTP_NFSV3 #ifndef BOOTP_NFSV3
/* /*
@ -756,7 +772,7 @@ create_pagetables:
/* Find end of kernel image (rounded up to a page boundary). */ /* Find end of kernel image (rounded up to a page boundary). */
movl $R(_end),%esi movl $R(_end),%esi
/* include symbols in "kernel image" if they are loaded and useful */ /* include symbols if loaded and useful */
#ifdef DDB #ifdef DDB
movl R(_bootinfo+BI_ESYMTAB),%edi movl R(_bootinfo+BI_ESYMTAB),%edi
testl %edi,%edi testl %edi,%edi
@ -768,6 +784,13 @@ create_pagetables:
over_symalloc: over_symalloc:
#endif #endif
/* If we are told where the end of the kernel space is, believe it. */
movl R(_bootinfo+BI_KERNEND),%edi
testl %edi,%edi
je no_kernend
movl %edi,%esi
no_kernend:
addl $PAGE_MASK,%esi addl $PAGE_MASK,%esi
andl $~PAGE_MASK,%esi andl $~PAGE_MASK,%esi
movl %esi,R(_KERNend) /* save end of kernel */ movl %esi,R(_KERNend) /* save end of kernel */

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91 * from: @(#)locore.s 7.3 (Berkeley) 5/13/91
* $Id: locore.s,v 1.112 1998/08/03 21:31:32 msmith Exp $ * $Id: locore.s,v 1.113 1998/09/28 03:26:22 tegge Exp $
* *
* originally from: locore.s, by William F. Jolitz * originally from: locore.s, by William F. Jolitz
* *
@ -569,6 +569,22 @@ got_common_bi_size:
rep rep
movsb movsb
/*
* Fix up the module data and kernel environment pointers.
*/
movl R(_bootinfo+BI_ENVP),%eax
testl %eax,%eax
je no_envp
movl $KERNBASE,%eax
addl %eax,R(_bootinfo+BI_ENVP)
no_envp:
movl R(_bootinfo+BI_MODULEP),%eax
testl %eax,%eax
je no_modulep
movl $KERNBASE,%eax
addl %eax,R(_bootinfo+BI_MODULEP)
no_modulep:
#ifdef NFS_ROOT #ifdef NFS_ROOT
#ifndef BOOTP_NFSV3 #ifndef BOOTP_NFSV3
/* /*
@ -756,7 +772,7 @@ create_pagetables:
/* Find end of kernel image (rounded up to a page boundary). */ /* Find end of kernel image (rounded up to a page boundary). */
movl $R(_end),%esi movl $R(_end),%esi
/* include symbols in "kernel image" if they are loaded and useful */ /* include symbols if loaded and useful */
#ifdef DDB #ifdef DDB
movl R(_bootinfo+BI_ESYMTAB),%edi movl R(_bootinfo+BI_ESYMTAB),%edi
testl %edi,%edi testl %edi,%edi
@ -768,6 +784,13 @@ create_pagetables:
over_symalloc: over_symalloc:
#endif #endif
/* If we are told where the end of the kernel space is, believe it. */
movl R(_bootinfo+BI_KERNEND),%edi
testl %edi,%edi
je no_kernend
movl %edi,%esi
no_kernend:
addl $PAGE_MASK,%esi addl $PAGE_MASK,%esi
andl $~PAGE_MASK,%esi andl $~PAGE_MASK,%esi
movl %esi,R(_KERNend) /* save end of kernel */ movl %esi,R(_KERNend) /* save end of kernel */

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91
* $Id: genassym.c,v 1.60 1998/08/18 07:46:58 msmith Exp $ * $Id: genassym.c,v 1.61 1998/09/24 10:22:21 bde Exp $
*/ */
#include "opt_vm86.h" #include "opt_vm86.h"
@ -189,6 +189,9 @@ main()
printf("#define\tBI_SIZE %#x\n", OS(bootinfo, bi_size)); printf("#define\tBI_SIZE %#x\n", OS(bootinfo, bi_size));
printf("#define\tBI_SYMTAB %#x\n", OS(bootinfo, bi_symtab)); printf("#define\tBI_SYMTAB %#x\n", OS(bootinfo, bi_symtab));
printf("#define\tBI_ESYMTAB %#x\n", OS(bootinfo, bi_esymtab)); printf("#define\tBI_ESYMTAB %#x\n", OS(bootinfo, bi_esymtab));
printf("#define\tBI_KERNEND %#x\n", OS(bootinfo, bi_kernend));
printf("#define\tBI_ENVP %#x\n", OS(bootinfo, bi_envp));
printf("#define\tBI_MODULEP %#x\n", OS(bootinfo, bi_modulep));
printf("#define\tGD_SIZEOF %u\n", sizeof(struct globaldata)); printf("#define\tGD_SIZEOF %u\n", sizeof(struct globaldata));
printf("#define\tGD_CURPROC %#x\n", OS(globaldata, curproc)); printf("#define\tGD_CURPROC %#x\n", OS(globaldata, curproc));

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91 * from: @(#)locore.s 7.3 (Berkeley) 5/13/91
* $Id: locore.s,v 1.112 1998/08/03 21:31:32 msmith Exp $ * $Id: locore.s,v 1.113 1998/09/28 03:26:22 tegge Exp $
* *
* originally from: locore.s, by William F. Jolitz * originally from: locore.s, by William F. Jolitz
* *
@ -569,6 +569,22 @@ got_common_bi_size:
rep rep
movsb movsb
/*
* Fix up the module data and kernel environment pointers.
*/
movl R(_bootinfo+BI_ENVP),%eax
testl %eax,%eax
je no_envp
movl $KERNBASE,%eax
addl %eax,R(_bootinfo+BI_ENVP)
no_envp:
movl R(_bootinfo+BI_MODULEP),%eax
testl %eax,%eax
je no_modulep
movl $KERNBASE,%eax
addl %eax,R(_bootinfo+BI_MODULEP)
no_modulep:
#ifdef NFS_ROOT #ifdef NFS_ROOT
#ifndef BOOTP_NFSV3 #ifndef BOOTP_NFSV3
/* /*
@ -756,7 +772,7 @@ create_pagetables:
/* Find end of kernel image (rounded up to a page boundary). */ /* Find end of kernel image (rounded up to a page boundary). */
movl $R(_end),%esi movl $R(_end),%esi
/* include symbols in "kernel image" if they are loaded and useful */ /* include symbols if loaded and useful */
#ifdef DDB #ifdef DDB
movl R(_bootinfo+BI_ESYMTAB),%edi movl R(_bootinfo+BI_ESYMTAB),%edi
testl %edi,%edi testl %edi,%edi
@ -768,6 +784,13 @@ create_pagetables:
over_symalloc: over_symalloc:
#endif #endif
/* If we are told where the end of the kernel space is, believe it. */
movl R(_bootinfo+BI_KERNEND),%edi
testl %edi,%edi
je no_kernend
movl %edi,%esi
no_kernend:
addl $PAGE_MASK,%esi addl $PAGE_MASK,%esi
andl $~PAGE_MASK,%esi andl $~PAGE_MASK,%esi
movl %esi,R(_KERNend) /* save end of kernel */ movl %esi,R(_KERNend) /* save end of kernel */