ne_merge_ph...mory_regions(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 ne_merge_phys_contig_memory_regions(9) β€” kernel API manual, but make it cute 🌸

okay so bestie, welcome to the kernel API manual for ne_merge_phys_contig_memory_regions(9) πŸ’… this one lives in the Nitro Enclaves corner of the kernel and honestly it's giving "tiny helper that does one thing really well" energy. lowkey iconic.


✨ NAME ✨

ne_merge_phys_contig_memory_regions β€” adds a memory region and merges the adjacent regions together if they're physically contiguous 🫢

like, you hand it a new region, and if its neighbours happen to be physically touching it, they all get to be one big happy region. fr fr.


πŸ¦‹ SYNOPSIS πŸ¦‹

int ne_merge_phys_contig_memory_regions (struct
ne_phys_contig_mem_regions *phys_contig_regions , u64 page_paddr , u64
page_size );

πŸŽ€ ARGUMENTS πŸŽ€

  • phys_contig_regions β€” the private data that goes with the contiguous physical memory regions. it's the little home base for all this region bookkeeping πŸ’–
  • page_paddr β€” the physical start address of the region you're adding. where it begins, physically ✨
  • page_size β€” the length of the region you're adding. how big it is πŸ“

πŸ‘‘ CONTEXT πŸ‘‘

Process context, babe. and listen β€” this function gets called with the ne_enclave mutex held πŸ”’ so pls respect the lock, no cap. we're not out here grabbing it ourselves, it's already in your hands when you call this.


πŸ”₯ RETURN πŸ”₯

  • 0 on success β€” slay, it worked πŸŽ‰
  • Negative return value on failure β€” it did not work, and it's telling you with a negative number 😭

πŸ’œ SEE ALSO πŸ’œ

so many friends in the enclave friend group, i'm obsessed:

  • the kernel file ./drivers/virt/nitro_enclaves/ne_misc_dev.c β€” the enclave lifetime management driver for Nitro Enclaves (NE) (9) 🧚
  • NE_CPUS_SIZE(9)
  • NE_EIF_LOAD_OFFSET(9)
  • NE_MIN_ENCLAVE_MEM_SIZE(9)
  • NE_MIN_MEM_REGION_SIZE(9)
  • NE_PARENT_VM_CID(9)
  • struct ne_cpu_pool(9)
  • struct ne_phys_contig_mem_regions(9)
  • ne_check_enclaves_created(9)
  • ne_setup_cpu_pool(9)
  • ne_teardown_cpu_pool(9)
  • ne_set_kernel_param(9)
  • ne_donated_cpu(9)
  • ne_get_unused_core_from_cpu_pool(9)
  • ne_set_enclave_threads_per_core(9)
  • ne_get_cpu_from_cpu_pool(9)
  • ne_get_vcpu_core_from_cpu_pool(9)
  • ne_check_cpu_in_cpu_pool(9)
  • ne_add_vcpu_ioctl(9)
  • ne_sanity_check_user_mem_region(9)
  • ne_sanity_check_user_mem_region_page(9)
  • ne_sanity_check_phys_mem_region(9)
  • ne_set_user_memory_region_ioctl(9)
  • ne_start_enclave_ioctl(9)
  • ne_enclave_ioctl(9)
  • ne_enclave_remove_all_mem_region_entries(9)
  • ne_enclave_remove_all_vcpu_id_entries(9)
  • ne_pci_dev_remove_enclave_entry(9)
  • ne_enclave_release(9)
  • ne_enclave_poll(9)
  • ne_create_vm_ioctl(9)
  • ne_ioctl(9)

okay that's the whole page, you ate that bestie πŸ’…βœ¨ this lil doc came from ./drivers/virt/nitro_enclaves and it's dated October 2026 β€” go forth and merge those physically contiguous regions, mwah πŸ«ΆπŸ’–

πŸ“¦ where this page comes from