Changeset View
Changeset View
Standalone View
Standalone View
head/sys/vm/vm_mmap.c
Show First 20 Lines • Show All 537 Lines • ▼ Show 20 Lines | #ifdef HWPMC_HOOKS | ||||
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(map, addr, &entry)) { | ||||
for (; | for (; entry->start < addr + size; | ||||
entry != &map->header && 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 209 Lines • ▼ Show 20 Lines | RestartScan: | ||||
} | } | ||||
/* | /* | ||||
* 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. | ||||
*/ | */ | ||||
lastvecindex = -1; | lastvecindex = -1; | ||||
for (current = entry; | for (current = entry; current->start < end; current = current->next) { | ||||
(current != &map->header) && (current->start < end); | |||||
current = current->next) { | |||||
/* | /* | ||||
* check for contiguity | * check for contiguity | ||||
*/ | */ | ||||
if (current->end < end && | if (current->end < end && current->next->start > current->end) { | ||||
(entry->next == &map->header || | |||||
current->next->start > current->end)) { | |||||
vm_map_unlock_read(map); | vm_map_unlock_read(map); | ||||
return (ENOMEM); | return (ENOMEM); | ||||
} | } | ||||
/* | /* | ||||
* ignore submaps (for now) or null objects | * ignore submaps (for now) or null objects | ||||
*/ | */ | ||||
if ((current->eflags & MAP_ENTRY_IS_SUB_MAP) || | if ((current->eflags & MAP_ENTRY_IS_SUB_MAP) || | ||||
▲ Show 20 Lines • Show All 798 Lines • Show Last 20 Lines |