From 5ba38d0494ab93facfefc6a5a5d01c61bbdce954 Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Fri, 2 Mar 2007 07:23:19 +0000 Subject: [PATCH] - Don't depend on LD variables anymore for Mm. - Update KrnlFun.c - Make pushlock.c compile with msvc/wdk. - Fix definition of HIGH_LEVEL_ENTRIES which was way too small (and thus always 0) which caused frees/allocates in the 3rd-level table not to work properly. MSVC statically detected this, it's unlikely we were hitting this in ROS at the moment but it would've been a bad bug to catch later, yay msvc. svn path=/trunk/; revision=25944 --- reactos/ntoskrnl/KrnlFun.c | 5 +++- reactos/ntoskrnl/ex/pushlock.c | 8 ++++--- reactos/ntoskrnl/include/internal/ex.h | 2 +- reactos/ntoskrnl/io/iomgr/driver.c | 2 +- reactos/ntoskrnl/mm/freelist.c | 2 +- reactos/ntoskrnl/mm/mminit.c | 33 +++++++++++++++++++------- 6 files changed, 36 insertions(+), 16 deletions(-) diff --git a/reactos/ntoskrnl/KrnlFun.c b/reactos/ntoskrnl/KrnlFun.c index 3f59d2d7a62..a97231b8e12 100644 --- a/reactos/ntoskrnl/KrnlFun.c +++ b/reactos/ntoskrnl/KrnlFun.c @@ -13,7 +13,10 @@ // // Global: // - TODO: Complete the list of bufxies -// - Fix atapi.sys or serial.sys loading one more time at each boot. +// - Fix boot on VMWare. +// - Fix weird crash on boot with 0x867-0x872 EIP. +// - Fix trap.s AMD64 VMWare "Greatlord Issue". +// - Support SSE/MMX. // /////////////////////////////////////////////////////////////////////////////// diff --git a/reactos/ntoskrnl/ex/pushlock.c b/reactos/ntoskrnl/ex/pushlock.c index 18aa4bb4f78..65def87646f 100644 --- a/reactos/ntoskrnl/ex/pushlock.c +++ b/reactos/ntoskrnl/ex/pushlock.c @@ -10,11 +10,13 @@ #include #define NDEBUG -#include +#include /* DATA **********************************************************************/ ULONG ExPushLockSpinCount; +#undef EX_PUSH_LOCK +#undef PEX_PUSH_LOCK /* PRIVATE FUNCTIONS *********************************************************/ @@ -439,10 +441,10 @@ VOID FASTCALL ExfAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock) { - DEFINE_WAIT_BLOCK(WaitBlock); EX_PUSH_LOCK OldValue = *PushLock, NewValue, TempValue; BOOLEAN NeedWake; ULONG i; + DEFINE_WAIT_BLOCK(WaitBlock); /* Start main loop */ for (;;) @@ -605,10 +607,10 @@ VOID FASTCALL ExfAcquirePushLockShared(PEX_PUSH_LOCK PushLock) { - DEFINE_WAIT_BLOCK(WaitBlock); EX_PUSH_LOCK OldValue = *PushLock, NewValue; BOOLEAN NeedWake; ULONG i; + DEFINE_WAIT_BLOCK(WaitBlock); /* Start main loop */ for (;;) diff --git a/reactos/ntoskrnl/include/internal/ex.h b/reactos/ntoskrnl/include/internal/ex.h index 22c227a8f3f..622df3c573d 100644 --- a/reactos/ntoskrnl/include/internal/ex.h +++ b/reactos/ntoskrnl/include/internal/ex.h @@ -92,7 +92,7 @@ typedef struct // #define LOW_LEVEL_ENTRIES (PAGE_SIZE / sizeof(HANDLE_TABLE_ENTRY)) #define MID_LEVEL_ENTRIES (PAGE_SIZE / sizeof(PHANDLE_TABLE_ENTRY)) -#define HIGH_LEVEL_ENTRIES (65535 / (LOW_LEVEL_ENTRIES * MID_LEVEL_ENTRIES)) +#define HIGH_LEVEL_ENTRIES (16777216 / (LOW_LEVEL_ENTRIES * MID_LEVEL_ENTRIES)) // // Maximum index in each table level before we need another table diff --git a/reactos/ntoskrnl/io/iomgr/driver.c b/reactos/ntoskrnl/io/iomgr/driver.c index d98c385c668..838e292b246 100644 --- a/reactos/ntoskrnl/io/iomgr/driver.c +++ b/reactos/ntoskrnl/io/iomgr/driver.c @@ -1305,7 +1305,7 @@ IoCreateDriver(IN PUNICODE_STRING DriverName OPTIONAL, /* Null-terminate it and set it */ ServiceKeyName.Buffer[ServiceKeyName.Length / sizeof(WCHAR)] = UNICODE_NULL; - DriverObject->DriverExtension->ServiceKeyName = ServiceKeyName; + DriverObject->DriverExtension->ServiceKeyName = ServiceKeyName; /* Also store it in the Driver Object. This is a bit of a hack. */ RtlCopyMemory(&DriverObject->DriverName, diff --git a/reactos/ntoskrnl/mm/freelist.c b/reactos/ntoskrnl/mm/freelist.c index 920f0151c31..cf1cd761277 100644 --- a/reactos/ntoskrnl/mm/freelist.c +++ b/reactos/ntoskrnl/mm/freelist.c @@ -1153,7 +1153,7 @@ MmZeroPageThreadMain(PVOID Ignored) ULONG Count; /* Free initial kernel memory */ - MiFreeInitMemory(); + //MiFreeInitMemory(); /* Set our priority to 0 */ KeGetCurrentThread()->BasePriority = 0; diff --git a/reactos/ntoskrnl/mm/mminit.c b/reactos/ntoskrnl/mm/mminit.c index e478f84ede1..4b2eaac2318 100644 --- a/reactos/ntoskrnl/mm/mminit.c +++ b/reactos/ntoskrnl/mm/mminit.c @@ -19,6 +19,7 @@ /* * Compiler defined symbols */ +#if 0 extern unsigned int _image_base__; extern unsigned int _text_start__; extern unsigned int _text_end__; @@ -27,7 +28,7 @@ extern unsigned int _init_start__; extern unsigned int _init_end__; extern unsigned int _bss_end__; - +#endif static BOOLEAN IsThisAnNtAsSystem = FALSE; MM_SYSTEMSIZE MmSystemSize = MmSmallSystem; @@ -39,13 +40,6 @@ ULONG MiNonPagedPoolLength; VOID INIT_FUNCTION NTAPI MmInitVirtualMemory(ULONG_PTR LastKernelAddress, ULONG KernelLength); -#if defined (ALLOC_PRAGMA) -#pragma alloc_text(INIT, MmInitVirtualMemory) -#pragma alloc_text(INIT, MmInit1) -#pragma alloc_text(INIT, MmInit2) -#pragma alloc_text(INIT, MmInit3) -#endif - /* FUNCTIONS ****************************************************************/ /* @@ -83,7 +77,7 @@ MmInitVirtualMemory(ULONG_PTR LastKernelAddress, { PVOID BaseAddress; ULONG Length; - ULONG ParamLength = KernelLength; + //ULONG ParamLength = KernelLength; NTSTATUS Status; PHYSICAL_ADDRESS BoundaryAddressMultiple; PFN_TYPE Pfn; @@ -159,7 +153,24 @@ MmInitVirtualMemory(ULONG_PTR LastKernelAddress, 0, BoundaryAddressMultiple); +#if 0 + DPRINT1("LD Vars: %lx %lx %lx %lx %lx %lx. Last: %lx\n", + &_image_base__, + &_text_start__, + &_text_end__, + &_init_start__, + &_init_end__, + &_bss_end__, + LastKernelAddress); BaseAddress = (PVOID)&_image_base__; + DPRINT1("Non-LD Vars: %lx %lx %lx %lx %lx %lx. Last: %lx\n", + 0, + 0, + 0, + 0, + 0, + 0, + LastKernelAddress); Length = PAGE_ROUND_UP(((ULONG_PTR)&_text_end__)) - (ULONG_PTR)&_image_base__; ParamLength = ParamLength - Length; @@ -225,6 +236,7 @@ MmInitVirtualMemory(ULONG_PTR LastKernelAddress, TRUE, 0, BoundaryAddressMultiple); +#endif BaseAddress = MiNonPagedPoolStart; MmCreateMemoryArea(MmGetKernelAddressSpace(), @@ -515,6 +527,8 @@ MmInitSystem(IN ULONG Phase, return TRUE; } +#if 0 + VOID static MiFreeInitMemoryPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address, PFN_TYPE Page, SWAPENTRY SwapEntry, @@ -538,3 +552,4 @@ MiFreeInitMemory(VOID) NULL); MmUnlockAddressSpace(MmGetKernelAddressSpace()); } +#endif