Changeset View
Changeset View
Standalone View
Standalone View
vm_mmap.c
Show First 20 Lines • Show All 539 Lines • ▼ Show 20 Lines | #ifdef HWPMC_HOOKS | ||||
pmc_handled = false; | pmc_handled = false; | ||||
if (PMC_HOOK_INSTALLED(PMC_FN_MUNMAP)) { | if (PMC_HOOK_INSTALLED(PMC_FN_MUNMAP)) { | ||||
pmc_handled = true; | pmc_handled = true; | ||||
/* | /* | ||||
* Inform hwpmc if the address range being unmapped contains | * Inform hwpmc if the address range being unmapped contains | ||||
* an executable region. | * an executable region. | ||||
*/ | */ | ||||
pkm.pm_address = (uintptr_t) NULL; | pkm.pm_address = (uintptr_t) NULL; | ||||
if (vm_map_lookup_entry(map, addr, &entry)) { | if (vm_map_lookup_entry_lesseq(map, addr, &entry)) { | ||||
for (; entry->start < addr + size; | for (; entry->start < addr + size; | ||||
entry = entry->next) { | entry = entry->next) { | ||||
if (vm_map_check_protection(map, entry->start, | if (vm_map_check_protection(map, entry->start, | ||||
entry->end, VM_PROT_EXECUTE) == TRUE) { | entry->end, VM_PROT_EXECUTE) == TRUE) { | ||||
pkm.pm_address = (uintptr_t) addr; | pkm.pm_address = (uintptr_t) addr; | ||||
pkm.pm_size = (size_t) size; | pkm.pm_size = (size_t) size; | ||||
break; | break; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 201 Lines • ▼ Show 20 Lines | if (end > vm_map_max(map) || end < addr) | ||||
return (ENOMEM); | return (ENOMEM); | ||||
pmap = vmspace_pmap(td->td_proc->p_vmspace); | pmap = vmspace_pmap(td->td_proc->p_vmspace); | ||||
vm_map_lock_read(map); | vm_map_lock_read(map); | ||||
RestartScan: | RestartScan: | ||||
timestamp = map->timestamp; | timestamp = map->timestamp; | ||||
if (!vm_map_lookup_entry(map, addr, &entry)) { | if (!vm_map_lookup_entry_lesseq(map, addr, &entry)) { | ||||
vm_map_unlock_read(map); | vm_map_unlock_read(map); | ||||
return (ENOMEM); | return (ENOMEM); | ||||
} | } | ||||
/* | /* | ||||
* Do this on a map entry basis so that if the pages are not | * Do this on a map entry basis so that if the pages are not | ||||
* in the current processes address space, we can easily look | * in the current processes address space, we can easily look | ||||
* up the pages elsewhere. | * up the pages elsewhere. | ||||
▲ Show 20 Lines • Show All 825 Lines • Show Last 20 Lines |