- Implement KiTryThreadLock which tries to acquire the lock but exits if it can't, isntead of looping.
- Re-factor KeWaitForGate to make it SMP-safe by acquiring various locks when required.
- Fixed up KeSignalGateBoostPriority so it can also be SMP-safe, and also fix what exactly happens when the gate is signaled (directly make the other thread ready instead of doing a KiUnwaitThread on it).
- Split KxAcquireSpinLock/KxReleaseSpinLock into SMP vs UP like the other routines.
svn path=/trunk/; revision=24103
- Don't play with priorities in KiAbortWaitThread anymore, since we'll soon support Win2003 delayed "adjust increment" functionality, so that the code is not repeated many times.
- Rename KiAbortWaitThread to KiUnwaitThread, make it use KiUnlinkThread and delayed adjustment.
- Implement KxUnwaitThread and KxUnwaitThreadForEvent, optimized versions of KiWaitTest that can be used in special circumstances (notification events, thread termination, process signalling).
- Optimize KeSetEvent by handling signaled notification events without acquiring the dispatcher lock, and by using new inlined routines described above.
- Reimplement KeSetEventBoostPriority properly to actually do boosting.
- Fixup KeRundownQueue with a more typical/proper LIST_ENTRY loop.
- Let me know if you see regressions...
svn path=/trunk/; revision=24102
- Rename exception.c to except.c, mostly due to MSVC's incompatibility with multiple identically named files.
- SVN delete usercall.c leftover.
- Fix KeSetPriorityAndQuantumProcess to use Queued Spinlocks and KiAcquireProcess/ThreadLock when needed.
svn path=/trunk/; revision=24094
- Undefine all functions for UP builds, except KeIpiGenericCall.
- Implement KeIpiGenericCall for UP builds and add @implemented tag.
svn path=/trunk/; revision=24093
- Also fixed the above for incorrect formatting/excessive whitespace.
- The other routines in device.c were moved to cpu.c, since they deal with CPU-specific things.
- Cleaned up KeFlushEntireTb.
- Added inlined routines for setting/getting CR, and also getting GDTR, IDTR, LDTR, TR. Used to implement KiSaveProcessorControlState.
- Implemented KeSaveStateForHibernate.
svn path=/trunk/; revision=24092
- Remove code in userapc.c and move it into usercall.c, since both functions basically deal with user-mode callouts.
- Handle STATUS_CALLBACK_POP_STACK and add the status to ntstatus.h
- Also handle future support for GDI Batch flushing.
svn path=/trunk/; revision=24089
1. Removed the stricmp guard
2. Added a #ifdef->#undef solution
If this break compilation on linux or on gcc 4 on win32 (very low probability, if any), let's think further.
svn path=/trunk/; revision=24076
- Fix KiIdleLoop to actuall load the PCR in EBX. It was using a completely random value.
- Call the Processor Idle Routine now, isntead of hard-coding STI+HLT. This routine had already been setup during bootup by PoInitailizePrcb.
- Implemented PopIdle0 and made it call HalProcessorIdle. No performance/throttling is done yet.
svn path=/trunk/; revision=24063
- Implement CPU Idle Loop in assembly for UP and SMP systems. Differences:
* Runs with interrupts off most of the time, except when it does interrupt cycling at each iteration.
* Calls KiRetireDpcList directly, instead of going through KiDispatchInterrupt.
* Support for new scheduler and immediate thread switch.
* Support for Idle Scheduler.
* Support for HAL/ACPI/CPU Driver-defined "Idle Function". currently disabled and STI+HLT harcoded instead.
- Removed ps/idle.c and dumped the hack code directly in psmgr.c wher eit's used.
svn path=/trunk/; revision=24062
- Add KiExitDispatcher from my new scheduler code. Same as KiQuantumEnd, added an assertion to make sure it doesn't enter in code paths that shouldn't yet happen.
svn path=/trunk/; revision=24061
- Fix a bug in KiSetPriorityThread which wasn't setting *released = FALSE, which left the var uninitailized and usually = TRUE on the stack.
- Half-copy KiQuantumEnd from my new scheduler code. Main difference is usage of newly created locks, support for quantum-disable and RT threads, and usage of KiComputeNewPriority.
svn path=/trunk/; revision=24060
- Fixup comment header for KiDeliverApc and KiInsertQueueApc.
- Set APC trap frame during APC delivery. We actually weren't doing this before (I'm kind of amazed at ROS's previous functionality due to importance of this bug!).
- Use proper in-stack queued spinlock mechanisms.
- Make sure that the Kernel APC list didn't become empty while we acquired the APC lock after the first verification.
- Validate IRQL on return from APC routines, to catch bad code.
svn path=/trunk/; revision=24059
- Support and document InsertApcEnvironment KAPC_ENVIRONMENT type.
- Fixup formatting and ASSERTify.
- Acquire dispatcher lock when insereting an APC into another thread.
- Use delayed interrupt request on SMP systems (and fixup KiRequestApcInterrupt accordingly).
svn path=/trunk/; revision=24058
- Fixup KeInitalizeApc like all the other functions.
- Don't use an expensive 48-byte RtlZeroMemory instead of just clearing two members.
svn path=/trunk/; revision=24056
- Optimize KeFlushQueueApc: we can check if the Kernel-Mode APC list is empty without acquiring the lock. If it's empty, we can quit immediately, if not, then we'll acquire and check it again. For user APCs we always need to acquire the lock, though.
svn path=/trunk/; revision=24054