123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- /*++
- Copyright (c) 2014 Minoca Corp. All Rights Reserved
- Module Name:
- archsupc.c
- Abstract:
- This module implements ARMv7 processor architecture features.
- Author:
- Chris Stevens 3-Feb-2014
- Environment:
- Kernel
- --*/
- //
- // ------------------------------------------------------------------- Includes
- //
- #include <minoca/kernel/kernel.h>
- #include <minoca/kernel/arm.h>
- //
- // ---------------------------------------------------------------- Definitions
- //
- //
- // ------------------------------------------------------ Data Type Definitions
- //
- //
- // ----------------------------------------------- Internal Function Prototypes
- //
- //
- // -------------------------------------------------------------------- Globals
- //
- //
- // ------------------------------------------------------------------ Functions
- //
- VOID
- ArSetUpUserSharedDataFeatures (
- VOID
- )
- /*++
- Routine Description:
- This routine initialize the user shared data processor specific features.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- {
- ULONG Architecture;
- PUSER_SHARED_DATA Data;
- ULONG MainId;
- Data = MmGetUserSharedData();
- MainId = ArGetMainIdRegister();
- Architecture = (MainId & ARM_MAIN_ID_ARCHITECTURE_MASK) >>
- ARM_MAIN_ID_ARCHITECTURE_SHIFT;
- if (Architecture == ARM_MAIN_ID_ARCHITECTURE_CPUID) {
- Data->ProcessorFeatures |= ARM_FEATURE_V7;
- }
- ArInitializeVfpSupport();
- return;
- }
- VOID
- ArpInitializePerformanceMonitor (
- VOID
- )
- /*++
- Routine Description:
- This routine initializes the system's performance monitor.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- {
- //
- // Disable performance monitor interrupts, and access to the performance
- // monitors in user mode.
- //
- if (ArGetPerformanceControlRegister() != 0) {
- ArClearPerformanceInterruptRegister(PERF_MONITOR_COUNTER_MASK);
- ArSetPerformanceUserEnableRegister(0);
- }
- return;
- }
- VOID
- ArSetThreadPointer (
- PVOID Thread,
- PVOID NewThreadPointer
- )
- /*++
- Routine Description:
- This routine sets the new thread pointer value.
- Arguments:
- Thread - Supplies a pointer to the thread to set the thread pointer for.
- NewThreadPointer - Supplies the new thread pointer value to set.
- Return Value:
- None.
- --*/
- {
- PULONG LowPointer;
- RUNLEVEL OldRunLevel;
- PKTHREAD TypedThread;
- OldRunLevel = KeRaiseRunLevel(RunLevelDispatch);
- //
- // Only set the low 32-bits, the upper 32-bits are used to hold the
- // read/write thread pointer.
- //
- TypedThread = Thread;
- LowPointer = (PULONG)&(TypedThread->ThreadPointer);
- *LowPointer = (ULONG)NewThreadPointer;
- if (Thread == KeGetCurrentThread()) {
- ArSetThreadPointerUserReadOnly(NewThreadPointer);
- }
- KeLowerRunLevel(OldRunLevel);
- return;
- }
- //
- // --------------------------------------------------------- Internal Functions
- //
|