diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -539,8 +539,7 @@ MPASS(pager_last < fs->first_object->size); vm_fault_restore_map_lock(fs); - bdry_idx = (fs->entry->eflags & MAP_ENTRY_SPLIT_BOUNDARY_MASK) >> - MAP_ENTRY_SPLIT_BOUNDARY_SHIFT; + bdry_idx = MAP_ENTRY_SPLIT_BOUNDARY_INDEX(fs->entry); if (fs->map->timestamp != fs->map_generation) { if (bdry_idx == 0) { vm_fault_populate_cleanup(fs->first_object, pager_first, diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h --- a/sys/vm/vm_map.h +++ b/sys/vm/vm_map.h @@ -154,8 +154,10 @@ #define MAP_ENTRY_HEADER 0x00080000 #define MAP_ENTRY_SPLIT_BOUNDARY_MASK 0x00300000 - #define MAP_ENTRY_SPLIT_BOUNDARY_SHIFT 20 +#define MAP_ENTRY_SPLIT_BOUNDARY_INDEX(entry) \ + (((entry)->eflags & MAP_ENTRY_SPLIT_BOUNDARY_MASK) >> \ + MAP_ENTRY_SPLIT_BOUNDARY_SHIFT) #ifdef _KERNEL static __inline u_char diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -2449,8 +2449,7 @@ KASSERT(entry->end > startaddr && entry->start < startaddr, ("%s: invalid clip of entry %p", __func__, entry)); - bdry_idx = (entry->eflags & MAP_ENTRY_SPLIT_BOUNDARY_MASK) >> - MAP_ENTRY_SPLIT_BOUNDARY_SHIFT; + bdry_idx = MAP_ENTRY_SPLIT_BOUNDARY_INDEX(entry); if (bdry_idx != 0) { if ((startaddr & (pagesizes[bdry_idx] - 1)) != 0) return (KERN_INVALID_ARGUMENT); @@ -2523,8 +2522,7 @@ KASSERT(entry->start < endaddr && entry->end > endaddr, ("%s: invalid clip of entry %p", __func__, entry)); - bdry_idx = (entry->eflags & MAP_ENTRY_SPLIT_BOUNDARY_MASK) >> - MAP_ENTRY_SPLIT_BOUNDARY_SHIFT; + bdry_idx = MAP_ENTRY_SPLIT_BOUNDARY_INDEX(entry); if (bdry_idx != 0) { if ((endaddr & (pagesizes[bdry_idx] - 1)) != 0) return (KERN_INVALID_ARGUMENT); @@ -3516,8 +3514,7 @@ saved_start = entry->start; saved_end = entry->end; last_timestamp = map->timestamp; - bidx = (entry->eflags & MAP_ENTRY_SPLIT_BOUNDARY_MASK) - >> MAP_ENTRY_SPLIT_BOUNDARY_SHIFT; + bidx = MAP_ENTRY_SPLIT_BOUNDARY_INDEX(entry); incr = pagesizes[bidx]; vm_map_busy(map); vm_map_unlock(map); @@ -3715,9 +3712,7 @@ vm_map_unlock_read(map); return (KERN_INVALID_ARGUMENT); } - bdry_idx = (entry->eflags & - MAP_ENTRY_SPLIT_BOUNDARY_MASK) >> - MAP_ENTRY_SPLIT_BOUNDARY_SHIFT; + bdry_idx = MAP_ENTRY_SPLIT_BOUNDARY_INDEX(entry); if (bdry_idx != 0 && ((start & (pagesizes[bdry_idx] - 1)) != 0 || (end & (pagesizes[bdry_idx] - 1)) != 0)) {