Author: tfaber
Date: Sun Oct 12 20:45:32 2014
New Revision: 64702
URL: http://svn.reactos.org/svn/reactos?rev=64702&view=rev
Log:
[RTL]
- Allow the thread that called LdrShutdownProcess to forcefully acquire critical sections (the loader lock in particular).
This fixes the race condition where ExitProcess might terminate a thread holding the loader lock and subsequently call LdrShutdownProcess. That would then result in a deadlock because LdrShutdownProcess cannot acquire the loader lock.
This is a pretty ugly hack... but at least Windows does it the same way.
Fixes hangs after the summary line when running mshtml tests.
CORE-8624 #resolve
Modified:
trunk/reactos/lib/rtl/critical.c
Modified: trunk/reactos/lib/rtl/critical.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/critical.c?rev=647…
==============================================================================
--- trunk/reactos/lib/rtl/critical.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/critical.c [iso-8859-1] Sun Oct 12 20:45:32 2014
@@ -23,6 +23,9 @@
static BOOLEAN RtlpDebugInfoFreeList[MAX_STATIC_CS_DEBUG_OBJECTS];
LARGE_INTEGER RtlpTimeout;
+extern BOOLEAN LdrpShutdownInProgress;
+extern HANDLE LdrpShutdownThreadId;
+
/* FUNCTIONS *****************************************************************/
/*++
@@ -124,6 +127,18 @@
if (CriticalSection->DebugInfo)
CriticalSection->DebugInfo->EntryCount++;
+
+ /*
+ * If we're shutting down the process, we're allowed to acquire any
+ * critical sections by force (the loader lock in particular)
+ */
+ if (LdrpShutdownInProgress &&
+ LdrpShutdownThreadId == NtCurrentTeb()->RealClientId.UniqueThread)
+ {
+ DPRINT("Forcing ownership of critical section %p\n", CriticalSection);
+ CriticalSection->LockCount = 0;
+ return STATUS_SUCCESS;
+ }
for (;;)
{
Author: hbelusca
Date: Sun Oct 12 17:23:20 2014
New Revision: 64701
URL: http://svn.reactos.org/svn/reactos?rev=64701&view=rev
Log:
[NTVDM]
- Move the stack frame indices to where they belong (this is the stack layout when an interrupt is called).
- In the bootstrap interrupt, modify the CS:IP stored in the stack instead of the current CS:IP of the CPU, so that we can clean up everything and the interrupt return correctly, instead of breaking everything... (some apps wouldn't start with the original code^^). This is an addendum/fix to revision 64521.
Modified:
trunk/reactos/subsystems/ntvdm/bios/bios32/bios32.c
trunk/reactos/subsystems/ntvdm/cpu/callback.h
trunk/reactos/subsystems/ntvdm/int32.h
Modified: trunk/reactos/subsystems/ntvdm/bios/bios32/bios32.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/bios/bios…
==============================================================================
--- trunk/reactos/subsystems/ntvdm/bios/bios32/bios32.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/ntvdm/bios/bios32/bios32.c [iso-8859-1] Sun Oct 12 17:23:20 2014
@@ -295,9 +295,18 @@
/* Load DOS */
DosBootsectorInitialize();
- /* Position CPU to 0000:7C00 to boot the OS */
- setCS(0x0000);
- setIP(0x7C00);
+
+ /*
+ * Position CPU to 0000:7C00 to boot the OS.
+ *
+ * Since we are called via the INT32 mechanism, we need to correctly set
+ * CS:IP, not by changing the current one (otherwise the interrupt could
+ * not be clean up and return properly), but by changing the CS:IP in the
+ * stack, so that when the interrupt returns, the modified CS:IP is popped
+ * off the stack and the CPU is correctly repositioned.
+ */
+ Stack[STACK_CS] = 0x0000;
+ Stack[STACK_IP] = 0x7C00;
DPRINT1("<-- BiosBootstrapLoader\n");
}
Modified: trunk/reactos/subsystems/ntvdm/cpu/callback.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/cpu/callb…
==============================================================================
--- trunk/reactos/subsystems/ntvdm/cpu/callback.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/ntvdm/cpu/callback.h [iso-8859-1] Sun Oct 12 17:23:20 2014
@@ -29,16 +29,6 @@
USHORT NextOffset;
} CALLBACK16, *PCALLBACK16;
-//
-// WARNING WARNING!!
-// If you're changing the indices here, you then need to
-// also fix the BOP code in callback.c !!!!!!!!!!!!!!!!!
-//
-#define STACK_INT_NUM 0
-#define STACK_IP 1
-#define STACK_CS 2
-#define STACK_FLAGS 3
-
/* FUNCTIONS ******************************************************************/
VOID
Modified: trunk/reactos/subsystems/ntvdm/int32.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/int32.h?r…
==============================================================================
--- trunk/reactos/subsystems/ntvdm/int32.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/ntvdm/int32.h [iso-8859-1] Sun Oct 12 17:23:20 2014
@@ -18,6 +18,21 @@
/* 32-bit Interrupt Identifiers */
#define EMULATOR_MAX_INT32_NUM 0xFF + 1
+
+
+//
+// WARNING WARNING!!
+// If you're changing the stack indices here, you then need
+// to also fix the Int16To32 handler code in int32.c !!
+//
+
+// Custom variable pushed onto the stack for INT32 interrupts
+#define STACK_INT_NUM 0
+
+// This is the standard stack layout for an interrupt
+#define STACK_IP 1
+#define STACK_CS 2
+#define STACK_FLAGS 3
extern const ULONG Int16To32StubSize;
Author: ekohl
Date: Sun Oct 12 17:13:36 2014
New Revision: 64700
URL: http://svn.reactos.org/svn/reactos?rev=64700&view=rev
Log:
[SETUPAPI]
Store the module handles to loaded property page provider dlls in the DeviceInfoData (for class property pages) or in the DeviceInfo (for device property pages). The dlls are unloaded when the device info set is destroyed. These dlls were unloaded as soon as the property sheet data had been retrieved. These property pages could not be added to a property sheet because unloading the dll invalidated the page reources.
Modified:
trunk/reactos/dll/win32/setupapi/devclass.c
trunk/reactos/dll/win32/setupapi/devinst.c
trunk/reactos/dll/win32/setupapi/setupapi_private.h
Modified: trunk/reactos/dll/win32/setupapi/devclass.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/devclas…
==============================================================================
--- trunk/reactos/dll/win32/setupapi/devclass.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/setupapi/devclass.c [iso-8859-1] Sun Oct 12 17:13:36 2014
@@ -1269,6 +1269,19 @@
goto cleanup;
}
+ if (DeviceInfoData)
+ {
+ struct DeviceInfo *devInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
+ devInfo->hmodDevicePropPageProvider = hModule;
+ devInfo->pDevicePropPageProvider = pPropPageProvider;
+ }
+ else
+ {
+ struct DeviceInfoSet *devInfoSet = (struct DeviceInfoSet *)DeviceInfoSet;
+ devInfoSet->hmodClassPropPageProvider = hModule;
+ devInfoSet->pClassPropPageProvider = pPropPageProvider;
+ }
+
InitialNumberOfPages = PropertySheetHeader->nPages;
Request.cbSize = sizeof(SP_PROPSHEETPAGE_REQUEST);
@@ -1299,7 +1312,6 @@
if (hKey != INVALID_HANDLE_VALUE)
RegCloseKey(hKey);
HeapFree(GetProcessHeap(), 0, PropPageProvider);
- FreeFunctionPointer(hModule, pPropPageProvider);
}
TRACE("Returning %d\n", ret);
Modified: trunk/reactos/dll/win32/setupapi/devinst.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/devinst…
==============================================================================
--- trunk/reactos/dll/win32/setupapi/devinst.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/setupapi/devinst.c [iso-8859-1] Sun Oct 12 17:13:36 2014
@@ -602,6 +602,8 @@
return FALSE;
}
DestroyClassInstallParams(&deviceInfo->ClassInstallParams);
+ if (deviceInfo->hmodDevicePropPageProvider)
+ FreeLibrary(deviceInfo->hmodDevicePropPageProvider);
return HeapFree(GetProcessHeap(), 0, deviceInfo);
}
@@ -622,6 +624,8 @@
RegCloseKey(list->HKLM);
CM_Disconnect_Machine(list->hMachine);
DestroyClassInstallParams(&list->ClassInstallParams);
+ if (list->hmodClassPropPageProvider)
+ FreeLibrary(list->hmodClassPropPageProvider);
return HeapFree(GetProcessHeap(), 0, list);
}
Modified: trunk/reactos/dll/win32/setupapi/setupapi_private.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/setupap…
==============================================================================
--- trunk/reactos/dll/win32/setupapi/setupapi_private.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/setupapi/setupapi_private.h [iso-8859-1] Sun Oct 12 17:13:36 2014
@@ -172,6 +172,10 @@
/* Used by SetupDiGetClassInstallParamsW/SetupDiSetClassInstallParamsW */
struct ClassInstallParams ClassInstallParams;
+ /* Device property page provider data */
+ HMODULE hmodDevicePropPageProvider;
+ PVOID pDevicePropPageProvider;
+
/* Variable size array (contains data for instanceId, UniqueId, DeviceDescription) */
WCHAR Data[ANYSIZE_ARRAY];
};
@@ -199,6 +203,10 @@
/* Used by SetupDiGetClassInstallParamsW/SetupDiSetClassInstallParamsW */
struct ClassInstallParams ClassInstallParams;
+
+ /* Class property page provider data */
+ HMODULE hmodClassPropPageProvider;
+ PVOID pClassPropPageProvider;
/* Contains the name of the remote computer ('\\COMPUTERNAME' for example),
* or NULL if related to local machine. Points into szData field at the
Author: hbelusca
Date: Sun Oct 12 14:08:14 2014
New Revision: 64698
URL: http://svn.reactos.org/svn/reactos?rev=64698&view=rev
Log:
[FAST486]: speed up things a bit when we're reading prefixes, by really going to the next instruction (no jump to the end of the do{}while() loop, then restart).
Modified:
trunk/reactos/lib/fast486/fast486.c
Modified: trunk/reactos/lib/fast486/fast486.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fast486/fast486.c?rev=…
==============================================================================
--- trunk/reactos/lib/fast486/fast486.c [iso-8859-1] (original)
+++ trunk/reactos/lib/fast486/fast486.c [iso-8859-1] Sun Oct 12 14:08:14 2014
@@ -54,6 +54,7 @@
/* Main execution loop */
do
{
+NextInst:
/* Check if this is a new instruction */
if (State->PrefixFlags == 0) State->SavedInstPtr = State->InstPtr;
@@ -72,7 +73,7 @@
CurrentHandler(State, Opcode);
/* If this is a prefix, go to the next instruction immediately */
- if (CurrentHandler == Fast486OpcodePrefix) continue;
+ if (CurrentHandler == Fast486OpcodePrefix) goto NextInst;
/* A non-prefix opcode has been executed, reset the prefix flags */
State->PrefixFlags = 0;
@@ -104,8 +105,7 @@
State->IntStatus = FAST486_INT_EXECUTE;
}
}
- while ((CurrentHandler == Fast486OpcodePrefix) ||
- (Command == FAST486_CONTINUE) ||
+ while ((Command == FAST486_CONTINUE) ||
(Command == FAST486_STEP_OVER && ProcedureCallCount > 0) ||
(Command == FAST486_STEP_OUT && ProcedureCallCount >= 0));
}
Author: tkreuzer
Date: Sun Oct 12 14:05:49 2014
New Revision: 64697
URL: http://svn.reactos.org/svn/reactos?rev=64697&view=rev
Log:
[NTOSKRNL]
Make sure APCs are disabled when acquiring MmSectionCommitMutex.
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/section.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/section.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/section.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/section.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/section.c [iso-8859-1] Sun Oct 12 14:05:49 2014
@@ -1391,7 +1391,7 @@
TempPte = Segment->SegmentPteTemplate;
/* Acquire the commit lock and loop all prototype PTEs to be committed */
- KeAcquireGuardedMutexUnsafe(&MmSectionCommitMutex);
+ KeAcquireGuardedMutex(&MmSectionCommitMutex);
while (PointerPte < LastPte)
{
/* Make sure the PTE is already invalid */
@@ -1417,7 +1417,7 @@
ASSERT(Segment->NumberOfCommittedPages <= Segment->TotalNumberOfPtes);
/* Now that we're done, release the lock */
- KeReleaseGuardedMutexUnsafe(&MmSectionCommitMutex);
+ KeReleaseGuardedMutex(&MmSectionCommitMutex);
}
/* Is it SEC_BASED, or did the caller manually specify an address? */