Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/vm_map.c
Show First 20 Lines • Show All 2,376 Lines • ▼ Show 20 Lines | |||||
* the specified address; if necessary, | * the specified address; if necessary, | ||||
* it splits the entry into two. | * it splits the entry into two. | ||||
*/ | */ | ||||
static inline void | static inline void | ||||
vm_map_clip_start(vm_map_t map, vm_map_entry_t entry, vm_offset_t start) | vm_map_clip_start(vm_map_t map, vm_map_entry_t entry, vm_offset_t start) | ||||
{ | { | ||||
vm_map_entry_t new_entry; | vm_map_entry_t new_entry; | ||||
if (!map->system_map) | |||||
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, | |||||
"%s: map %p entry %p start 0x%jx", __func__, map, entry, | |||||
(uintmax_t)start); | |||||
if (start <= entry->start) | if (start <= entry->start) | ||||
return; | return; | ||||
VM_MAP_ASSERT_LOCKED(map); | VM_MAP_ASSERT_LOCKED(map); | ||||
KASSERT(entry->end > start && entry->start < start, | KASSERT(entry->end > start && entry->start < start, | ||||
("_vm_map_clip_start: invalid clip of entry %p", entry)); | ("_vm_map_clip_start: invalid clip of entry %p", entry)); | ||||
new_entry = vm_map_entry_clone(map, entry); | new_entry = vm_map_entry_clone(map, entry); | ||||
Show All 14 Lines | |||||
* prev_entry set the entry before 'start'. | * prev_entry set the entry before 'start'. | ||||
*/ | */ | ||||
static inline vm_map_entry_t | static inline vm_map_entry_t | ||||
vm_map_lookup_clip_start(vm_map_t map, vm_offset_t start, | vm_map_lookup_clip_start(vm_map_t map, vm_offset_t start, | ||||
vm_map_entry_t *prev_entry) | vm_map_entry_t *prev_entry) | ||||
{ | { | ||||
vm_map_entry_t entry; | vm_map_entry_t entry; | ||||
if (!map->system_map) | |||||
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, | |||||
"%s: map %p start 0x%jx prev %p", __func__, map, | |||||
(uintmax_t)start, prev_entry); | |||||
if (vm_map_lookup_entry(map, start, prev_entry)) { | if (vm_map_lookup_entry(map, start, prev_entry)) { | ||||
entry = *prev_entry; | entry = *prev_entry; | ||||
vm_map_clip_start(map, entry, start); | vm_map_clip_start(map, entry, start); | ||||
*prev_entry = vm_map_entry_pred(entry); | *prev_entry = vm_map_entry_pred(entry); | ||||
} else | } else | ||||
entry = vm_map_entry_succ(*prev_entry); | entry = vm_map_entry_succ(*prev_entry); | ||||
return (entry); | return (entry); | ||||
} | } | ||||
/* | /* | ||||
* vm_map_clip_end: [ internal use only ] | * vm_map_clip_end: [ internal use only ] | ||||
* | * | ||||
* Asserts that the given entry ends at or before | * Asserts that the given entry ends at or before | ||||
* the specified address; if necessary, | * the specified address; if necessary, | ||||
* it splits the entry into two. | * it splits the entry into two. | ||||
*/ | */ | ||||
static inline void | static inline void | ||||
vm_map_clip_end(vm_map_t map, vm_map_entry_t entry, vm_offset_t end) | vm_map_clip_end(vm_map_t map, vm_map_entry_t entry, vm_offset_t end) | ||||
{ | { | ||||
vm_map_entry_t new_entry; | vm_map_entry_t new_entry; | ||||
if (!map->system_map) | |||||
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, | |||||
"%s: map %p entry %p end 0x%jx", __func__, map, entry, | |||||
(uintmax_t)end); | |||||
if (end >= entry->end) | if (end >= entry->end) | ||||
return; | return; | ||||
VM_MAP_ASSERT_LOCKED(map); | VM_MAP_ASSERT_LOCKED(map); | ||||
KASSERT(entry->start < end && entry->end > end, | KASSERT(entry->start < end && entry->end > end, | ||||
("_vm_map_clip_end: invalid clip of entry %p", entry)); | ("_vm_map_clip_end: invalid clip of entry %p", entry)); | ||||
new_entry = vm_map_entry_clone(map, entry); | new_entry = vm_map_entry_clone(map, entry); | ||||
▲ Show 20 Lines • Show All 1,283 Lines • ▼ Show 20 Lines | |||||
* map. | * map. | ||||
*/ | */ | ||||
int | int | ||||
vm_map_delete(vm_map_t map, vm_offset_t start, vm_offset_t end) | vm_map_delete(vm_map_t map, vm_offset_t start, vm_offset_t end) | ||||
{ | { | ||||
vm_map_entry_t entry, next_entry; | vm_map_entry_t entry, next_entry; | ||||
VM_MAP_ASSERT_LOCKED(map); | VM_MAP_ASSERT_LOCKED(map); | ||||
if (start == end) | if (start == end) | ||||
return (KERN_SUCCESS); | return (KERN_SUCCESS); | ||||
/* | /* | ||||
* Find the start of the region, and clip it. | * Find the start of the region, and clip it. | ||||
* Step through all entries in this region. | * Step through all entries in this region. | ||||
*/ | */ | ||||
for (entry = vm_map_lookup_clip_start(map, start, &entry); | for (entry = vm_map_lookup_clip_start(map, start, &entry); | ||||
▲ Show 20 Lines • Show All 1,434 Lines • Show Last 20 Lines |