mirror of
https://github.com/reactos/reactos.git
synced 2024-12-31 19:42:51 +00:00
- 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
This commit is contained in:
parent
ba689f332a
commit
5ba38d0494
6 changed files with 36 additions and 16 deletions
|
@ -13,7 +13,10 @@
|
||||||
//
|
//
|
||||||
// Global:
|
// Global:
|
||||||
// - TODO: Complete the list of bufxies
|
// - 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.
|
||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,13 @@
|
||||||
|
|
||||||
#include <ntoskrnl.h>
|
#include <ntoskrnl.h>
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <internal/debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
/* DATA **********************************************************************/
|
/* DATA **********************************************************************/
|
||||||
|
|
||||||
ULONG ExPushLockSpinCount;
|
ULONG ExPushLockSpinCount;
|
||||||
|
#undef EX_PUSH_LOCK
|
||||||
|
#undef PEX_PUSH_LOCK
|
||||||
|
|
||||||
/* PRIVATE FUNCTIONS *********************************************************/
|
/* PRIVATE FUNCTIONS *********************************************************/
|
||||||
|
|
||||||
|
@ -439,10 +441,10 @@ VOID
|
||||||
FASTCALL
|
FASTCALL
|
||||||
ExfAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
|
ExfAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
|
||||||
{
|
{
|
||||||
DEFINE_WAIT_BLOCK(WaitBlock);
|
|
||||||
EX_PUSH_LOCK OldValue = *PushLock, NewValue, TempValue;
|
EX_PUSH_LOCK OldValue = *PushLock, NewValue, TempValue;
|
||||||
BOOLEAN NeedWake;
|
BOOLEAN NeedWake;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
DEFINE_WAIT_BLOCK(WaitBlock);
|
||||||
|
|
||||||
/* Start main loop */
|
/* Start main loop */
|
||||||
for (;;)
|
for (;;)
|
||||||
|
@ -605,10 +607,10 @@ VOID
|
||||||
FASTCALL
|
FASTCALL
|
||||||
ExfAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
|
ExfAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
|
||||||
{
|
{
|
||||||
DEFINE_WAIT_BLOCK(WaitBlock);
|
|
||||||
EX_PUSH_LOCK OldValue = *PushLock, NewValue;
|
EX_PUSH_LOCK OldValue = *PushLock, NewValue;
|
||||||
BOOLEAN NeedWake;
|
BOOLEAN NeedWake;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
DEFINE_WAIT_BLOCK(WaitBlock);
|
||||||
|
|
||||||
/* Start main loop */
|
/* Start main loop */
|
||||||
for (;;)
|
for (;;)
|
||||||
|
|
|
@ -92,7 +92,7 @@ typedef struct
|
||||||
//
|
//
|
||||||
#define LOW_LEVEL_ENTRIES (PAGE_SIZE / sizeof(HANDLE_TABLE_ENTRY))
|
#define LOW_LEVEL_ENTRIES (PAGE_SIZE / sizeof(HANDLE_TABLE_ENTRY))
|
||||||
#define MID_LEVEL_ENTRIES (PAGE_SIZE / sizeof(PHANDLE_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
|
// Maximum index in each table level before we need another table
|
||||||
|
|
|
@ -1153,7 +1153,7 @@ MmZeroPageThreadMain(PVOID Ignored)
|
||||||
ULONG Count;
|
ULONG Count;
|
||||||
|
|
||||||
/* Free initial kernel memory */
|
/* Free initial kernel memory */
|
||||||
MiFreeInitMemory();
|
//MiFreeInitMemory();
|
||||||
|
|
||||||
/* Set our priority to 0 */
|
/* Set our priority to 0 */
|
||||||
KeGetCurrentThread()->BasePriority = 0;
|
KeGetCurrentThread()->BasePriority = 0;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
/*
|
/*
|
||||||
* Compiler defined symbols
|
* Compiler defined symbols
|
||||||
*/
|
*/
|
||||||
|
#if 0
|
||||||
extern unsigned int _image_base__;
|
extern unsigned int _image_base__;
|
||||||
extern unsigned int _text_start__;
|
extern unsigned int _text_start__;
|
||||||
extern unsigned int _text_end__;
|
extern unsigned int _text_end__;
|
||||||
|
@ -27,7 +28,7 @@ extern unsigned int _init_start__;
|
||||||
extern unsigned int _init_end__;
|
extern unsigned int _init_end__;
|
||||||
|
|
||||||
extern unsigned int _bss_end__;
|
extern unsigned int _bss_end__;
|
||||||
|
#endif
|
||||||
|
|
||||||
static BOOLEAN IsThisAnNtAsSystem = FALSE;
|
static BOOLEAN IsThisAnNtAsSystem = FALSE;
|
||||||
MM_SYSTEMSIZE MmSystemSize = MmSmallSystem;
|
MM_SYSTEMSIZE MmSystemSize = MmSmallSystem;
|
||||||
|
@ -39,13 +40,6 @@ ULONG MiNonPagedPoolLength;
|
||||||
|
|
||||||
VOID INIT_FUNCTION NTAPI MmInitVirtualMemory(ULONG_PTR LastKernelAddress, ULONG KernelLength);
|
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 ****************************************************************/
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -83,7 +77,7 @@ MmInitVirtualMemory(ULONG_PTR LastKernelAddress,
|
||||||
{
|
{
|
||||||
PVOID BaseAddress;
|
PVOID BaseAddress;
|
||||||
ULONG Length;
|
ULONG Length;
|
||||||
ULONG ParamLength = KernelLength;
|
//ULONG ParamLength = KernelLength;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
||||||
PFN_TYPE Pfn;
|
PFN_TYPE Pfn;
|
||||||
|
@ -159,7 +153,24 @@ MmInitVirtualMemory(ULONG_PTR LastKernelAddress,
|
||||||
0,
|
0,
|
||||||
BoundaryAddressMultiple);
|
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__;
|
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__;
|
Length = PAGE_ROUND_UP(((ULONG_PTR)&_text_end__)) - (ULONG_PTR)&_image_base__;
|
||||||
ParamLength = ParamLength - Length;
|
ParamLength = ParamLength - Length;
|
||||||
|
|
||||||
|
@ -225,6 +236,7 @@ MmInitVirtualMemory(ULONG_PTR LastKernelAddress,
|
||||||
TRUE,
|
TRUE,
|
||||||
0,
|
0,
|
||||||
BoundaryAddressMultiple);
|
BoundaryAddressMultiple);
|
||||||
|
#endif
|
||||||
|
|
||||||
BaseAddress = MiNonPagedPoolStart;
|
BaseAddress = MiNonPagedPoolStart;
|
||||||
MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||||
|
@ -515,6 +527,8 @@ MmInitSystem(IN ULONG Phase,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
VOID static
|
VOID static
|
||||||
MiFreeInitMemoryPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
|
MiFreeInitMemoryPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
|
||||||
PFN_TYPE Page, SWAPENTRY SwapEntry,
|
PFN_TYPE Page, SWAPENTRY SwapEntry,
|
||||||
|
@ -538,3 +552,4 @@ MiFreeInitMemory(VOID)
|
||||||
NULL);
|
NULL);
|
||||||
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue