Author: greatlrd Date: Mon Mar 5 01:01:08 2007 New Revision: 25990
URL: http://svn.reactos.org/svn/reactos?rev=25990&view=rev Log: merge down 25984 on alex request
Modified: branches/ros-branch-0_3_1/reactos/hal/halx86/generic/systimer.S branches/ros-branch-0_3_1/reactos/hal/halx86/generic/timer.c branches/ros-branch-0_3_1/reactos/include/ndk/asm.h branches/ros-branch-0_3_1/reactos/lib/rtl/debug.c branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/i386/clock.S branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/i386/kiinit.c
Modified: branches/ros-branch-0_3_1/reactos/hal/halx86/generic/systimer.S URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/hal/hal... ============================================================================== --- branches/ros-branch-0_3_1/reactos/hal/halx86/generic/systimer.S (original) +++ branches/ros-branch-0_3_1/reactos/hal/halx86/generic/systimer.S Mon Mar 5 01:01:08 2007 @@ -100,9 +100,9 @@
/* Check if someone updated the counter */ cmp eax, ebx - jne LoopPostInt + jnz LoopPostInt cmp edx, esi - jne LoopPostInt + jnz LoopPostInt
/* Check if the current 8254 value causes rollover */ neg ecx @@ -180,21 +180,37 @@ or ecx, esi jz BelowLow
+ /* Make sure that the count is still valid */ + sub ebx, eax + sbb esi, edx + jnz InvalidCount + cmp ebx, _HalpCurrentRollOver + jg InvalidCount + + /* Fixup the count with the last known value */ sub eax, ebx sbb edx, esi
/* We might have an incoming interrupt, save EFLAGS */ - mov esi, [esp] + mov ecx, [esp] popf
/* Check if interrupts were enabled and try again */ - test esi, EFLAGS_INTERRUPT_MASK + test ecx, EFLAGS_INTERRUPT_MASK jnz LoopPreInt
/* They're not, continue where we left */ pushf jmp BelowLow + + InvalidCount: + popf + xor eax, eax + mov _HalpLastPerfCounterLow, eax + mov _HalpLastPerfCounterHigh, eax + jmp LoopPreInt + .endfunc
.globl _HalpClockInterrupt@0
Modified: branches/ros-branch-0_3_1/reactos/hal/halx86/generic/timer.c URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/hal/hal... ============================================================================== --- branches/ros-branch-0_3_1/reactos/hal/halx86/generic/timer.c (original) +++ branches/ros-branch-0_3_1/reactos/hal/halx86/generic/timer.c Mon Mar 5 01:01:08 2007 @@ -48,6 +48,7 @@ PKPRCB Prcb = KeGetCurrentPrcb(); ULONG Increment; USHORT RollOver; + ULONG Flags = 0;
/* Check the CPU Type */ if (Prcb->CpuType <= 4) @@ -66,6 +67,7 @@ KeSetTimeIncrement(Increment, HalpRolloverTable[0].HighPart);
/* Disable interrupts */ + Ke386SaveFlags(Flags); _disable();
/* Set the rollover */ @@ -73,8 +75,8 @@ __outbyte(TIMER_DATA_PORT0, RollOver & 0xFF); __outbyte(TIMER_DATA_PORT0, RollOver >> 8);
- /* Restore interrupts */ - _enable(); + /* Restore interrupts if they were previously enabled */ + Ke386RestoreFlags(Flags);
/* Save rollover and return */ HalpCurrentRollOver = RollOver; @@ -90,18 +92,21 @@ HalCalibratePerformanceCounter(IN volatile PLONG Count, IN ULONGLONG NewCount) { + ULONG Flags = 0; + /* Disable interrupts */ + Ke386SaveFlags(Flags); _disable();
/* Do a decrement for this CPU */ - //_InterlockedDecrement(Count); - InterlockedDecrement(Count); + _InterlockedDecrement(Count); +
/* Wait for other CPUs */ while (*Count);
- /* Bring interrupts back */ - _enable(); + /* Restore interrupts if they were previously enabled */ + Ke386RestoreFlags(Flags); }
/*
Modified: branches/ros-branch-0_3_1/reactos/include/ndk/asm.h URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/include... ============================================================================== --- branches/ros-branch-0_3_1/reactos/include/ndk/asm.h (original) +++ branches/ros-branch-0_3_1/reactos/include/ndk/asm.h Mon Mar 5 01:01:08 2007 @@ -187,6 +187,7 @@ #define KPCR_PRCB_DEBUG_DPC_TIME 0x654 #define KPCR_PRCB_INTERRUPT_TIME 0x658 #define KPCR_PRCB_ADJUST_DPC_THRESHOLD 0x65C +#define KPCR_PRCB_SKIP_TICK 0x664 #define KPCR_SYSTEM_CALLS 0x6B8 #define KPCR_PRCB_DPC_QUEUE_DEPTH 0xA4C #define KPCR_PRCB_DPC_COUNT 0xA50
Modified: branches/ros-branch-0_3_1/reactos/lib/rtl/debug.c URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/lib/rtl... ============================================================================== --- branches/ros-branch-0_3_1/reactos/lib/rtl/debug.c (original) +++ branches/ros-branch-0_3_1/reactos/lib/rtl/debug.c Mon Mar 5 01:01:08 2007 @@ -150,7 +150,7 @@ if (Status == STATUS_BREAKPOINT) { /* Breakpoint */ - DbgBreakPointWithStatus(DBG_STATUS_CONTROL_C); + // DbgBreakPointWithStatus(DBG_STATUS_CONTROL_C); Status = STATUS_SUCCESS; } }
Modified: branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/i386/clock.S URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/ntoskrn... ============================================================================== --- branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/i386/clock.S (original) +++ branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/i386/clock.S Mon Mar 5 01:01:08 2007 @@ -20,6 +20,10 @@ /* Get KPCR */ mov eax, [fs:KPCR_SELF]
+ /* Check if this tick is getting skipped */ + cmp byte ptr [eax+KPCR_PRCB_SKIP_TICK], 0 + jnz SkipTick + /* Save EBX */ push ebx
@@ -45,11 +49,12 @@ ja AboveDispatch
/* Check if the DPC routine is active */ - cmp dword ptr[eax+KPCR_PRCB_DPC_ROUTINE_ACTIVE], 0 + cmp byte ptr fs:[KPCR_PRCB_DPC_ROUTINE_ACTIVE], 0 jz BelowDispatch
/* At dispatch, increase DPC time */ inc dword ptr [eax+KPCR_PRCB_DPC_TIME] + inc dword ptr [eax+KPCR_PRCB_DEBUG_DPC_TIME] jmp AfterSet
AboveDispatch: @@ -146,11 +151,20 @@ /* Restore ebx and return */ pop ebx ret 4 + +SkipTick: + /* Disable skipping the next tick and return */ + mov byte ptr [eax+KPCR_PRCB_SKIP_TICK], 0 + ret 4 .endfunc
.globl _KeUpdateSystemTime@0 .func KeUpdateSystemTime@0 _KeUpdateSystemTime@0: + + /* Check if this tick is getting skipped */ + cmp byte ptr fs:[KPCR_PRCB_SKIP_TICK], 0 + jnz SkipTickSys
/* Get shared data in ECX */ mov ecx, USER_SHARED_DATA @@ -222,7 +236,13 @@ push offset _KiExpireTimerDpc call _KeInsertQueueDpc@12
+DebugCheck: + /* Check if the debugger is enabled */ + cmp dword ptr __KdDebuggerEnabled, 0 + jnz DebuggerEnabled + /* Check if this was a full tick */ +NoDebug: cmp dword ptr _KiTickOffset, 0 jg IncompleteTick2
@@ -244,4 +264,20 @@ cli call _HalEndSystemInterrupt@8 jmp _Kei386EoiHelper@0 + +DebuggerEnabled: + /* Check for break-in request */ + call _KdPollBreakIn@0 + or al, al + jz NoDebug + + /* Break-in requested! */ + push 1 + call _DbgBreakPointWithStatus@4 + jmp NoDebug + +SkipTickSys: + /* Disable skipping the next tick and return */ + mov byte ptr fs:[KPCR_PRCB_SKIP_TICK], 0 + jmp IncompleteTick2 .endfunc
Modified: branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/i386/kiinit.c URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/ntoskrn... ============================================================================== --- branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/i386/kiinit.c (original) +++ branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/i386/kiinit.c Mon Mar 5 01:01:08 2007 @@ -159,7 +159,7 @@ if (!(KeFeatureBits & KF_PAT) && (KeFeatureBits & KF_MTRR)) { /* Then manually initialize MTRR for the CPU */ - KiInitializeMTRR((BOOLEAN)i); + KiInitializeMTRR(i ? FALSE : TRUE); }
/* Check if we have AMD MTRR and initialize it for the CPU */