Dynamic 3GB support, part 1. Only multiboot.S remains to be changed, all other parts of the Kernel now used KERNEL_BASE based on the command-line (Please don't use /3gb if you don't compile 3GB)

svn path=/trunk/; revision=13305
This commit is contained in:
Alex Ionescu 2005-01-26 05:00:08 +00:00
parent d533b8c5d3
commit 394f14a702
4 changed files with 25 additions and 11 deletions

View file

@ -45,7 +45,7 @@ ACPI := 0
#
# whether to use a 3GB User, 1GB Kernel memory map
#
3GB := 1
3GB := 0
#
# Which version of NDIS do we support up to?

View file

@ -23,14 +23,10 @@
#endif
#ifdef __3GB__
#define KERNEL_BASE (0xC0000000)
#else
#define KERNEL_BASE (0x80000000)
#endif
#ifndef __ASM__
#define KERNEL_BASE (ULONG)MmSystemRangeStart
#if defined(__GNUC__)
#define FLUSH_TLB { \
@ -65,6 +61,14 @@ VOID MiEnablePAE(PVOID* LastKernelAddress);
#define PAGE_MASK(x) ((x)&(~0xfff))
#define PAE_PAGE_MASK(x) ((x)&(~0xfffLL))
#else
#ifdef __3GB__
#define KERNEL_BASE (0xC0000000)
#else
#define KERNEL_BASE (0x80000000)
#endif
#endif /* ASSEMBLER */
#endif /* __NTOSKRNL_INCLUDE_INTERNAL_I386_MM_H */

View file

@ -691,6 +691,7 @@ ExpInitializeExecutive(VOID)
/* Create the SystemRoot symbolic link */
CPRINT("CommandLine: %s\n", (PCHAR)KeLoaderBlock.CommandLine);
DPRINT1("MmSystemRangeStart: 0x%x\n", MmSystemRangeStart);
Status = IoCreateSystemRootLink((PCHAR)KeLoaderBlock.CommandLine);
if (!NT_SUCCESS(Status))
{
@ -953,6 +954,18 @@ _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock)
}
KeLoaderBlock.CommandLine = (ULONG)KeLoaderCommandLine;
/* Gotta check 3GB setting right *here* before we use KERNEL_BASE! */
if (!_strnicmp(KeLoaderCommandLine, "3GB", 3)) {
/* Use 3GB */
MmSystemRangeStart = (PVOID)0xC0000000;
} else {
/* Use 2GB */
MmSystemRangeStart = (PVOID)0x80000000;
}
strcpy(KeLoaderModuleStrings[0], "ntoskrnl.exe");
KeLoaderModules[0].String = (ULONG)KeLoaderModuleStrings[0];
KeLoaderModules[0].ModStart = KERNEL_BASE;

View file

@ -324,10 +324,7 @@ MmInit1(ULONG_PTR FirstKrnlPhysAddr,
KeLoaderBlock.MemHigher = (MaxMem - 1) * 1024;
}
/*
* FIXME: Set this based on the system command line
*/
MmSystemRangeStart = (PVOID)KERNEL_BASE; // 0xC0000000
/* Set memory limits */
MmUserProbeAddress = 0x7fff0000;
MmHighestUserAddress = (PVOID)0x7ffeffff;