// SPDX-License-Identifier: GPL-2.0-only /* * Memory fault handling for Hexagon * * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
*/
/* * Page fault handling for the Hexagon Virtual Machine. * Can also be called by a native port emulating the HVM * execptions.
*/
/* * Decode of hardware exception sends us to one of several * entry points. At each, we generate canonical arguments * for handling by the abstract memory management code.
*/ #define FLT_IFETCH -1 #define FLT_LOAD 0 #define FLT_STORE 1
if (fault_signal_pending(fault, regs)) { if (!user_mode(regs)) goto no_context; return;
}
/* The fault is fully completed (including releasing mmap lock) */ if (fault & VM_FAULT_COMPLETED) return;
/* The most common case -- we are done. */ if (likely(!(fault & VM_FAULT_ERROR))) { if (fault & VM_FAULT_RETRY) {
flags |= FAULT_FLAG_TRIED; goto retry;
}
mmap_read_unlock(mm); return;
}
mmap_read_unlock(mm);
/* Handle copyin/out exception cases */ if (!user_mode(regs)) goto no_context;
if (fault & VM_FAULT_OOM) {
pagefault_out_of_memory(); return;
}
/* User-mode address is in the memory map, but we are * unable to fix up the page fault.
*/ if (fault & VM_FAULT_SIGBUS) {
si_signo = SIGBUS;
si_code = BUS_ADRERR;
} /* Address is not in the memory map */ else {
si_signo = SIGSEGV;
si_code = SEGV_ACCERR;
}
force_sig_fault(si_signo, si_code, (void __user *)address); return;
bad_area:
mmap_read_unlock(mm);
bad_area_nosemaphore: if (user_mode(regs)) {
force_sig_fault(SIGSEGV, si_code, (void __user *)address); return;
} /* Kernel-mode fault falls through */
/* Things are looking very, very bad now */
bust_spinlocks(1);
printk(KERN_EMERG "Unable to handle kernel paging request at " "virtual address 0x%08lx, regs %p\n", address, regs);
die("Bad Kernel VA", regs, SIGKILL);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.