mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[NTOSKRNL] Unload the cargo: We only use tiny bits of "NEWCC"
This commit is contained in:
parent
25722e647e
commit
462d9a0974
11 changed files with 82 additions and 16 deletions
13
ntoskrnl/cache/section/data.c
vendored
13
ntoskrnl/cache/section/data.c
vendored
|
@ -112,6 +112,7 @@ _MmUnlockSectionSegment(PMM_SECTION_SEGMENT Segment, const char *file, int line)
|
|||
//DPRINT("MmUnlockSectionSegment(%p,%s:%d)\n", Segment, file, line);
|
||||
}
|
||||
|
||||
#ifdef NEWCC
|
||||
/*
|
||||
|
||||
MiFlushMappedSection
|
||||
|
@ -265,7 +266,6 @@ This deletes a segment entirely including its page map.
|
|||
It must have been unmapped in every address space.
|
||||
|
||||
*/
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
MmFinalizeSegment(PMM_SECTION_SEGMENT Segment)
|
||||
|
@ -274,6 +274,8 @@ MmFinalizeSegment(PMM_SECTION_SEGMENT Segment)
|
|||
|
||||
DPRINT("Finalize segment %p\n", Segment);
|
||||
|
||||
__debugbreak();
|
||||
|
||||
MmLockSectionSegment(Segment);
|
||||
RemoveEntryList(&Segment->ListOfSegments);
|
||||
if (Segment->Flags & MM_DATAFILE_SEGMENT) {
|
||||
|
@ -303,7 +305,6 @@ MmFinalizeSegment(PMM_SECTION_SEGMENT Segment)
|
|||
ExFreePoolWithTag(Segment, TAG_MM_SECTION_SEGMENT);
|
||||
}
|
||||
|
||||
#ifdef NEWCC
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
MmCreateCacheSection(PROS_SECTION_OBJECT *SectionObject,
|
||||
|
@ -534,7 +535,6 @@ MmCreateCacheSection(PROS_SECTION_OBJECT *SectionObject,
|
|||
*SectionObject = Section;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
|
@ -605,6 +605,7 @@ _MiMapViewOfSegment(PMMSUPPORT AddressSpace,
|
|||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
|
@ -621,6 +622,8 @@ MiFreeSegmentPage(PMM_SECTION_SEGMENT Segment,
|
|||
ULONG_PTR Entry;
|
||||
PFILE_OBJECT FileObject = Segment->FileObject;
|
||||
|
||||
__debugbreak();
|
||||
|
||||
Entry = MmGetPageEntrySectionSegment(Segment, FileOffset);
|
||||
DPRINTC("MiFreeSegmentPage(%p:%I64x -> Entry %Ix\n",
|
||||
Segment,
|
||||
|
@ -710,6 +713,7 @@ MmFreeCacheSectionPage(PVOID Context,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef NEWCC
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
MmUnmapViewOfCacheSegment(PMMSUPPORT AddressSpace,
|
||||
|
@ -755,7 +759,6 @@ MmUnmapViewOfCacheSegment(PMMSUPPORT AddressSpace,
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef NEWCC
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
MmExtendCacheSection(PROS_SECTION_OBJECT Section,
|
||||
|
@ -793,7 +796,6 @@ MmExtendCacheSection(PROS_SECTION_OBJECT Section,
|
|||
MmUnlockSectionSegment(Segment);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
|
@ -844,5 +846,6 @@ MmUnmapCacheViewInSystemSpace (IN PVOID MappedBase)
|
|||
|
||||
return Status;
|
||||
}
|
||||
#endif /* NEWCC */
|
||||
|
||||
/* EOF */
|
||||
|
|
6
ntoskrnl/cache/section/fault.c
vendored
6
ntoskrnl/cache/section/fault.c
vendored
|
@ -82,6 +82,8 @@ rmaps, so each mapping should be immediately followed by an rmap addition.
|
|||
#define DPRINTC DPRINT
|
||||
|
||||
extern KEVENT MmWaitPageEvent;
|
||||
|
||||
#ifdef NEWCC
|
||||
extern PMMWSL MmWorkingSetList;
|
||||
|
||||
/*
|
||||
|
@ -150,6 +152,7 @@ MmNotPresentFaultCachePage (
|
|||
|
||||
if (Segment->FileObject)
|
||||
{
|
||||
__debugbreak();
|
||||
DPRINT("FileName %wZ\n", &Segment->FileObject->FileName);
|
||||
}
|
||||
|
||||
|
@ -453,9 +456,11 @@ MiCowCacheSectionPage (
|
|||
DPRINT("Address 0x%p\n", Address);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
KEVENT MmWaitPageEvent;
|
||||
|
||||
#ifdef NEWCC
|
||||
typedef struct _WORK_QUEUE_WITH_CONTEXT
|
||||
{
|
||||
WORK_QUEUE_ITEM WorkItem;
|
||||
|
@ -960,3 +965,4 @@ MmNotPresentFaultCacheSection(KPROCESSOR_MODE Mode,
|
|||
|
||||
return Status;
|
||||
}
|
||||
#endif
|
||||
|
|
2
ntoskrnl/cache/section/io.c
vendored
2
ntoskrnl/cache/section/io.c
vendored
|
@ -188,6 +188,7 @@ MiSimpleRead(PFILE_OBJECT FileObject,
|
|||
return Status;
|
||||
}
|
||||
|
||||
#ifdef NEWCC
|
||||
/*
|
||||
|
||||
Convenience function for writing from kernel space. This issues a paging
|
||||
|
@ -334,3 +335,4 @@ _MiWriteBackPage(PFILE_OBJECT FileObject,
|
|||
|
||||
return Status;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -69,7 +69,9 @@ typedef ULONG_PTR SWAPENTRY;
|
|||
#endif
|
||||
|
||||
#define MEMORY_AREA_SECTION_VIEW (1)
|
||||
#ifdef NEWCC
|
||||
#define MEMORY_AREA_CACHE (2)
|
||||
#endif
|
||||
#define MEMORY_AREA_OWNED_BY_ARM3 (15)
|
||||
#define MEMORY_AREA_STATIC (0x80000000)
|
||||
|
||||
|
|
|
@ -1666,9 +1666,14 @@ MiGetFileObjectForSectionAddress(
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef NEWCC
|
||||
ASSERT(MemoryArea->Type == MEMORY_AREA_CACHE);
|
||||
DPRINT1("Address is a cache section!\n");
|
||||
return STATUS_SECTION_NOT_IMAGE;
|
||||
#else
|
||||
ASSERT(FALSE);
|
||||
return STATUS_SECTION_NOT_IMAGE;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1739,8 +1744,12 @@ MiGetFileObjectForVad(
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef NEWCC
|
||||
ASSERT(MemoryArea->Type == MEMORY_AREA_CACHE);
|
||||
DPRINT1("VAD is a cache section!\n");
|
||||
#else
|
||||
ASSERT(FALSE);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,7 +178,11 @@ MmInsertMemoryArea(
|
|||
ASSERT(Process != NULL);
|
||||
if (marea->Type != MEMORY_AREA_OWNED_BY_ARM3)
|
||||
{
|
||||
#ifdef NEWCC
|
||||
ASSERT(marea->Type == MEMORY_AREA_SECTION_VIEW || marea->Type == MEMORY_AREA_CACHE);
|
||||
#else
|
||||
ASSERT(marea->Type == MEMORY_AREA_SECTION_VIEW);
|
||||
#endif
|
||||
|
||||
/* Insert the VAD */
|
||||
MiLockProcessWorkingSetUnsafe(PsGetCurrentProcess(), PsGetCurrentThread());
|
||||
|
@ -353,7 +357,11 @@ MmFreeMemoryArea(
|
|||
if (MemoryArea->Vad)
|
||||
{
|
||||
ASSERT(MemoryArea->VadNode.EndingVpn + 1 < (ULONG_PTR)MmSystemRangeStart >> PAGE_SHIFT);
|
||||
#ifdef NEWCC
|
||||
ASSERT(MemoryArea->Type == MEMORY_AREA_SECTION_VIEW || MemoryArea->Type == MEMORY_AREA_CACHE);
|
||||
#else
|
||||
ASSERT(MemoryArea->Type == MEMORY_AREA_SECTION_VIEW);
|
||||
#endif
|
||||
|
||||
/* MmCleanProcessAddressSpace might have removed it (and this would be MmDeleteProcessAdressSpace) */
|
||||
ASSERT(MemoryArea->VadNode.u.VadFlags.Spare != 0);
|
||||
|
@ -545,10 +553,12 @@ MiRosCleanupMemoryArea(
|
|||
{
|
||||
Status = MiRosUnmapViewOfSection(Process, BaseAddress, Process->ProcessExiting);
|
||||
}
|
||||
#ifdef NEWCC
|
||||
else if (MemoryArea->Type == MEMORY_AREA_CACHE)
|
||||
{
|
||||
Status = MmUnmapViewOfCacheSegment(&Process->Vm, BaseAddress);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
/* There shouldn't be anything else! */
|
||||
|
|
|
@ -79,7 +79,7 @@ MmpAccessFault(KPROCESSOR_MODE Mode,
|
|||
MemoryArea,
|
||||
(PVOID)Address);
|
||||
break;
|
||||
|
||||
#ifdef NEWCC
|
||||
case MEMORY_AREA_CACHE:
|
||||
// This code locks for itself to keep from having to break a lock
|
||||
// passed in.
|
||||
|
@ -89,7 +89,7 @@ MmpAccessFault(KPROCESSOR_MODE Mode,
|
|||
if (!FromMdl)
|
||||
MmLockAddressSpace(AddressSpace);
|
||||
break;
|
||||
|
||||
#endif
|
||||
default:
|
||||
Status = STATUS_ACCESS_VIOLATION;
|
||||
break;
|
||||
|
@ -171,7 +171,7 @@ MmNotPresentFault(KPROCESSOR_MODE Mode,
|
|||
(PVOID)Address,
|
||||
FromMdl);
|
||||
break;
|
||||
|
||||
#ifdef NEWCC
|
||||
case MEMORY_AREA_CACHE:
|
||||
// This code locks for itself to keep from having to break a lock
|
||||
// passed in.
|
||||
|
@ -181,7 +181,7 @@ MmNotPresentFault(KPROCESSOR_MODE Mode,
|
|||
if (!FromMdl)
|
||||
MmLockAddressSpace(AddressSpace);
|
||||
break;
|
||||
|
||||
#endif
|
||||
default:
|
||||
Status = STATUS_ACCESS_VIOLATION;
|
||||
break;
|
||||
|
|
|
@ -214,12 +214,17 @@ MmInitSystem(IN ULONG Phase,
|
|||
/* Initialize the kernel address space */
|
||||
ASSERT(Phase == 1);
|
||||
|
||||
#ifdef NEWCC
|
||||
InitializeListHead(&MiSegmentList);
|
||||
ExInitializeFastMutex(&MiGlobalPageOperation);
|
||||
KeInitializeEvent(&MmWaitPageEvent, SynchronizationEvent, FALSE);
|
||||
// Until we're fully demand paged, we can do things the old way through
|
||||
// the balance manager
|
||||
// CcInitView will override this...
|
||||
MmInitializeMemoryConsumer(MC_CACHE, MiRosTrimCache);
|
||||
#else
|
||||
KeInitializeEvent(&MmWaitPageEvent, SynchronizationEvent, FALSE);
|
||||
#endif
|
||||
|
||||
MmKernelAddressSpace = &PsIdleProcess->Vm;
|
||||
|
||||
|
|
|
@ -167,12 +167,14 @@ MmPageOutPhysicalAddress(PFN_NUMBER Page)
|
|||
*/
|
||||
Status = MmPageOutSectionView(AddressSpace, MemoryArea, Address, Entry);
|
||||
}
|
||||
#ifdef NEWCC
|
||||
else if (Type == MEMORY_AREA_CACHE)
|
||||
{
|
||||
/* NEWCC does locking itself */
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
Status = MmpPageOutPhysicalAddress(Page);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
KeBugCheck(MEMORY_MANAGEMENT);
|
||||
|
|
|
@ -60,6 +60,29 @@
|
|||
|
||||
extern MMSESSION MmSession;
|
||||
|
||||
#ifndef NEWCC
|
||||
KEVENT MmWaitPageEvent;
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
_MmLockSectionSegment(PMM_SECTION_SEGMENT Segment, const char *file, int line)
|
||||
{
|
||||
//DPRINT("MmLockSectionSegment(%p,%s:%d)\n", Segment, file, line);
|
||||
ExAcquireFastMutex(&Segment->Lock);
|
||||
Segment->Locked = TRUE;
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
_MmUnlockSectionSegment(PMM_SECTION_SEGMENT Segment, const char *file, int line)
|
||||
{
|
||||
ASSERT(Segment->Locked);
|
||||
Segment->Locked = FALSE;
|
||||
ExReleaseFastMutex(&Segment->Lock);
|
||||
//DPRINT("MmUnlockSectionSegment(%p,%s:%d)\n", Segment, file, line);
|
||||
}
|
||||
#endif
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
MiMapViewInSystemSpace(IN PVOID Section,
|
||||
|
@ -4067,9 +4090,13 @@ MiRosUnmapViewOfSection(IN PEPROCESS Process,
|
|||
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace,
|
||||
BaseAddress);
|
||||
if (MemoryArea == NULL ||
|
||||
((MemoryArea->Type != MEMORY_AREA_SECTION_VIEW) &&
|
||||
(MemoryArea->Type != MEMORY_AREA_CACHE)) ||
|
||||
#ifdef NEWCC
|
||||
((MemoryArea->Type != MEMORY_AREA_SECTION_VIEW) && (MemoryArea->Type != MEMORY_AREA_CACHE)) ||
|
||||
#else
|
||||
(MemoryArea->Type != MEMORY_AREA_SECTION_VIEW) ||
|
||||
#endif
|
||||
MemoryArea->DeleteInProgress)
|
||||
|
||||
{
|
||||
if (MemoryArea) ASSERT(MemoryArea->Type != MEMORY_AREA_OWNED_BY_ARM3);
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
|
|
|
@ -28,7 +28,11 @@ if(NEWCC)
|
|||
${REACTOS_SOURCE_DIR}/ntoskrnl/cache/lazyrite.c
|
||||
${REACTOS_SOURCE_DIR}/ntoskrnl/cache/logsup.c
|
||||
${REACTOS_SOURCE_DIR}/ntoskrnl/cache/mdlsup.c
|
||||
${REACTOS_SOURCE_DIR}/ntoskrnl/cache/pinsup.c)
|
||||
${REACTOS_SOURCE_DIR}/ntoskrnl/cache/pinsup.c
|
||||
${REACTOS_SOURCE_DIR}/ntoskrnl/cache/section/fault.c
|
||||
${REACTOS_SOURCE_DIR}/ntoskrnl/cache/section/swapout.c
|
||||
${REACTOS_SOURCE_DIR}/ntoskrnl/cache/section/data.c
|
||||
${REACTOS_SOURCE_DIR}/ntoskrnl/cache/section/reqtools.c)
|
||||
else()
|
||||
list(APPEND SOURCE
|
||||
${REACTOS_SOURCE_DIR}/ntoskrnl/cc/cacheman.c
|
||||
|
@ -42,11 +46,7 @@ endif()
|
|||
|
||||
list(APPEND SOURCE
|
||||
${REACTOS_SOURCE_DIR}/ntoskrnl/cache/section/io.c
|
||||
${REACTOS_SOURCE_DIR}/ntoskrnl/cache/section/data.c
|
||||
${REACTOS_SOURCE_DIR}/ntoskrnl/cache/section/fault.c
|
||||
${REACTOS_SOURCE_DIR}/ntoskrnl/cache/section/reqtools.c
|
||||
${REACTOS_SOURCE_DIR}/ntoskrnl/cache/section/sptab.c
|
||||
${REACTOS_SOURCE_DIR}/ntoskrnl/cache/section/swapout.c
|
||||
${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmalloc.c
|
||||
${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmapi.c
|
||||
${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmboot.c
|
||||
|
|
Loading…
Reference in a new issue