mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-10 08:22:27 +01:00
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:
parent
83eb77e880
commit
8ef367d43c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=40081
sys
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* 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"
|
||||
@ -189,6 +189,9 @@ main()
|
||||
printf("#define\tBI_SIZE %#x\n", OS(bootinfo, bi_size));
|
||||
printf("#define\tBI_SYMTAB %#x\n", OS(bootinfo, bi_symtab));
|
||||
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_CURPROC %#x\n", OS(globaldata, curproc));
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@ -569,6 +569,22 @@ got_common_bi_size:
|
||||
rep
|
||||
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
|
||||
#ifndef BOOTP_NFSV3
|
||||
/*
|
||||
@ -756,7 +772,7 @@ create_pagetables:
|
||||
/* Find end of kernel image (rounded up to a page boundary). */
|
||||
movl $R(_end),%esi
|
||||
|
||||
/* include symbols in "kernel image" if they are loaded and useful */
|
||||
/* include symbols if loaded and useful */
|
||||
#ifdef DDB
|
||||
movl R(_bootinfo+BI_ESYMTAB),%edi
|
||||
testl %edi,%edi
|
||||
@ -768,6 +784,13 @@ create_pagetables:
|
||||
over_symalloc:
|
||||
#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
|
||||
andl $~PAGE_MASK,%esi
|
||||
movl %esi,R(_KERNend) /* save end of kernel */
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@ -569,6 +569,22 @@ got_common_bi_size:
|
||||
rep
|
||||
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
|
||||
#ifndef BOOTP_NFSV3
|
||||
/*
|
||||
@ -756,7 +772,7 @@ create_pagetables:
|
||||
/* Find end of kernel image (rounded up to a page boundary). */
|
||||
movl $R(_end),%esi
|
||||
|
||||
/* include symbols in "kernel image" if they are loaded and useful */
|
||||
/* include symbols if loaded and useful */
|
||||
#ifdef DDB
|
||||
movl R(_bootinfo+BI_ESYMTAB),%edi
|
||||
testl %edi,%edi
|
||||
@ -768,6 +784,13 @@ create_pagetables:
|
||||
over_symalloc:
|
||||
#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
|
||||
andl $~PAGE_MASK,%esi
|
||||
movl %esi,R(_KERNend) /* save end of kernel */
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* 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"
|
||||
@ -189,6 +189,9 @@ main()
|
||||
printf("#define\tBI_SIZE %#x\n", OS(bootinfo, bi_size));
|
||||
printf("#define\tBI_SYMTAB %#x\n", OS(bootinfo, bi_symtab));
|
||||
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_CURPROC %#x\n", OS(globaldata, curproc));
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@ -569,6 +569,22 @@ got_common_bi_size:
|
||||
rep
|
||||
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
|
||||
#ifndef BOOTP_NFSV3
|
||||
/*
|
||||
@ -756,7 +772,7 @@ create_pagetables:
|
||||
/* Find end of kernel image (rounded up to a page boundary). */
|
||||
movl $R(_end),%esi
|
||||
|
||||
/* include symbols in "kernel image" if they are loaded and useful */
|
||||
/* include symbols if loaded and useful */
|
||||
#ifdef DDB
|
||||
movl R(_bootinfo+BI_ESYMTAB),%edi
|
||||
testl %edi,%edi
|
||||
@ -768,6 +784,13 @@ create_pagetables:
|
||||
over_symalloc:
|
||||
#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
|
||||
andl $~PAGE_MASK,%esi
|
||||
movl %esi,R(_KERNend) /* save end of kernel */
|
||||
|
Loading…
Reference in New Issue
Block a user