first commit
This commit is contained in:
45
include/mmap.inc
Normal file
45
include/mmap.inc
Normal file
@@ -0,0 +1,45 @@
|
||||
; -----------------------------------------------------------------------------
|
||||
; Memory Management Definitions
|
||||
; Constants derived from <sys/mman.h> and Linux Kernel documentation.
|
||||
; -----------------------------------------------------------------------------
|
||||
|
||||
; Memory Protection Flags
|
||||
PROT_NONE equ 0x0 ; Page cannot be accessed
|
||||
PROT_READ equ 0x1 ; Page can be read
|
||||
PROT_WRITE equ 0x2 ; Page can be written
|
||||
PROT_EXEC equ 0x4 ; Page can be executed (Code)
|
||||
|
||||
; --- MMAP Flags (x86-64 Linux) ---
|
||||
|
||||
; Sharing types (Choose one)
|
||||
MAP_SHARED equ 0x01 ; Share changes
|
||||
MAP_PRIVATE equ 0x02 ; Private copy-on-write
|
||||
MAP_SHARED_VALIDATE equ 0x03 ; Validate flags
|
||||
|
||||
; Basic flags
|
||||
MAP_FIXED equ 0x10 ; Interpret addr exactly
|
||||
MAP_ANONYMOUS equ 0x20 ; No file backing (RAM only)
|
||||
MAP_ANON equ 0x20 ; Alias for MAP_ANONYMOUS
|
||||
MAP_32BIT equ 0x40 ; Allocate in first 2GB (x86-64 only)
|
||||
|
||||
; Advanced flags
|
||||
MAP_GROWSDOWN equ 0x0100 ; Stack-like segment
|
||||
MAP_DENYWRITE equ 0x0800 ; Ignored by modern kernels
|
||||
MAP_EXECUTABLE equ 0x1000 ; Ignored by modern kernels
|
||||
MAP_LOCKED equ 0x2000 ; Lock pages in memory
|
||||
MAP_NORESERVE equ 0x4000 ; Don't reserve swap space
|
||||
MAP_POPULATE equ 0x8000 ; Pre-fault read ahead
|
||||
MAP_NONBLOCK equ 0x10000 ; Do not block on IO
|
||||
MAP_STACK equ 0x20000 ; Allocation is a stack
|
||||
MAP_HUGETLB equ 0x40000 ; Create a huge page
|
||||
MAP_SYNC equ 0x80000 ; Perform synchronous page faults
|
||||
MAP_FIXED_NOREPLACE equ 0x100000 ; MAP_FIXED but don't clobber
|
||||
|
||||
; Huge Page Sizes (Use with MAP_HUGETLB)
|
||||
; Derived from (log2(size) << 26)
|
||||
MAP_HUGE_2MB equ 21 << 26 ; 2MB Huge Page
|
||||
MAP_HUGE_1GB equ 30 << 26 ; 1GB Huge Page
|
||||
|
||||
; Legacy / Unused
|
||||
MAP_FILE equ 0
|
||||
MAP_UNINITIALIZED equ 0 ; Usually not implemented
|
||||
Reference in New Issue
Block a user