- New ERESOURCE implementation: fixes the return value of some functions (VOID vs NTSTATUS, USHORT vs ULONG), as well as optimized the code loops and general structure of the code. Additionnaly, functions do not simply call other functions with similar names; the exact implementation of each function has now been properly separated (see the DDK for more information on this) to have the most optimized scenarios.

- Also, the spinlock is not actually acquired on non-SMP builds; instead, interrupts are blocked and unblocked for acquire/release, this optimizes locking.
- Added many asserts and bugcheck scenarios.
- Added thread priority boosting.
- Added some debugging helpers and deadlock detection.
- Added RESOURCE_NOT_OWNED bugcehck message.
* Thanks again to Waxdragon (Andrew) for testing this build.

svn path=/trunk/; revision=20580
This commit is contained in:
Alex Ionescu 2006-01-05 16:24:32 +00:00
parent 444bb36f82
commit 300da88aff
7 changed files with 2301 additions and 910 deletions

View file

@ -117,6 +117,11 @@ extern ULONG NTSYSAPI NtBuildNumber;
#define EX_PUSH_LOCK_FLAGS_EXCLUSIVE 1
#define EX_PUSH_LOCK_FLAGS_WAIT 2
//
// Resource (ERESOURCE) Flags
//
#define ResourceHasDisabledPriorityBoost 0x08
//
// Shutdown types for NtShutdownSystem
//

View file

@ -489,7 +489,7 @@ ExpLoadInitialProcess(PHANDLE ProcessHandle,
DPRINT("Process created successfully\n");
return STATUS_SUCCESS;
}
VOID
INIT_FUNCTION
STDCALL
@ -543,6 +543,9 @@ ExpInitializeExecutive(VOID)
InitializeListHead(&KiProfileSourceListHead);
KeInitializeSpinLock(&KiProfileLock);
/* Initialize resources */
ExpResourceInitialization();
/* Load basic Security for other Managers */
if (!SeInit1()) KEBUGCHECK(SECURITY_INITIALIZATION_FAILED);

File diff suppressed because it is too large Load diff

View file

@ -15,6 +15,17 @@ extern POBJECT_TYPE ExEventPairObjectType;
~(EX_HANDLE_ENTRY_PROTECTFROMCLOSE | EX_HANDLE_ENTRY_INHERITABLE | \
EX_HANDLE_ENTRY_AUDITONCLOSE)))
/* Note: we only use a spinlock on SMP. On UP, we cli/sti intead */
#ifndef CONFIG_SMP
#define ExAcquireResourceLock(l, i) \
UNREFERENCED_PARAMETER(*i); \
Ke386DisableInterrupts();
#define ExReleaseResourceLock(l, i) Ke386EnableInterrupts();
#else
#define ExAcquireResourceLock(l, i) KeAcquireSpinLock(l, i);
#define ExReleaseResourceLock(l, i) KeReleaseSpinLock(l, i);
#endif
/* INITIALIZATION FUNCTIONS *************************************************/
VOID
@ -77,6 +88,10 @@ VOID
STDCALL
ExpInitializeProfileImplementation(VOID);
VOID
NTAPI
ExpResourceInitialization(VOID);
/* Rundown Functions ********************************************************/
VOID

View file

@ -10,9 +10,9 @@
#define CALLBACK_TAG TAG('C','L','B','K')
/* formerly located in ex/resource.c */
#define TAG_OWNER_TABLE TAG('R', 'O', 'W', 'N')
#define TAG_EXCLUSIVE_LOCK TAG('E', 'R', 'E', 'L')
#define TAG_SHARED_SEM TAG('E', 'R', 'S', 'S')
#define TAG_RESOURCE_TABLE TAG('R', 'e', 'T', 'a')
#define TAG_RESOURCE_EVENT TAG('R', 'e', 'T', 'a')
#define TAG_RESOURCE_SEMAPHORE TAG('R', 'e', 'T', 'a')
/* formerly located in fs/notify.c */
#define FSRTL_NOTIFY_TAG TAG('N','O','T','I')

View file

@ -1003,14 +1003,6 @@ Language=English
WORKER_THREAD_RETURNED_AT_BAD_IRQL
.
MessageId=0xE4
Severity=Success
Facility=System
SymbolicName=WORKER_INVALID
Language=English
WORKER_INVALID
.
MessageId=0xE2
Severity=Success
Facility=System
@ -1019,6 +1011,22 @@ Language=English
MANUALLY_INITIATED_CRASH
.
MessageId=0xE3
Severity=Success
Facility=System
SymbolicName=RESOURCE_NOT_OWNED
Language=English
RESOURCE_NOT_OWNED
.
MessageId=0xE4
Severity=Success
Facility=System
SymbolicName=WORKER_INVALID
Language=English
WORKER_INVALID
.
MessageId=0xFA
Severity=Success
Facility=System
@ -1085,4 +1093,4 @@ Language=English
ATTEMPTED_EXECUTE_OF_NOEXECUTE_MEMORY
.
; EOF
; EOF

View file

@ -6601,7 +6601,7 @@ ExIsResourceAcquiredLite(
IN PERESOURCE Resource);
NTOSAPI
USHORT
ULONG
DDKAPI
ExIsResourceAcquiredSharedLite(
IN PERESOURCE Resource);
@ -6648,7 +6648,7 @@ ExRegisterCallback(
IN PVOID CallbackContext);
NTOSAPI
VOID
NTSTATUS
DDKAPI
ExReinitializeResourceLite(
IN PERESOURCE Resource);