Author: arty
Date: Sun Feb 19 14:13:51 2012
New Revision: 55713
URL: http://svn.reactos.org/svn/reactos?rev=55713&view=rev
Log:
[NEWCC]
Add necessary NULL check. Add pageout case for a page that's
only in segment page tables.
Modified:
branches/arty-newcc/ntoskrnl/mm/rmap.c
Modified: branches/arty-newcc/ntoskrnl/mm/rmap.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/mm/rmap.c?r…
==============================================================================
--- branches/arty-newcc/ntoskrnl/mm/rmap.c [iso-8859-1] (original)
+++ branches/arty-newcc/ntoskrnl/mm/rmap.c [iso-8859-1] Sun Feb 19 14:13:51 2012
@@ -58,7 +58,15 @@
ExAcquireFastMutex(&RmapListLock);
entry = MmGetRmapListHeadPage(Page);
- while (RMAP_IS_SEGMENT(entry->Address))
+
+#ifdef NEWCC
+ // Special case for NEWCC: we can have a page that's only in a segment
+ // page table
+ if (entry && RMAP_IS_SEGMENT(entry->Address) && entry->Next == NULL)
+ return MmpPageOutPhysicalAddress(Page);
+#endif
+
+ while (entry && RMAP_IS_SEGMENT(entry->Address))
entry = entry->Next;
if (entry == NULL)
Author: arty
Date: Sun Feb 19 13:15:33 2012
New Revision: 55712
URL: http://svn.reactos.org/svn/reactos?rev=55712&view=rev
Log:
[NEWCC]
Add a paging out case for cache sections, which had been lost at some point.
Recognize the case where the first rmap entry is a segment rmap in pageout.
Lock the segment when modifying the segment page table in 1 place.
Modified:
branches/arty-newcc/ntoskrnl/mm/rmap.c
branches/arty-newcc/ntoskrnl/mm/section.c
Modified: branches/arty-newcc/ntoskrnl/mm/rmap.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/mm/rmap.c?r…
==============================================================================
--- branches/arty-newcc/ntoskrnl/mm/rmap.c [iso-8859-1] (original)
+++ branches/arty-newcc/ntoskrnl/mm/rmap.c [iso-8859-1] Sun Feb 19 13:15:33 2012
@@ -58,11 +58,15 @@
ExAcquireFastMutex(&RmapListLock);
entry = MmGetRmapListHeadPage(Page);
+ while (RMAP_IS_SEGMENT(entry->Address))
+ entry = entry->Next;
+
if (entry == NULL)
{
ExReleaseFastMutex(&RmapListLock);
return(STATUS_UNSUCCESSFUL);
}
+
Process = entry->Process;
Address = entry->Address;
@@ -140,6 +144,10 @@
*/
Status = MmPageOutSectionView(AddressSpace, MemoryArea,
Address, PageOp);
+ }
+ else if (Type == MEMORY_AREA_CACHE)
+ {
+ Status = MmpPageOutPhysicalAddress(Page);
}
else if (Type == MEMORY_AREA_VIRTUAL_MEMORY)
{
Modified: branches/arty-newcc/ntoskrnl/mm/section.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/mm/section.…
==============================================================================
--- branches/arty-newcc/ntoskrnl/mm/section.c [iso-8859-1] (original)
+++ branches/arty-newcc/ntoskrnl/mm/section.c [iso-8859-1] Sun Feb 19 13:15:33 2012
@@ -2242,8 +2242,13 @@
MmInsertRmap(Page,
Process,
Address);
+ // If we got here, the previous entry should have been a wait
Entry = MAKE_SSE(Page << PAGE_SHIFT, 1);
+ MmLockSectionSegment(Context.Segment);
+ LONG OldEntry = MmGetPageEntrySectionSegment(Context.Segment, &Context.Offset);
+ ASSERT(OldEntry == 0 || OldEntry == MAKE_SWAP_SSE(MM_WAIT_ENTRY));
MmSetPageEntrySectionSegment(Context.Segment, &Context.Offset, Entry);
+ MmUnlockSectionSegment(Context.Segment);
}
MmUnlockAddressSpace(AddressSpace);
PageOp->Status = STATUS_UNSUCCESSFUL;
Author: ion
Date: Sun Feb 19 11:34:45 2012
New Revision: 55710
URL: http://svn.reactos.org/svn/reactos?rev=55710&view=rev
Log:
[CSRSRV]: It seems safe to now enable the #if0'ed out functionality of CsrCreateThread, as all thread/processes are tracked properly now.
Modified:
trunk/reactos/subsystems/win32/csrss/csrsrv/thredsup.c
Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/thredsup.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/csr…
==============================================================================
--- trunk/reactos/subsystems/win32/csrss/csrsrv/thredsup.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/csrss/csrsrv/thredsup.c [iso-8859-1] Sun Feb 19 11:34:45 2012
@@ -317,20 +317,17 @@
IN PCLIENT_ID ClientId)
{
PCSR_THREAD CsrThread;
- //PCSR_PROCESS CurrentProcess;
- //PCSR_THREAD CurrentThread = NtCurrentTeb()->CsrClientThread;
- //CLIENT_ID CurrentCid;
+ PCSR_PROCESS CurrentProcess;
+ PCSR_THREAD CurrentThread = NtCurrentTeb()->CsrClientThread;
+ CLIENT_ID CurrentCid;
KERNEL_USER_TIMES KernelTimes;
-// DPRINT1("CSRSRV: %s called\n", __FUNCTION__);
-
/* Get the current thread and CID */
- //CurrentCid = CurrentThread->ClientId;
-// DPRINT1("CALLER PID/TID: %lx/%lx\n", CurrentCid.UniqueProcess, CurrentCid.UniqueThread);
+ CurrentCid = CurrentThread->ClientId;
/* Acquire the Process Lock */
CsrAcquireProcessLock();
-#if 0
+
/* Get the current Process and make sure the Thread is valid with this CID */
CurrentThread = CsrLocateThreadByClientId(&CurrentProcess,
&CurrentCid);
@@ -342,7 +339,7 @@
CsrReleaseProcessLock();
return STATUS_THREAD_IS_TERMINATING;
}
-#endif
+
/* Get the Thread Create Time */
NtQueryInformationThread(hThread,
ThreadTimes,
Author: sginsberg
Date: Sun Feb 19 10:38:38 2012
New Revision: 55709
URL: http://svn.reactos.org/svn/reactos?rev=55709&view=rev
Log:
[NTOSKRNL]
- Fix KiEnterV86Mode's check for TRAP_DEBUG to #if instead of #ifdef, it is either defined to 1 or 0, like DBG.
Modified:
trunk/reactos/ntoskrnl/ke/i386/v86vdm.c
Modified: trunk/reactos/ntoskrnl/ke/i386/v86vdm.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/v86vdm.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/v86vdm.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/v86vdm.c [iso-8859-1] Sun Feb 19 10:38:38 2012
@@ -526,7 +526,9 @@
TrapFrame->HardwareEsp = 0x11FFE;
TrapFrame->ExceptionList = EXCEPTION_CHAIN_END;
TrapFrame->Dr7 = 0;
-#ifdef TRAP_DEBUG
+
+ /* Set some debug fields if trap debugging is enabled */
+#if TRAP_DEBUG
TrapFrame->DbgArgMark = 0xBADB0D00;
TrapFrame->PreviousPreviousMode = -1;
#endif
Author: ion
Date: Sun Feb 19 10:19:16 2012
New Revision: 55708
URL: http://svn.reactos.org/svn/reactos?rev=55708&view=rev
Log:
[CSRSRV]: Let's see if touching the CSR header file kills CSRSRV again. Re-enable the #if'0ed code that merely added a few fields to the create process structure. I think we no longer have weird fucked up dependencies on exact structure byte sizes. I hope.
Modified:
trunk/reactos/include/reactos/subsys/csrss/csrss.h
Modified: trunk/reactos/include/reactos/subsys/csrss/csrss.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/subsys/csr…
==============================================================================
--- trunk/reactos/include/reactos/subsys/csrss/csrss.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/subsys/csrss/csrss.h [iso-8859-1] Sun Feb 19 10:19:16 2012
@@ -51,7 +51,6 @@
typedef struct
{
-#if 0
//
// NT-type structure (BASE_CREATEPROCESS_MSG)
//
@@ -66,7 +65,7 @@
PVOID PebAddressNative;
ULONG PebAddressWow64;
USHORT ProcessorArchitecture;
-#endif
+
//
// ReactOS Data
//
Author: ion
Date: Sun Feb 19 10:12:14 2012
New Revision: 55707
URL: http://svn.reactos.org/svn/reactos?rev=55707&view=rev
Log:
[CSRSRV]: Properly implement CsrSrvCreateThread now that the worker thread issue is fixed. CSR_THREAD's are now created for everyone, and CSRSS succesfully duplicates their thread handle! Also, while connections from unknown threads are still allowed (in case I missed something), we do warn on the console about these guys now.
Modified:
trunk/reactos/subsystems/win32/csrss/csrsrv/api/process.c
trunk/reactos/subsystems/win32/csrss/csrsrv/api/wapi.c
Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/api/process.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/csr…
==============================================================================
--- trunk/reactos/subsystems/win32/csrss/csrsrv/api/process.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/csrss/csrsrv/api/process.c [iso-8859-1] Sun Feb 19 10:12:14 2012
@@ -172,50 +172,46 @@
NTSTATUS Status;
PCSR_PROCESS CsrProcess;
+ /* Get the current CSR thread */
CurrentThread = NtCurrentTeb()->CsrClientThread;
if (!CurrentThread) return STATUS_SUCCESS; // server-to-server
+
+ /* Get the CSR Process for this request */
CsrProcess = CurrentThread->Process;
-
- if (CsrProcess->ClientId.UniqueProcess != Request->Data.CreateThreadRequest.ClientId.UniqueProcess)
- {
+ if (CsrProcess->ClientId.UniqueProcess !=
+ Request->Data.CreateThreadRequest.ClientId.UniqueProcess)
+ {
+ /* This is a remote thread request -- is it within the server itself? */
if (Request->Data.CreateThreadRequest.ClientId.UniqueProcess == NtCurrentTeb()->ClientId.UniqueProcess)
{
+ /* Accept this without any further work */
return STATUS_SUCCESS;
}
+ /* Get the real CSR Process for the remote thread's process */
Status = CsrLockProcessByClientId(Request->Data.CreateThreadRequest.ClientId.UniqueProcess,
&CsrProcess);
if (!NT_SUCCESS(Status)) return Status;
}
-
- Status = NtDuplicateObject(CsrProcess->ProcessHandle,
+
+ /* Duplicate the thread handle so we can own it */
+ Status = NtDuplicateObject(CurrentThread->Process->ProcessHandle,
Request->Data.CreateThreadRequest.ThreadHandle,
NtCurrentProcess(),
&ThreadHandle,
0,
0,
DUPLICATE_SAME_ACCESS);
- if (!NT_SUCCESS(Status))
- {
- Status = NtDuplicateObject(CurrentThread->Process->ProcessHandle,
- Request->Data.CreateThreadRequest.ThreadHandle,
- NtCurrentProcess(),
- &ThreadHandle,
- 0,
- 0,
- DUPLICATE_SAME_ACCESS);
- }
-
- Status = STATUS_SUCCESS; // hack
if (NT_SUCCESS(Status))
{
+ /* Call CSRSRV to tell it about the new thread */
Status = CsrCreateThread(CsrProcess,
- ThreadHandle,
- &Request->Data.CreateThreadRequest.ClientId);
- }
-
- if (CsrProcess != CurrentThread->Process) CsrReleaseProcessLock();
-
+ ThreadHandle,
+ &Request->Data.CreateThreadRequest.ClientId);
+ }
+
+ /* Unlock the process and return */
+ if (CsrProcess != CurrentThread->Process) CsrUnlockProcess(CsrProcess);
return Status;
}
Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/api/wapi.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/csr…
==============================================================================
--- trunk/reactos/subsystems/win32/csrss/csrsrv/api/wapi.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/csrss/csrsrv/api/wapi.c [iso-8859-1] Sun Feb 19 10:12:14 2012
@@ -1183,7 +1183,7 @@
Thread = CsrLocateThreadByClientId(&Process, &Request->Header.ClientId);
if (!Thread)
{
- DPRINT("No thread found for request %lx and clientID %lx.%lx\n",
+ DPRINT1("No thread found for request %lx and clientID %lx.%lx\n",
Request->Type & 0xFFFF,
Request->Header.ClientId.UniqueProcess,
Request->Header.ClientId.UniqueThread);