|
The Pedigree Project 0.1
|
#include <PageFaultHandler.h>
Inheritance diagram for PageFaultHandler:
Collaboration diagram for PageFaultHandler:Classes | |
| struct | ActiveDispatch |
| struct | DispatchCleanup |
| struct | HandlerSlot |
Public Member Functions | |
| bool | initialise () |
| EXPORTED_PUBLIC bool | registerHandler (MemoryTrapHandler *pHandler) |
| EXPORTED_PUBLIC bool | unregisterHandler (MemoryTrapHandler *pHandler) |
| virtual void | interrupt (size_t interruptNumber, InterruptState &state) |
Static Public Member Functions | |
| static PageFaultHandler & | instance () |
Private Types | |
| enum class | SlotMode : size_t { Empty = 0 , Enabled , Draining , Deferred , Retiring } |
Private Member Functions | |
| PageFaultHandler () INITIALISATION_ONLY | |
| PageFaultHandler (const PageFaultHandler &) | |
| bool | dispatchHandlers (InterruptState &state, uintptr_t address, bool bIsWrite, bool bWasPresent, MemoryTrapHandler *pOnlyHandler=nullptr) |
| bool | retireSlot (HandlerSlot &slot, size_t expectedPublication, MemoryTrapHandler *expectedHandler) |
| bool | publishDispatch (HandlerSlot &slot, void *owner, DispatchCleanup &cleanup) |
| void | unpublishDispatch (DispatchCleanup &cleanup) |
| bool | hasActiveDispatch (HandlerSlot &slot) const |
| bool | findCurrentDispatch (void *owner, HandlerSlot *target, bool &callbackContext) const |
| virtual | ~InterruptHandler () |
Static Private Member Functions | |
| static size_t | makePublication (size_t generation, SlotMode mode) |
| static size_t | generationOf (size_t publication) |
| static SlotMode | modeOf (size_t publication) |
| static void | abandonedHandlerCleanup (void *context) |
| static void * | currentDispatchOwner () |
Private Attributes | |
| HandlerSlot | m_Handlers [MaxMemoryTrapHandlers] |
| ActiveDispatch | m_ActiveDispatches [MaxActiveDispatches] |
| WaitQueue | m_DispatchWaiters |
| Spinlock | m_HandlerLock |
Static Private Attributes | |
| static const size_t | MaxMemoryTrapHandlers = 16 |
| static const size_t | MaxActiveDispatches = 64 |
| static const size_t | ModeBits = 3 |
| static const size_t | ModeMask = (1 << ModeBits) - 1 |
| static const size_t | GenerationShift = ModeBits |
| static EXPORTED_PUBLIC PageFaultHandler | m_Instance |
The x86 Page Fault Exception handler.
Definition at line 53 of file PageFaultHandler.h.
|
strongprivate |
Definition at line 128 of file PageFaultHandler.h.
|
private |
The default constructor.
Definition at line 37 of file PageFaultHandler.cc.
|
private |
The copy constructor. Note not implemented.
|
staticprivate |
Definition at line 140 of file PageFaultHandler.cc.
|
staticprivate |
Definition at line 192 of file PageFaultHandler.cc.
|
private |
Definition at line 381 of file PageFaultHandler.cc.
|
private |
Definition at line 165 of file PageFaultHandler.cc.
|
staticprivate |
Definition at line 44 of file PageFaultHandler.cc.
|
private |
Definition at line 147 of file PageFaultHandler.cc.
| bool PageFaultHandler::initialise | ( | ) |
Register the PageFaultHandler with the InterruptManager.
Definition at line 15 of file arm64/PageFaultHandler.cc.
References InterruptManager::instance(), and InterruptManager::registerInterruptHandler().
Referenced by ProcessorBase::initialise1().
Here is the caller graph for this function:
|
inlinestatic |
Get the PageFaultHandler instance
Definition at line 57 of file PageFaultHandler.h.
References m_Instance.
Referenced by DLTrapHandler::DLTrapHandler(), ProcessorBase::initialise1(), MemoryMapManager::MemoryMapManager(), and DLTrapHandler::~DLTrapHandler().
Here is the caller graph for this function:
|
virtual |
Called when the handler is registered with the interrupt manager and the interrupt occurred
| [in] | nInterruptNumber | the interrupt number |
| [in] | state | reference to the state before the interrupt |
Implements InterruptHandler.
Definition at line 19 of file arm64/PageFaultHandler.cc.
References Thread::deferSubsystemException(), Thread::getParent(), VirtualAddressSpace::handleCopyOnWriteFault(), Hex, ProcessorBase::information(), ProcessorBase::m_Initialised, and panic().
|
staticprivate |
Definition at line 40 of file PageFaultHandler.cc.
|
staticprivate |
Definition at line 48 of file PageFaultHandler.cc.
|
private |
Definition at line 76 of file PageFaultHandler.cc.
| bool PageFaultHandler::registerHandler | ( | MemoryTrapHandler * | pHandler | ) |
Registers a trap handler.
Duplicate handlers and registrations beyond the fixed registry capacity are rejected.
Definition at line 198 of file PageFaultHandler.cc.
References m_Handlers.
Referenced by DLTrapHandler::DLTrapHandler(), and MemoryMapManager::MemoryMapManager().
Here is the caller graph for this function:
|
private |
Definition at line 52 of file PageFaultHandler.cc.
|
private |
Definition at line 98 of file PageFaultHandler.cc.
| bool PageFaultHandler::unregisterHandler | ( | MemoryTrapHandler * | pHandler | ) |
Stops new callbacks and waits for callbacks which already pinned the handler to return.
A handler cannot synchronously drain its own active callback. Such a request returns false and retires the handler when that callback returns. A synchronous caller must not retain a resource which the active handler needs to finish.
Definition at line 238 of file PageFaultHandler.cc.
References Spinlock::acquire(), ProcessorBase::getInterrupts(), ProcessorBase::information(), m_Handlers, and Spinlock::release().
Referenced by DLTrapHandler::~DLTrapHandler().
Here is the caller graph for this function:
|
staticprivate |
Definition at line 138 of file PageFaultHandler.h.
|
private |
Definition at line 182 of file PageFaultHandler.h.
|
private |
Definition at line 183 of file PageFaultHandler.h.
|
private |
Definition at line 184 of file PageFaultHandler.h.
|
private |
Fixed storage keeps the fault path allocation-free.
Definition at line 181 of file PageFaultHandler.h.
Referenced by registerHandler(), and unregisterHandler().
|
staticprivate |
The PageFaultHandler instance
Definition at line 193 of file PageFaultHandler.h.
Referenced by instance().
|
staticprivate |
Definition at line 126 of file PageFaultHandler.h.
|
staticprivate |
Definition at line 125 of file PageFaultHandler.h.
|
staticprivate |
Definition at line 136 of file PageFaultHandler.h.
|
staticprivate |
Definition at line 137 of file PageFaultHandler.h.