The Pedigree Project
0.1
|
The exception was caused by a hardware task switch. More...
#include <Processor.h>
Static Public Member Functions | |
static void | initialise1 (const BootstrapStruct_t &Info) INITIALISATION_ONLY |
first stage in the initialisation of the processor-specific interface More... | |
static void | initialise2 (const BootstrapStruct_t &Info) INITIALISATION_ONLY |
second/last stage in the initialisation of the processor-specific interface More... | |
static void | initialisationDone () |
static void | deinitialise () |
static size_t | isInitialised () |
static uintptr_t | getBasePointer () |
static uintptr_t | getStackPointer () |
static uintptr_t | getInstructionPointer () |
static void | switchAddressSpace (VirtualAddressSpace &AddressSpace) |
static bool | saveState (SchedulerState &state) |
static void | restoreState (SchedulerState &state, volatile uintptr_t *pLock=0) NORETURN |
static void | restoreState (SyscallState &state, volatile uintptr_t *pLock=0) NORETURN |
static void | jumpKernel (volatile uintptr_t *pLock, uintptr_t address, uintptr_t stack, uintptr_t p1=0, uintptr_t p2=0, uintptr_t p3=0, uintptr_t p4=0) NORETURN |
static void | jumpUser (volatile uintptr_t *pLock, uintptr_t address, uintptr_t stack, uintptr_t p1=0, uintptr_t p2=0, uintptr_t p3=0, uintptr_t p4=0) NORETURN |
static void | breakpoint () |
static void | halt () |
static void | reset () |
static size_t | getDebugBreakpointCount () |
static uintptr_t | getDebugBreakpoint (size_t nBpNumber, DebugFlags::FaultType &nFaultType, size_t &nLength, bool &bEnabled) |
static void | enableDebugBreakpoint (size_t nBpNumber, uintptr_t nLinearAddress, DebugFlags::FaultType nFaultType, size_t nLength) |
static void | disableDebugBreakpoint (size_t nBpNumber) |
static uintptr_t | getDebugStatus () |
static void | haltUntilInterrupt () |
static void | pause () |
static void | setInterrupts (bool bEnable) |
static bool | getInterrupts () |
static void | setSingleStep (bool bEnable, InterruptState &state) |
static uint64_t | readMachineSpecificRegister (uint32_t index) |
static void | writeMachineSpecificRegister (uint32_t index, uint64_t value) |
static void | cpuid (uint32_t inEax, uint32_t inEcx, uint32_t &eax, uint32_t &ebx, uint32_t &ecx, uint32_t &edx) |
static void | invalidate (void *pAddress) |
static physical_uintptr_t | readCr3 () |
static void | identify (HugeStaticString &str) |
static ProcessorId | id () |
static ProcessorInformation & | information () |
static size_t | getCount () |
static void | setTlsBase (uintptr_t newBase) |
Static Public Attributes | |
static size_t | m_Initialised = 0 |
Static Private Attributes | |
static ProcessorInformation | m_ProcessorInformation |
static size_t | m_nProcessors = 1 |
Friends | |
class | Multiprocessor |
class | X86GdtManager |
class | X64GdtManager |
class | Scheduler |
The exception was caused by a hardware task switch.
Interface to the processor's capabilities
Definition at line 80 of file Processor.h.
|
static |
Trigger a breakpoint
Definition at line 31 of file arm_common/Processor.h.
Referenced by _assert(), cpuid(), Log::flushEntry(), and jumpUser().
|
static |
Executes the CPUID machine instruction
[in] | inEax | eax before the CPUID instruction |
[in] | inEcx | ecx before the CPUID instruction |
[out] | eax | eax afterwards |
[out] | ebx | ebx afterwards |
[out] | ecx | ecx afterwards |
[out] | edx | edx afterwards |
Definition at line 213 of file x86_common/Processor.cc.
References breakpoint(), getCount(), getInterrupts(), halt(), haltUntilInterrupt(), id(), information(), m_Initialised, m_ProcessorInformation, pause(), reset(), and setInterrupts().
Referenced by NMFaultHandler::initialiseProcessor(), and X64VirtualAddressSpace::mapHuge().
|
static |
Prepare the processor for reset by deinitialising things initialised in initialise2/initialise1.
Definition at line 54 of file arm_common/Processor.h.
Referenced by initialisationDone().
|
static |
Disable a specific breakpoint
[in] | nBpNumber | the breakpoint number [0 - (getDebugBreakpointCount()
|
Definition at line 69 of file arm_926e/Processor.cc.
Referenced by BreakpointCommand::execute(), and jumpUser().
|
static |
Enable a specific breakpoint
[in] | nBpNumber | the breakpoint number [0 - (getDebugBreakpointCount()
|
[in] | nLinearAddress | the linear Adress that should trigger a breakpoint exception |
[in] | nFaultType | the type of access that should trigger a breakpoint exception |
[in] | nLength | the size/length of the breakpoint |
Definition at line 62 of file arm_926e/Processor.cc.
Referenced by BreakpointCommand::execute(), and jumpUser().
|
static |
Get the base-pointer of the calling function
Definition at line 83 of file hosted/Processor.cc.
Referenced by Backtrace::performBpBacktrace().
|
static |
Get the number of CPUs currently available
Definition at line 50 of file Processor.cc.
References getInterrupts(), and setInterrupts().
Referenced by Spinlock::acquire(), and cpuid().
|
static |
Get information for a specific breakpoint
[in] | nBpNumber | the breakpoint number [0 - (getDebugBreakpointCount()
|
[in,out] | nFaultType | the breakpoint type |
[in,out] | nLength | the breakpoint size/length |
[in,out] | bEnabled | is the breakpoint enabled? |
Definition at line 54 of file arm_926e/Processor.cc.
Referenced by BreakpointCommand::execute(), and jumpUser().
|
static |
Return the (total) number of breakpoints
Definition at line 49 of file arm_926e/Processor.cc.
Referenced by BreakpointCommand::execute(), and jumpUser().
|
static |
|
static |
Get the instruction-pointer of the calling function
Definition at line 73 of file hosted/Processor.cc.
Referenced by Backtrace::performBpBacktrace().
|
static |
Get the IRQ state
Definition at line 79 of file arm_926e/Processor.cc.
Referenced by Spinlock::acquire(), PerProcessorScheduler::addThread(), PerProcessorScheduler::checkEventState(), cpuid(), AtaDisk::doRead(), AtaDisk::doWrite(), Bios::executeInterrupt(), Spinlock::exit(), getCount(), haltUntilInterrupt(), Rtc::initialise2(), jumpUser(), PerProcessorScheduler::schedule(), HostedInterruptManager::signalShim(), sys_mutex_set_invalid(), and Process::~Process().
|
static |
Get the stack-pointer of the calling function
Definition at line 78 of file hosted/Processor.cc.
|
static |
Halt this processor
Definition at line 25 of file arm_common/Processor.h.
Referenced by IoPortManager::allocate(), cpuid(), IoPortManager::free(), jumpUser(), panic(), MemoryMappedIo::read16(), IoPort::read16(), MemoryMappedIo::read32(), IoPort::read32(), MemoryMappedIo::read64(), IoPort::read64(), MemoryMappedIo::read8(), IoPort::read8(), Debugger::start(), MemoryMappedIo::write16(), IoPort::write16(), MemoryMappedIo::write32(), IoPort::write32(), MemoryMappedIo::write64(), IoPort::write64(), MemoryMappedIo::write8(), and IoPort::write8().
|
static |
Wait for an IRQ to fire. Possible HALT or low-power state.
Definition at line 41 of file arm_common/Processor.h.
References getInterrupts(), and setInterrupts().
Referenced by cpuid(), Rtc::initialise2(), and jumpUser().
|
static |
Get the ProcessorId of this processor
Definition at line 40 of file Processor.cc.
Referenced by Spinlock::acquire(), PerProcessorScheduler::addThread(), SlamCache::allocate(), LocksCommand::checkSchedule(), LocksCommand::checkState(), cpuid(), ArmV7VirtualAddressSpace::doMap(), Log::flushEntry(), SlamCache::free(), PerProcessorScheduler::initialise(), X64InterruptManager::interrupt(), LocksCommand::lockReleased(), PerProcessorScheduler::processorAddThread(), SlamCache::recovery(), LocksCommand::setFatal(), and X86VirtualAddressSpace::X86VirtualAddressSpace().
|
static |
Populate 'str' with a string describing the characteristics of this processor.
Definition at line 43 of file arm_926e/Processor.cc.
Referenced by CpuInfoCommand::execute(), and initialisationDone().
|
static |
Get the ProcessorInformation structure of this processor
Definition at line 45 of file Processor.cc.
References m_ProcessorInformation.
Referenced by Spinlock::acquire(), PosixSubsystem::acquire(), Semaphore::acquireWithResult(), BusMasterIde::add(), HostedTimer::addAlarm(), Rtc::addAlarm(), GPTimer::addAlarm(), RequestQueue::addRequest(), PerProcessorScheduler::addThread(), Uhci::addTransferToTransaction(), Ehci::addTransferToTransaction(), Ohci::addTransferToTransaction(), Elf::allocate(), SlamAllocator::allocate(), ArmV7PhysicalMemoryManager::allocateRegion(), HostedPhysicalMemoryManager::allocateRegion(), X86CommonPhysicalMemoryManager::allocateRegion(), VFS::checkAccess(), PosixSubsystem::checkAddress(), PerProcessorScheduler::checkEventState(), MemoryMapManager::clone(), MemoryMappedFile::compact(), MemoryMapManager::compact(), MemoryMapManager::contains(), cpuid(), Ext2Filesystem::createNode(), Pipe::decreaseRefCount(), PerProcessorScheduler::eventHandlerReturned(), Cache::evict(), MappingCommand::execute(), MemoryInspector::execute(), AllocationCommand::execute(), ThreadsCommand::execute(), Bios::executeInterrupt(), PciAtaController::executeRequest(), PosixSubsystem::exit(), Elf::finaliseModule(), X86VirtualAddressSpace::fromFlags(), KernelElf::getDependingModule(), LockedFile::getFile(), File::getPhysicalPage(), Filesystem::getTrueRoot(), UserManager::initialise(), Ps2Mouse::initialise(), X86GdtManager::initialise(), X64GdtManager::initialise(), PerProcessorScheduler::initialise(), Scheduler::initialise(), CacheManager::initialise(), InputManager::initialise(), TextIO::initialise(), Dm9601::initialiseDriver(), X86GdtManager::initialiseProcessor(), X64GdtManager::initialiseProcessor(), DynamicLinker::initPlt(), NMFaultHandler::interrupt(), HostedInterruptManager::interrupt(), X64InterruptManager::interrupt(), X86InterruptManager::interrupt(), MemoryMappedFile::invalidate(), PosixSubsystem::invoke(), IoEvent::IoEvent(), Ipc::IpcMessage::IpcMessage(), CdiIrqHandler::irq(), Ehci::irq(), Thread::join(), jumpUser(), Process::kill(), PosixSubsystem::kill(), PerProcessorScheduler::killCurrentThread(), PosixSubsystem::loadElf(), Elf::loadModule(), LockedFile::lock(), ConsoleManager::lockConsole(), User::login(), Cache::map(), MemoryMapManager::mapAnon(), MemoryMapManager::mapFile(), Ne2k::Ne2k(), Nic3C90x::Nic3C90x(), Backtrace::performBpBacktrace(), PerProcessorScheduler::processorAddThread(), SlamCache::recovery(), AnonymousMemoryMap::remove(), MemoryMappedFile::remove(), MemoryMapManager::remove(), DynamicLinker::resolvePlt(), Process::resume(), pocketknife::runConcurrently(), pocketknife::runConcurrentlyAttached(), MemoryMapManager::sanitiseAddress(), PerProcessorScheduler::schedule(), Nic3C90x::send(), PosixSubsystem::sendSignal(), Thread::setKernelStack(), X86Keyboard::setLedState(), AnonymousMemoryMap::setPermissions(), MemoryMappedFile::setPermissions(), MemoryMapManager::setPermissions(), VirtualTerminalManager::setTerminalMode(), X86GdtManager::setTlsBase(), Thread::setTlsBase(), Thread::shutdown(), PerProcessorScheduler::sleep(), Debugger::start(), Process::suspend(), MemoryMappedFile::sync(), PosixSyscallManager::syscall(), HostedSyscallManager::syscall(), X64SyscallManager::syscall(), WaitCleanup::terminated(), Thread::Thread(), Thread::threadExited(), TimeoutGuard::TimeoutGuard(), PerProcessorScheduler::timer(), DynamicLinker::trap(), DLTrapHandler::trap(), AnonymousMemoryMap::trap(), MemoryMappedFile::trap(), MemoryMapManager::trap(), ConsoleFile::triggerEvent(), RamFile::truncate(), KernelElf::unloadModule(), ConsoleManager::unlockConsole(), MemoryMapManager::unmap(), MemoryMapManager::unmapAllUnlocked(), ConditionVariable::wait(), SlamAllocator::wipe(), RequestQueue::work(), UnixSocket::writeBytewise(), X86VirtualAddressSpace::X86VirtualAddressSpace(), Scheduler::yield(), PosixSubsystem::~PosixSubsystem(), Process::~Process(), TimeoutGuard::~TimeoutGuard(), and X86VirtualAddressSpace::~X86VirtualAddressSpace().
|
static |
End of the kernel core initialisation reached, the initialisation functions and data may now get unmapped/freed.
Definition at line 42 of file hosted/Processor.cc.
References deinitialise(), identify(), HostedPhysicalMemoryManager::initialisationDone(), PageFaultHandler::initialise(), HostedPhysicalMemoryManager::initialise(), initialise1(), initialise2(), HostedSyscallManager::initialiseProcessor(), HostedInterruptManager::initialiseProcessor(), HostedPhysicalMemoryManager::instance(), and PageFaultHandler::instance().
|
static |
first stage in the initialisation of the processor-specific interface
Initialises the processor specific interface. After this function call the whole processor-specific interface is initialised. Note though, that only the bootstrap processor is started. Multiprocessor/-core facilities are available after initialiseProcessor2().
[in] | Info | reference to the multiboot information structure |
Definition at line 24 of file arm_926e/Processor.cc.
Referenced by initialisationDone().
|
static |
second/last stage in the initialisation of the processor-specific interface
Initialises the Multiprocessor/-core functionality of the processor-specific interface. This function may only be called after initialiseProcessor1 and after the whole machine specific interface has been initialised.
Definition at line 36 of file arm_926e/Processor.cc.
Referenced by initialisationDone().
|
static |
Invalidate the TLB entry containing a specific virtual address
[in] | pAddress | the specific virtual address |
Definition at line 52 of file ppc_common/Processor.h.
Referenced by X64VirtualAddressSpace::clone(), X86VirtualAddressSpace::fromFlags(), jumpUser(), X64VirtualAddressSpace::mapUnlocked(), X86VirtualAddressSpace::revertToKernelAddressSpace(), X64VirtualAddressSpace::revertToKernelAddressSpace(), X64VirtualAddressSpace::setFlags(), X64VirtualAddressSpace::unmapUnlocked(), writeMachineSpecificRegister(), and X86VirtualAddressSpace::X86VirtualAddressSpace().
|
static |
Is the processor-specific interface initialised?
Definition at line 34 of file Processor.cc.
References m_Initialised.
Referenced by IoPortManager::allocate(), IoPortManager::free(), and LocksCommand::setFatal().
|
static |
Jumps to an address, in kernel mode, and sets up a calling frame with the given parameters.
pLock | Optional lock to release. |
address | Address to jump to. |
stack | Stack to use (set to 0 for current stack). |
param1 | First parameter. |
param2 | Second parameter. |
param3 | Third parameter. |
param4 | Fourth parameter. |
Referenced by PerProcessorScheduler::addThread(), and jumpUser().
|
static |
Jumps to an address, in user mode, and sets up a calling frame with the given parameters.
pLock | Optional lock to release. |
address | Address to jump to. |
stack | Stack to use (set to 0 for current stack). |
param1 | First parameter. |
param2 | Second parameter. |
param3 | Third parameter. |
param4 | Fourth parameter. |
Definition at line 111 of file hosted/Processor.cc.
References breakpoint(), disableDebugBreakpoint(), enableDebugBreakpoint(), ERROR, getDebugBreakpoint(), getDebugBreakpointCount(), getInterrupts(), halt(), haltUntilInterrupt(), information(), invalidate(), jumpKernel(), pause(), reset(), restoreState(), setInterrupts(), setSingleStep(), setTlsBase(), switchAddressSpace(), and HostedVirtualAddressSpace::switchAddressSpace().
Referenced by PerProcessorScheduler::addThread(), PerProcessorScheduler::checkEventState(), and PosixSubsystem::invoke().
|
static |
Pause CPU during a tight polling loop.
Definition at line 49 of file arm_common/Processor.h.
Referenced by Spinlock::acquire(), X86CommonPhysicalMemoryManager::PageStack::allocate(), LocksCommand::checkState(), cpuid(), jumpUser(), and PciAtaController::PciAtaController().
|
static |
Read a Machine/Model-specific register
[in] | index | the register index |
Definition at line 195 of file x86_common/Processor.cc.
Referenced by X64SyscallManager::initialiseProcessor().
|
static |
Reset this processor
Definition at line 36 of file arm_common/Processor.h.
Referenced by cpuid(), HostedInterruptManager::interrupt(), and jumpUser().
|
static |
Restore a previous scheduler state.
[in] | state | The state to restore. |
[out] | pLock | Optional lock to release. |
Definition at line 100 of file hosted/Processor.cc.
References NOTICE.
Referenced by PerProcessorScheduler::addThread(), TimeoutGuard::cancel(), PerProcessorScheduler::eventHandlerReturned(), jumpUser(), and PerProcessorScheduler::schedule().
|
static |
Restore a previous syscall state.
[out] | pLock | Optional lock to release (for none, set as 0) |
[in] | state | Syscall state to restore. |
|
static |
Save the current processor state.
[out] | state | SchedulerState to save into. |
Definition at line 88 of file hosted/Processor.cc.
References ERROR.
Referenced by PerProcessorScheduler::addThread(), PerProcessorScheduler::checkEventState(), PerProcessorScheduler::schedule(), and TimeoutGuard::TimeoutGuard().
|
static |
Enable/Disable IRQs
[in] | bEnable | true to enable IRSs, false otherwise |
Definition at line 74 of file arm_926e/Processor.cc.
Referenced by Spinlock::acquire(), Semaphore::acquireWithResult(), PerProcessorScheduler::addThread(), PerProcessorScheduler::checkEventState(), cpuid(), AtaDisk::doRead(), AtaDisk::doWrite(), PerProcessorScheduler::eventHandlerReturned(), Bios::executeInterrupt(), PosixSubsystem::exit(), getCount(), haltUntilInterrupt(), CountCompareTimer::initialise(), Rtc::initialise2(), PosixSubsystem::invoke(), jumpUser(), PosixSubsystem::kill(), PerProcessorScheduler::killCurrentThread(), panic(), Spinlock::release(), PerProcessorScheduler::schedule(), sys_mutex_set_invalid(), PedigreeCSyscallManager::syscall(), PosixSyscallManager::syscall(), NativeSyscallManager::syscall(), X64SyscallManager::syscall(), WaitCleanup::terminated(), and Process::~Process().
|
static |
Enable/Disable single-stepping
[in] | bEnable | true to enable single-stepping, false otherwise |
[in] | state | the interrupt-state |
Definition at line 84 of file arm_926e/Processor.cc.
References ERROR.
Referenced by StepCommand::execute(), TraceCommand::execute(), Debugger::interrupt(), and jumpUser().
|
static |
Set a new TLS area base address.
Definition at line 262 of file armv7/Processor.cc.
Referenced by PerProcessorScheduler::addThread(), PerProcessorScheduler::initialise(), jumpUser(), PerProcessorScheduler::killCurrentThread(), Thread::resetTlsBase(), PerProcessorScheduler::schedule(), and Thread::setTlsBase().
|
static |
Switch to a different virtual address space
[in] | AddressSpace | the new address space |
Definition at line 90 of file arm_926e/Processor.cc.
References ERROR.
Referenced by PerProcessorScheduler::addThread(), MemoryMapManager::compact(), MappingCommand::execute(), Bios::executeInterrupt(), X86GdtManager::initialiseDoubleFaultTss(), jumpUser(), PerProcessorScheduler::killCurrentThread(), SlamCache::recovery(), PerProcessorScheduler::schedule(), SlamAllocator::wipe(), X86VirtualAddressSpace::X86VirtualAddressSpace(), PosixSubsystem::~PosixSubsystem(), Process::~Process(), and X86VirtualAddressSpace::~X86VirtualAddressSpace().
|
static |
Write a Machine/Model-specific register
[in] | index | the register index |
[in] | value | the new value of the register |
Definition at line 202 of file x86_common/Processor.cc.
References invalidate().
Referenced by X64SyscallManager::initialiseProcessor().
|
static |
How far has the processor-specific interface been initialised
Definition at line 371 of file Processor.h.
Referenced by _assert(), SlamAllocator::allocate(), X86CommonPhysicalMemoryManager::allocatePage(), cpuid(), isInitialised(), X64VirtualAddressSpace::mapUnlocked(), SlamCache::recovery(), SlamAllocator::wipe(), and X86VirtualAddressSpace::X86VirtualAddressSpace().
|
staticprivate |
If we have only one processor, we define the ProcessorInformation class here otherwise we use an array of ProcessorInformation structures
Definition at line 386 of file Processor.h.
Referenced by cpuid(), information(), X86GdtManager::initialise(), X64GdtManager::initialise(), and Scheduler::initialise().