diff --git a/reactos/ReactOS-arm.rbuild b/reactos/ReactOS-arm.rbuild index 204b4a4066c..777a1aa2cc3 100644 --- a/reactos/ReactOS-arm.rbuild +++ b/reactos/ReactOS-arm.rbuild @@ -111,17 +111,7 @@ - - - - - - - - - - - + diff --git a/reactos/boot/freeldr/freeldr/arch/arm/loader.c b/reactos/boot/freeldr/freeldr/arch/arm/loader.c index d1548d9eeaa..e4c59aa93d4 100644 --- a/reactos/boot/freeldr/freeldr/arch/arm/loader.c +++ b/reactos/boot/freeldr/freeldr/arch/arm/loader.c @@ -1016,7 +1016,7 @@ ArmSetupPagingAndJump(IN ULONG Magic) // // Jump to Kernel // - (*KernelEntryPoint)(Magic, (PVOID)((ULONG_PTR)ArmLoaderBlock | KSEG0_BASE)); + (*KernelEntryPoint)((PVOID)((ULONG_PTR)ArmLoaderBlock | KSEG0_BASE)); } VOID diff --git a/reactos/hal/halarm/generic/hal.c b/reactos/hal/halarm/generic/hal.c index a3d70b88b5f..cd89ac19f21 100644 --- a/reactos/hal/halarm/generic/hal.c +++ b/reactos/hal/halarm/generic/hal.c @@ -24,6 +24,14 @@ #define READ_REGISTER_ULONG(r) (*((volatile ULONG * const)(r))) #define WRITE_REGISTER_ULONG(r, v) (*((volatile ULONG *)(r)) = (v)) +VOID +FASTCALL +KeUpdateSystemTime( + IN PKTRAP_FRAME TrapFrame, + IN ULONG Increment, + IN KIRQL OldIrql +); + /* DATA **********************************************************************/ ULONG HalpCurrentTimeIncrement, HalpNextTimeIncrement, HalpNextIntervalCount; @@ -256,9 +264,9 @@ HalAssignSlotResources( BOOLEAN NTAPI -HalBeginSystemInterrupt (KIRQL Irql, - ULONG Vector, - PKIRQL OldIrql) +HalBeginSystemInterrupt(IN KIRQL Irql, + IN UCHAR Vector, + OUT PKIRQL OldIrql) { UNIMPLEMENTED; @@ -278,8 +286,8 @@ HalCalibratePerformanceCounter( VOID NTAPI -HalDisableSystemInterrupt(ULONG Vector, - KIRQL Irql) +HalDisableSystemInterrupt(IN UCHAR Vector, + IN KIRQL Irql) { UNIMPLEMENTED; } @@ -330,10 +338,9 @@ HalSetDisplayParameters(IN ULONG CursorPosX, BOOLEAN NTAPI -HalEnableSystemInterrupt( - ULONG Vector, - KIRQL Irql, - KINTERRUPT_MODE InterruptMode) +HalEnableSystemInterrupt(IN UCHAR Vector, + IN KIRQL Irql, + IN KINTERRUPT_MODE InterruptMode) { UNIMPLEMENTED; @@ -343,9 +350,8 @@ HalEnableSystemInterrupt( VOID NTAPI -HalEndSystemInterrupt( - KIRQL Irql, - ULONG Unknown2) +HalEndSystemInterrupt(IN KIRQL OldIrql, + IN PKTRAP_FRAME TrapFrame) { UNIMPLEMENTED; } diff --git a/reactos/include/ndk/arm/ketypes.h b/reactos/include/ndk/arm/ketypes.h index 93ef13ca386..543af9c19c4 100644 --- a/reactos/include/ndk/arm/ketypes.h +++ b/reactos/include/ndk/arm/ketypes.h @@ -343,6 +343,7 @@ typedef struct _KPRCB ULONG KeDcacheFlushCount; ULONG KeExceptionDispatchCount; ULONG KeFirstLevelTbFills; + ULONG KeFloatingEmulationCount; ULONG KeIcacheFlushCount; ULONG KeSecondLevelTbFills; ULONG KeSystemCalls; diff --git a/reactos/ntoskrnl/config/ntapi.c b/reactos/ntoskrnl/config/ntapi.c index deb21ad9f0b..4d4123d90be 100644 --- a/reactos/ntoskrnl/config/ntapi.c +++ b/reactos/ntoskrnl/config/ntapi.c @@ -891,12 +891,7 @@ NtInitializeRegistry(IN USHORT Flag) if (KeGetPreviousMode() == UserMode) return ZwInitializeRegistry(Flag); /* Enough of the system has booted by now */ - BootCyclesEnd = __rdtsc(); - DPRINT1("Boot took %I64d cycles!\n", BootCyclesEnd - BootCycles); - DPRINT1("Interrupts: %d System Calls: %d Context Switches: %d\n", - KeGetCurrentPrcb()->InterruptCount, - KeGetCurrentPrcb()->KeSystemCalls, - KeGetContextSwitches(KeGetCurrentPrcb())); + Ki386PerfEnd(); /* Validate flag */ if (Flag > CM_BOOT_FLAG_MAX) return STATUS_INVALID_PARAMETER; diff --git a/reactos/ntoskrnl/include/internal/arm/ke.h b/reactos/ntoskrnl/include/internal/arm/ke.h index 14ab98e2e95..964b63b7162 100644 --- a/reactos/ntoskrnl/include/internal/arm/ke.h +++ b/reactos/ntoskrnl/include/internal/arm/ke.h @@ -3,6 +3,8 @@ #include "intrin_i.h" +#define KiServiceExit2 KiExceptionExit + // //Lockdown TLB entries // @@ -91,9 +93,13 @@ KiRundownThread(IN PKTHREAD Thread) VOID KiPassiveRelease( VOID - ); +VOID +KiSystemService(IN PKTHREAD Thread, + IN PKTRAP_FRAME TrapFrame, + IN ULONG Instruction); + VOID KiApcInterrupt( VOID @@ -113,7 +119,11 @@ KeFlushTb( VOID ); -#define KiSystemStartupReal KiSystemStartup +#define Ki386PerfEnd() +#define KiEndInterrupt(x,y) + +#define KiGetLinkedTrapFrame(x) \ + (PKTRAP_FRAME)((x)->PreviousTrapFrame) #define KiGetPreviousMode(tf) \ ((tf->Spsr & CPSR_MODES) == CPSR_USER_MODE) ? UserMode: KernelMode diff --git a/reactos/ntoskrnl/include/internal/i386/ke.h b/reactos/ntoskrnl/include/internal/i386/ke.h index ceba3438a18..0054f71f471 100644 --- a/reactos/ntoskrnl/include/internal/i386/ke.h +++ b/reactos/ntoskrnl/include/internal/i386/ke.h @@ -33,6 +33,9 @@ #define KeGetTrapFramePc(TrapFrame) \ ((TrapFrame)->Eip) +#define KiGetLinkedTrapFrame(x) \ + (PKTRAP_FRAME)((x)->Edx) + #define KeGetContextReturnRegister(Context) \ ((Context)->Eax) @@ -451,7 +454,6 @@ extern UCHAR KiDebugRegisterContextOffsets[9]; extern VOID __cdecl KiTrap02(VOID); extern VOID __cdecl KiTrap08(VOID); extern VOID __cdecl KiTrap13(VOID); -extern VOID __cdecl KiInterruptTemplate(VOID); extern VOID __cdecl KiFastCallEntry(VOID); extern VOID NTAPI ExpInterlockedPopEntrySListFault(VOID); extern VOID __cdecl CopyParams(VOID); @@ -740,5 +742,38 @@ KiSwitchToBootStack(IN ULONG_PTR InitialStack) ); } +// +// Normally this is done by the HAL, but on x86 as an optimization, the kernel +// initiates the end by calling back into the HAL and exiting the trap here. +// +VOID +FORCEINLINE +KiEndInterrupt(IN KIRQL Irql, + IN PKTRAP_FRAME TrapFrame) +{ + /* Disable interrupts and end the interrupt */ + _disable(); + HalEndSystemInterrupt(Irql, TrapFrame); + + /* Exit the interrupt */ + KiEoiHelper(TrapFrame); +} + +// +// PERF Code +// +VOID +FORCEINLINE +Ki386PerfEnd(VOID) +{ + extern ULONGLONG BootCyclesEnd, BootCycles; + BootCyclesEnd = __rdtsc(); + DbgPrint("Boot took %I64d cycles!\n", BootCyclesEnd - BootCycles); + DbgPrint("Interrupts: %d System Calls: %d Context Switches: %d\n", + KeGetCurrentPrcb()->InterruptCount, + KeGetCurrentPrcb()->KeSystemCalls, + KeGetContextSwitches(KeGetCurrentPrcb())); +} + #endif #endif /* __NTOSKRNL_INCLUDE_INTERNAL_I386_KE_H */ diff --git a/reactos/ntoskrnl/include/internal/ke.h b/reactos/ntoskrnl/include/internal/ke.h index 9169dfd66db..fd1ccdb6b9f 100644 --- a/reactos/ntoskrnl/include/internal/ke.h +++ b/reactos/ntoskrnl/include/internal/ke.h @@ -140,6 +140,7 @@ extern ULONG KiDPCTimeout; extern PGDI_BATCHFLUSH_ROUTINE KeGdiFlushUserBatch; extern ULONGLONG BootCycles, BootCyclesEnd; extern ULONG ProcessCount; +extern VOID __cdecl KiInterruptTemplate(VOID); /* MACROS *************************************************************************/ diff --git a/reactos/ntoskrnl/ke/arm/kiinit.c b/reactos/ntoskrnl/ke/arm/kiinit.c index 2a15609ca51..9352350349f 100644 --- a/reactos/ntoskrnl/ke/arm/kiinit.c +++ b/reactos/ntoskrnl/ke/arm/kiinit.c @@ -18,6 +18,7 @@ KINTERRUPT KxUnexpectedInterrupt; BOOLEAN KeIsArmV6; ULONG KeNumberProcessIds; ULONG KeNumberTbEntries; +ULONG ProcessCount; // PERF extern PVOID KiArmVectorTable; #define __ARMV6__ KeIsArmV6 @@ -114,7 +115,7 @@ KiInitializeKernel(IN PKPROCESS InitProcess, // // Copy the template code // - KxUnexpectedInterrupt.DispatchCode[i] = KiInterruptTemplate[i]; + KxUnexpectedInterrupt.DispatchCode[i] = ((PULONG)KiInterruptTemplate)[i]; } // diff --git a/reactos/ntoskrnl/ke/arm/stubs_asm.s b/reactos/ntoskrnl/ke/arm/stubs_asm.s index f7d4900457a..7efce44ec30 100644 --- a/reactos/ntoskrnl/ke/arm/stubs_asm.s +++ b/reactos/ntoskrnl/ke/arm/stubs_asm.s @@ -15,7 +15,6 @@ GENERATE_ARM_STUB RtlpGetStackLimits GENERATE_ARM_STUB DbgBreakPointWithStatus GENERATE_ARM_STUB KeRaiseUserException GENERATE_ARM_STUB KdpGdbStubInit -GENERATE_ARM_STUB NtRaiseException // // Driver ISRs @@ -37,4 +36,3 @@ GENERATE_ARM_STUB RtlInitializeContext GENERATE_ARM_STUB KeUserModeCallback GENERATE_ARM_STUB KiCallUserMode GENERATE_ARM_STUB NtCallbackReturn -GENERATE_ARM_STUB NtContinue diff --git a/reactos/ntoskrnl/ke/arm/trap.s b/reactos/ntoskrnl/ke/arm/trap.s index 26a4d523976..62aecbe7f6b 100644 --- a/reactos/ntoskrnl/ke/arm/trap.s +++ b/reactos/ntoskrnl/ke/arm/trap.s @@ -127,7 +127,6 @@ TRAP_EPILOG 0 // NotFromSystemCall ENTRY_END KiExceptionExit - NESTED_ENTRY KiServiceExit PROLOG_END KiServiceExit // diff --git a/reactos/ntoskrnl/ke/except.c b/reactos/ntoskrnl/ke/except.c index c8533d077ef..894a96789eb 100644 --- a/reactos/ntoskrnl/ke/except.c +++ b/reactos/ntoskrnl/ke/except.c @@ -180,10 +180,12 @@ NtRaiseException(IN PEXCEPTION_RECORD ExceptionRecord, /* Get trap frame and link previous one*/ Thread = KeGetCurrentThread(); TrapFrame = Thread->TrapFrame; - Thread->TrapFrame = (PKTRAP_FRAME)TrapFrame->Edx; + Thread->TrapFrame = KiGetLinkedTrapFrame(TrapFrame); /* Set exception list */ +#ifdef _M_IX86 KeGetPcr()->Tib.ExceptionList = TrapFrame->ExceptionList; +#endif /* Raise the exception */ Status = KiRaiseException(ExceptionRecord, @@ -218,7 +220,7 @@ NtContinue(IN PCONTEXT Context, /* Get trap frame and link previous one*/ Thread = KeGetCurrentThread(); TrapFrame = Thread->TrapFrame; - Thread->TrapFrame = (PKTRAP_FRAME)TrapFrame->Edx; + Thread->TrapFrame = KiGetLinkedTrapFrame(TrapFrame); /* Continue from this point on */ Status = KiContinue(Context, NULL, TrapFrame); diff --git a/reactos/ntoskrnl/ke/time.c b/reactos/ntoskrnl/ke/time.c index 87966b4f9f8..257f51043b8 100644 --- a/reactos/ntoskrnl/ke/time.c +++ b/reactos/ntoskrnl/ke/time.c @@ -113,11 +113,7 @@ KeUpdateSystemTime(IN PKTRAP_FRAME TrapFrame, } /* Disable interrupts and end the interrupt */ - _disable(); - HalEndSystemInterrupt(Irql, TrapFrame); - - /* Exit the interrupt */ - KiEoiHelper(TrapFrame); + KiEndInterrupt(Irql, TrapFrame); } VOID diff --git a/reactos/ntoskrnl/mm/ARM3/arm/init.c b/reactos/ntoskrnl/mm/ARM3/arm/init.c index 9b98ea9798b..e16b7b83441 100644 --- a/reactos/ntoskrnl/mm/ARM3/arm/init.c +++ b/reactos/ntoskrnl/mm/ARM3/arm/init.c @@ -57,6 +57,7 @@ PVOID MmSystemRangeStart; PVOID MmSystemCacheStart; PVOID MmSystemCacheEnd; MMSUPPORT MmSystemCacheWs; +PVOID MmHyperSpaceEnd; /* PRIVATE FUNCTIONS **********************************************************/ diff --git a/reactos/ntoskrnl/ps/process.c b/reactos/ntoskrnl/ps/process.c index 5b904f2504e..fea26c938c0 100644 --- a/reactos/ntoskrnl/ps/process.c +++ b/reactos/ntoskrnl/ps/process.c @@ -845,16 +845,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle, PspRunCreateProcessNotifyRoutines(Process, TRUE); /* If 12 processes have been created, enough of user-mode is ready */ - if (++ProcessCount == 12) - { - /* Enough of the system has booted by now */ - BootCyclesEnd = __rdtsc(); - DPRINT1("User Boot took %I64d cycles!\n", BootCyclesEnd - BootCycles); - DPRINT1("Interrupts: %d System Calls: %d Context Switches: %d\n", - KeGetCurrentPrcb()->InterruptCount, - KeGetCurrentPrcb()->KeSystemCalls, - KeGetContextSwitches(KeGetCurrentPrcb())); - } + if (++ProcessCount == 12) Ki386PerfEnd(); CleanupWithRef: /*