mirror of
https://github.com/reactos/reactos.git
synced 2024-08-20 18:35:32 +00:00
- In NTLDR boot, try to get the first kernel physical address from the loader entries.
- Fixup HAL's image base in the loader parameter block, since we load it at a different place then freeldr tells us. - We've reached a dead end in NTLDR compatibility. Out memory manager initialization code makes some assumptions which are totally incompatible with the page table state that NTLDR gives us. svn path=/trunk/; revision=24436
This commit is contained in:
parent
378f64d047
commit
ebd9a573ec
|
@ -216,6 +216,9 @@ KiRosFrldrLpbToNtLpb(IN PROS_LOADER_PARAMETER_BLOCK RosLoaderBlock,
|
|||
}
|
||||
else if (!(_stricmp(DriverName, "hal.dll")))
|
||||
{
|
||||
/* The HAL actually gets loaded somewhere else */
|
||||
ModStart = HalModuleObject.DllBase;
|
||||
|
||||
/* Create an MD for the HAL */
|
||||
MdEntry = &BldrMemoryDescriptors[i];
|
||||
MdEntry->MemoryType = LoaderHalCode;
|
||||
|
@ -294,8 +297,6 @@ KiRosPrepareForSystemStartup(IN ULONG Dummy,
|
|||
ULONG HalBase;
|
||||
ULONG DriverBase;
|
||||
ULONG DriverSize;
|
||||
//PIMAGE_NT_HEADERS NtHeader;
|
||||
//PIMAGE_OPTIONAL_HEADER OptHead;
|
||||
PLOADER_PARAMETER_BLOCK NtLoaderBlock;
|
||||
CHAR* s;
|
||||
PKTSS Tss;
|
||||
|
@ -320,7 +321,6 @@ KiRosPrepareForSystemStartup(IN ULONG Dummy,
|
|||
memcpy(&KeLoaderModules[0],
|
||||
(PVOID)KeRosLoaderBlock.ModsAddr,
|
||||
sizeof(LOADER_MODULE) * KeRosLoaderBlock.ModsCount);
|
||||
//KeRosLoaderBlock.ModsCount++;
|
||||
KeRosLoaderBlock.ModsAddr = (ULONG)&KeLoaderModules;
|
||||
|
||||
/* Check for BIOS memory map */
|
||||
|
|
|
@ -334,7 +334,7 @@ MmInitializePageList(ULONG_PTR FirstPhysKernelAddress,
|
|||
PFN_TYPE FirstUninitializedPage;
|
||||
ULONG PdeStart = PsGetCurrentProcess()->Pcb.DirectoryTableBase.LowPart;
|
||||
|
||||
DPRINT1("MmInitializePageList(FirstPhysKernelAddress %x, "
|
||||
DPRINT("MmInitializePageList(FirstPhysKernelAddress %x, "
|
||||
"LastPhysKernelAddress %x, "
|
||||
"MemorySizeInPages %x, LastKernelAddress %x)\n",
|
||||
FirstPhysKernelAddress,
|
||||
|
|
|
@ -300,6 +300,7 @@ MmInit1(ULONG_PTR FirstKrnlPhysAddr,
|
|||
ULONG i;
|
||||
ULONG kernel_len;
|
||||
ULONG_PTR MappingAddress;
|
||||
PLDR_DATA_TABLE_ENTRY LdrEntry;
|
||||
|
||||
DPRINT("MmInit1(FirstKrnlPhysAddr, %p, LastKrnlPhysAddr %p, LastKernelAddress %p)\n",
|
||||
FirstKrnlPhysAddr,
|
||||
|
@ -328,8 +329,20 @@ MmInit1(ULONG_PTR FirstKrnlPhysAddr,
|
|||
}
|
||||
|
||||
/* NTLDR Hacks */
|
||||
if (!MmFreeLdrMemHigher) MmFreeLdrMemHigher = 32768;
|
||||
if (!MmFreeLdrMemHigher) MmFreeLdrMemHigher = 65536;
|
||||
if (!MmFreeLdrPageDirectoryEnd) MmFreeLdrPageDirectoryEnd = 0x40000;
|
||||
if (!FirstKrnlPhysAddr)
|
||||
{
|
||||
/* Get the kernel entry */
|
||||
LdrEntry = CONTAINING_RECORD(KeLoaderBlock->LoadOrderListHead.Flink,
|
||||
LDR_DATA_TABLE_ENTRY,
|
||||
InLoadOrderLinks);
|
||||
|
||||
/* Get the addresses */
|
||||
FirstKrnlPhysAddr = (ULONG_PTR)LdrEntry->DllBase - KSEG0_BASE;
|
||||
|
||||
/* FIXME: How do we get the last address? */
|
||||
}
|
||||
|
||||
if (MmFreeLdrMemHigher >= (MaxMem - 1) * 1024)
|
||||
{
|
||||
|
@ -398,10 +411,6 @@ MmInit1(ULONG_PTR FirstKrnlPhysAddr,
|
|||
AddressRangeCount);
|
||||
kernel_len = LastKrnlPhysAddr - FirstKrnlPhysAddr;
|
||||
|
||||
//extern LOADER_MODULE KeLoaderModules[];
|
||||
//DPRINT1("Module one: %p %p\n", KeLoaderModules[0].ModStart, KeLoaderModules[0].ModEnd);
|
||||
//while (TRUE);
|
||||
|
||||
/*
|
||||
* Unmap low memory
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue