22 Metrics::increment(Metrics::PageFault);
25 const uintptr_t address = state.far;
26 const uintptr_t page = address & ~(PAGE_SIZE - 1);
27 const size_t faultStatus = state.esr & 0x3f;
28 const size_t exceptionClass = (state.esr >> 26) & 0x3f;
29 const bool fetch = exceptionClass == 0x20 || exceptionClass == 0x21;
30 const bool write = !fetch && (state.esr & (1U << 6));
31 const bool present = (faultStatus & 0x3c) == 0x0c;
33 if (present && write &&
36 Metrics::increment(Metrics::PageFaultCopyOnWrite);
40 if (dispatchHandlers(state, address, write, present)) {
42 Metrics::increment(Metrics::PageFaultHandled);
48 if (thread && !state.kernelMode()) {
50 if (process && process->getSubsystem()) {
51 const uintptr_t errorCode = (present ? 1 : 0) | (write ? 2 : 0) | 4 | (fetch ? 16 : 0);
55 Metrics::increment(Metrics::PageFaultDeferred);
60 ERROR(
"ARM64: page fault at " <<
Hex << address <<
" PC " << state.pc <<
" ESR " << state.esr);
61 panic(
"ARM64: unrecoverable page fault");
static EXPORTED_PUBLIC PageFaultHandler m_Instance
virtual void interrupt(size_t interruptNumber, InterruptState &state)