git: mmap - Add MAP_32BIT

Matthew Dillon dillon at crater.dragonflybsd.org
Tue Apr 8 22:29:22 PDT 2025


commit 4ada7dcafe5be6debc30182f5848889f308174d6
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Tue Apr 8 17:44:22 2025 -0700

    mmap - Add MAP_32BIT
    
    * Add MAP_32BIT, allowing userland to mmap() memory in the 32-bit address
      space without having to resort to MAP_TRYFIXED iteration.  The mapped
      memory may overlap or be within the datasize resource (since this resource
      defaults to 32GB, the entire 4GB address space would otherwise be skipped
      for regular mmap() calls).
    
      Operations will not overlap any area already fully memory-mapped, such
      as program static data and bss areas, stack blocks, or guard pages.
    
      Address zero will not be automatically allocated by this function.
    
    * MAP_32BIT is unable to use the vm_map hinting cache shortcut since this
      cache is unordered.
    
    * Adjust a bunch of kernel-internal MAP_* flags that are used to control
      copy-on-write and other internal pmap work to COWF_* flags.
    
    * Disentangle COWF_PREFAULT_MADVISE and COWF_PREFAULT_RELOCK.  The two
      had the same flag value for some reason.  This might also fix a madvise()
      panic in certain circumstances.
    
    * Adjust manual page.
    
    Requested-by: tuxillo

Summary of changes:
 sys/dev/drm/i915/i915_gem.c     |  2 +-
 sys/kern/imgact_elf.c           |  8 +++---
 sys/kern/link_elf_obj.c         |  2 +-
 sys/platform/pc64/x86_64/pmap.c |  4 +--
 sys/sys/mman.h                  |  1 +
 sys/vm/vm_kern.c                |  4 +--
 sys/vm/vm_map.c                 | 62 ++++++++++++++++++++++++++++-------------
 sys/vm/vm_map.h                 | 26 +++++++++--------
 sys/vm/vm_mmap.c                | 18 ++++++------
 9 files changed, 78 insertions(+), 49 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/4ada7dcafe5be6debc30182f5848889f308174d6


-- 
DragonFly BSD source repository


More information about the Commits mailing list