Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/vm_fault.c
| Show First 20 Lines • Show All 708 Lines • ▼ Show 20 Lines | |||||
| #define UCODE_PAGEFLT 12 | #define UCODE_PAGEFLT 12 | ||||
| #ifdef T_PAGEFLT | #ifdef T_PAGEFLT | ||||
| _Static_assert(UCODE_PAGEFLT == T_PAGEFLT, "T_PAGEFLT"); | _Static_assert(UCODE_PAGEFLT == T_PAGEFLT, "T_PAGEFLT"); | ||||
| #endif | #endif | ||||
| /* | /* | ||||
| * vm_fault_trap: | * vm_fault_trap: | ||||
| * | * | ||||
| * Helper for the page fault trap handlers, wrapping vm_fault(). | * Helper for the machine-dependent page fault trap handlers, wrapping | ||||
| * Issues ktrace(2) tracepoints for the faults. | * vm_fault(). Issues ktrace(2) tracepoints for the faults. | ||||
| * | * | ||||
| * If a fault cannot be handled successfully by satisfying the | * If the fault cannot be handled successfully by updating the | ||||
| * required mapping, and the faulted instruction cannot be restarted, | * required mapping, and the faulted instruction cannot be restarted, | ||||
| * the signal number and si_code values are returned for trapsignal() | * the signal number and si_code values are returned for trapsignal() | ||||
| * to deliver. | * to deliver. | ||||
| * | * | ||||
| * Returns Mach error codes, but callers should only check for | * Returns Mach error codes, but callers should only check for | ||||
| * KERN_SUCCESS. | * KERN_SUCCESS. | ||||
| */ | */ | ||||
| int | int | ||||
| ▲ Show 20 Lines • Show All 923 Lines • ▼ Show 20 Lines | |||||
| * Handle a page fault occurring at the given address, requiring the | * Handle a page fault occurring at the given address, requiring the | ||||
| * given permissions, in the map specified. If successful, the page | * given permissions, in the map specified. If successful, the page | ||||
| * is inserted into the associated physical map, and optionally | * is inserted into the associated physical map, and optionally | ||||
| * referenced and returned in *m_hold. | * referenced and returned in *m_hold. | ||||
| * | * | ||||
| * The given address should be truncated to the proper page address. | * The given address should be truncated to the proper page address. | ||||
| * | * | ||||
| * KERN_SUCCESS is returned if the page fault is handled; otherwise, a | * KERN_SUCCESS is returned if the page fault is handled; otherwise, a | ||||
| * Mach error specifying why the fault is fatal is returned. | * Mach error code explaining why the fault is fatal is returned. | ||||
| * | * | ||||
| * The map in question must be alive, either being the map for current | * The map in question must be alive, either being the map for the current | ||||
| * process, or the owner process hold count incremented to prevent | * process, or the owner process hold count has been incremented to prevent | ||||
| * exit(). | * exit(). | ||||
| * | * | ||||
| * If the thread private TDP_NOFAULTING flag is set, any fault results | * If the thread private TDP_NOFAULTING flag is set, any fault results | ||||
| * in immediate protection failure. Otherwise the fault is processed, | * in immediate protection failure. Otherwise the fault is processed, | ||||
| * and caller may hold no locks. | * and caller may hold no locks. | ||||
| */ | */ | ||||
| int | int | ||||
| vm_fault(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type, | vm_fault(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type, | ||||
| ▲ Show 20 Lines • Show All 827 Lines • Show Last 20 Lines | |||||