git: d302c0539307 - main - vm: rename MAP_STACK_GROWS_DOWN to MAP_STACK_AREA

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Fri, 06 Dec 2024 08:00:20 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=d302c0539307d1b7ae9a0206d83a1fb9ccc44900

commit d302c0539307d1b7ae9a0206d83a1fb9ccc44900
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-12-05 01:41:13 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-12-06 07:46:59 +0000

    vm: rename MAP_STACK_GROWS_DOWN to MAP_STACK_AREA
    
    Reviewed by:    alc, dougm, markj
    Sponsored by:   The FreeBSD Foundation
    Differential revision:  https://reviews.freebsd.org/D47892
---
 sys/kern/kern_exec.c |  2 +-
 sys/vm/vm_map.c      | 20 ++++++++++----------
 sys/vm/vm_map.h      |  2 +-
 sys/vm/vm_mmap.c     |  2 +-
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 4a11be5b42b8..51bbdeaaa55e 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1240,7 +1240,7 @@ exec_map_stack(struct image_params *imgp)
 	}
 	error = vm_map_find(map, NULL, 0, &stack_addr, (vm_size_t)ssiz,
 	    sv->sv_usrstack, find_space, stack_prot, VM_PROT_ALL,
-	    MAP_STACK_GROWS_DOWN);
+	    MAP_STACK_AREA);
 	if (error != KERN_SUCCESS) {
 		uprintf("exec_new_vmspace: mapping stack size %#jx prot %#x "
 		    "failed, mach error %d errno %d\n", (uintmax_t)ssiz,
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index 3d0fa6da15bc..910ebfb6dc4e 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -1667,7 +1667,7 @@ vm_map_insert1(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
 		protoeflags |= MAP_ENTRY_NOSYNC;
 	if (cow & MAP_DISABLE_COREDUMP)
 		protoeflags |= MAP_ENTRY_NOCOREDUMP;
-	if (cow & MAP_STACK_GROWS_DOWN)
+	if (cow & MAP_STACK_AREA)
 		protoeflags |= MAP_ENTRY_GROWS_DOWN;
 	if (cow & MAP_WRITECOUNT)
 		protoeflags |= MAP_ENTRY_WRITECNT;
@@ -1727,7 +1727,7 @@ charged:
 		}
 	} else if ((prev_entry->eflags & ~MAP_ENTRY_USER_WIRED) ==
 	    protoeflags &&
-	    (cow & (MAP_STACK_GROWS_DOWN | MAP_VN_EXEC)) == 0 &&
+	    (cow & (MAP_STACK_AREA | MAP_VN_EXEC)) == 0 &&
 	    prev_entry->end == start && (prev_entry->cred == cred ||
 	    (prev_entry->object.vm_object != NULL &&
 	    prev_entry->object.vm_object->cred == cred)) &&
@@ -1963,7 +1963,7 @@ vm_map_fixed(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
 	int result;
 
 	end = start + length;
-	KASSERT((cow & MAP_STACK_GROWS_DOWN) == 0 || object == NULL,
+	KASSERT((cow & MAP_STACK_AREA) == 0 || object == NULL,
 	    ("vm_map_fixed: non-NULL backing object for stack"));
 	vm_map_lock(map);
 	VM_MAP_RANGE_CHECK(map, start, end);
@@ -1972,7 +1972,7 @@ vm_map_fixed(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
 		if (result != KERN_SUCCESS)
 			goto out;
 	}
-	if ((cow & MAP_STACK_GROWS_DOWN) != 0) {
+	if ((cow & MAP_STACK_AREA) != 0) {
 		result = vm_map_stack_locked(map, start, length, sgrowsiz,
 		    prot, max, cow);
 	} else {
@@ -2131,10 +2131,10 @@ vm_map_find_locked(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
 	int gap, pidx, rv, try;
 	bool cluster, en_aslr, update_anon;
 
-	KASSERT((cow & MAP_STACK_GROWS_DOWN) == 0 || object == NULL,
+	KASSERT((cow & MAP_STACK_AREA) == 0 || object == NULL,
 	    ("non-NULL backing object for stack"));
 	MPASS((cow & MAP_REMAP) == 0 || (find_space == VMFS_NO_SPACE &&
-	    (cow & MAP_STACK_GROWS_DOWN) == 0));
+	    (cow & MAP_STACK_AREA) == 0));
 	if (find_space == VMFS_OPTIMAL_SPACE && (object == NULL ||
 	    (object->flags & OBJ_COLORED) == 0))
 		find_space = VMFS_ANY_SPACE;
@@ -2147,7 +2147,7 @@ vm_map_find_locked(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
 	update_anon = cluster = clustering_anon_allowed(*addr, cow) &&
 	    (map->flags & MAP_IS_SUB_MAP) == 0 && max_addr == 0 &&
 	    find_space != VMFS_NO_SPACE && object == NULL &&
-	    (cow & (MAP_INHERIT_SHARE | MAP_STACK_GROWS_DOWN)) == 0 &&
+	    (cow & (MAP_INHERIT_SHARE | MAP_STACK_AREA)) == 0 &&
 	    prot != PROT_NONE;
 	curr_min_addr = min_addr = *addr;
 	if (en_aslr && min_addr == 0 && !cluster &&
@@ -2262,7 +2262,7 @@ again:
 		if (rv != KERN_SUCCESS)
 			return (rv);
 	}
-	if ((cow & MAP_STACK_GROWS_DOWN) != 0) {
+	if ((cow & MAP_STACK_AREA) != 0) {
 		rv = vm_map_stack_locked(map, *addr, length, sgrowsiz, prot,
 		    max, cow);
 	} else {
@@ -4596,7 +4596,7 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, vm_size_t max_ssize,
 	vm_size_t init_ssize, sgp;
 	int rv;
 
-	KASSERT((cow & MAP_STACK_GROWS_DOWN) != 0,
+	KASSERT((cow & MAP_STACK_AREA) != 0,
 	    ("New mapping is not a stack"));
 
 	if (max_ssize == 0 ||
@@ -4835,7 +4835,7 @@ retry:
 		gap_deleted = false;
 	}
 	rv = vm_map_insert(map, NULL, 0, grow_start,
-	    grow_start + grow_amount, prot, max, MAP_STACK_GROWS_DOWN);
+	    grow_start + grow_amount, prot, max, MAP_STACK_AREA);
 	if (rv != KERN_SUCCESS) {
 		if (gap_deleted) {
 			rv1 = vm_map_insert1(map, NULL, 0, gap_start,
diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h
index 7c5981463ef7..d0b4bb52968e 100644
--- a/sys/vm/vm_map.h
+++ b/sys/vm/vm_map.h
@@ -376,7 +376,7 @@ long vmspace_resident_count(struct vmspace *vmspace);
 #define	MAP_PREFAULT_MADVISE	0x00000200    /* from (user) madvise request */
 #define	MAP_WRITECOUNT		0x00000400
 #define	MAP_REMAP		0x00000800
-#define	MAP_STACK_GROWS_DOWN	0x00001000
+#define	MAP_STACK_AREA		0x00001000
 #define	MAP_COW_UNUSED0		0x00002000
 #define	MAP_ACC_CHARGED		0x00004000
 #define	MAP_ACC_NO_CHARGE	0x00008000
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index 028175b88b4f..c3672f884f25 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -1569,7 +1569,7 @@ vm_mmap_object(vm_map_t map, vm_offset_t *addr, vm_size_t size, vm_prot_t prot,
 	if (flags & MAP_STACK) {
 		if (object != NULL)
 			return (EINVAL);
-		docow |= MAP_STACK_GROWS_DOWN;
+		docow |= MAP_STACK_AREA;
 	}
 	if ((flags & MAP_EXCL) != 0)
 		docow |= MAP_CHECK_EXCL;