- Don't depend on LD variables anymore for Mm.
authorAlex Ionescu <aionescu@gmail.com>
Fri, 2 Mar 2007 07:23:19 +0000 (07:23 +0000)
committerAlex Ionescu <aionescu@gmail.com>
Fri, 2 Mar 2007 07:23:19 +0000 (07:23 +0000)
- 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
reactos/ntoskrnl/ex/pushlock.c
reactos/ntoskrnl/include/internal/ex.h
reactos/ntoskrnl/io/iomgr/driver.c
reactos/ntoskrnl/mm/freelist.c
reactos/ntoskrnl/mm/mminit.c

index 3f59d2d..a97231b 100644 (file)
 //
 // 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.
 //
 ///////////////////////////////////////////////////////////////////////////////
 
index 18aa4bb..65def87 100644 (file)
 
 #include <ntoskrnl.h>
 #define NDEBUG
-#include <internal/debug.h>
+#include <debug.h>
 
 /* 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 (;;)
index 22c227a..622df3c 100644 (file)
@@ -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
index d98c385..838e292 100644 (file)
@@ -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,
index 920f015..cf1cd76 100644 (file)
@@ -1153,7 +1153,7 @@ MmZeroPageThreadMain(PVOID Ignored)
    ULONG Count;
 
    /* Free initial kernel memory */
-   MiFreeInitMemory();
+   //MiFreeInitMemory();
 
    /* Set our priority to 0 */
    KeGetCurrentThread()->BasePriority = 0;
index e478f84..4b2eaac 100644 (file)
@@ -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