diff --git a/reactos/config b/reactos/config index 89b47afd28b..4a6356a03ad 100644 --- a/reactos/config +++ b/reactos/config @@ -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? diff --git a/reactos/ntoskrnl/include/internal/i386/mm.h b/reactos/ntoskrnl/include/internal/i386/mm.h index d045379fe6e..9650f1bd32a 100644 --- a/reactos/ntoskrnl/include/internal/i386/mm.h +++ b/reactos/ntoskrnl/include/internal/i386/mm.h @@ -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 */ diff --git a/reactos/ntoskrnl/ke/main.c b/reactos/ntoskrnl/ke/main.c index 0f56046a651..0df09452e65 100644 --- a/reactos/ntoskrnl/ke/main.c +++ b/reactos/ntoskrnl/ke/main.c @@ -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; diff --git a/reactos/ntoskrnl/mm/mminit.c b/reactos/ntoskrnl/mm/mminit.c index 6dc0591c11b..95c02502c9d 100644 --- a/reactos/ntoskrnl/mm/mminit.c +++ b/reactos/ntoskrnl/mm/mminit.c @@ -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;