Struct jit_allocator::virtual_memory::MemoryFlags
source · #[repr(transparent)]pub struct MemoryFlags(pub u32);
Tuple Fields§
§0: u32
Implementations§
source§impl MemoryFlags
impl MemoryFlags
sourcepub const ACCESS_READ: u32 = 1u32
pub const ACCESS_READ: u32 = 1u32
Memory is readable.
sourcepub const ACCESS_WRITE: u32 = 2u32
pub const ACCESS_WRITE: u32 = 2u32
Memory is writable.
sourcepub const ACCESS_EXECUTE: u32 = 4u32
pub const ACCESS_EXECUTE: u32 = 4u32
Memory is executable.
sourcepub const ACCESS_RWX: u32 = 7u32
pub const ACCESS_RWX: u32 = 7u32
Memory is readable, writable and executable.
sourcepub const MMAP_ENABLE_JIT: u32 = 16u32
pub const MMAP_ENABLE_JIT: u32 = 16u32
Use a MAP_JIT
flag available on Apple platforms (introduced by Mojave), which allows JIT code to be
executed in a MAC bundle.
This flag may be turned on by the allocator if there is no other way of allocating executable memory.
Note
This flag can only be used with [alloc], MAP_JIT
only works on OSX and not on iOS.
When a process uses fork()
the child process has no access to the pages mapped with MAP_JIT
.
sourcepub const MMAP_MAX_ACCESS_READ: u32 = 32u32
pub const MMAP_MAX_ACCESS_READ: u32 = 32u32
Pass PROT_MAX(PROT_READ)
or PROT_MPROTECT(PROT_READ)
to mmap()
on platforms that support it.
This flag allows to set a “maximum access” that the memory page can get during its lifetime. Use protect to change the access flags.
Note
This flag can only be used with [alloc] and alloc_dual_mapping.
However alloc_dual_mapping may automatically use this if AccessRead
is used.
sourcepub const MMAP_MAX_ACCESS_WRITE: u32 = 64u32
pub const MMAP_MAX_ACCESS_WRITE: u32 = 64u32
Pass PROT_MAX(PROT_WRITE)
or PROT_MPROTECT(PROT_WRITE)
to mmap()
on platforms that support it.
This flag allows to set a “maximum access” that the memory page can get during its lifetime. Use protect to change the access flags.
Note
This flag can only be used with [alloc] and alloc_dual_mapping.
However alloc_dual_mapping may automatically use this if AccessWrite
is used.
sourcepub const MMAP_MAX_ACCESS_EXECUTE: u32 = 128u32
pub const MMAP_MAX_ACCESS_EXECUTE: u32 = 128u32
Pass PROT_MAX(PROT_EXEC)
or PROT_MPROTECT(PROT_EXEC)
to mmap()
on platforms that support it.
This flag allows to set a “maximum access” that the memory page can get during its lifetime. Use protect to change the access flags.
Note
This flag can only be used with [alloc] and alloc_dual_mapping.
However alloc_dual_mapping may automatically use this if AccessExecute
is used.
pub const MMAP_MAX_ACCESS_RW: u32 = 96u32
pub const MMAP_MAX_ACCESS_RX: u32 = 160u32
pub const MMAP_MAX_ACCESS_RWX: u32 = 224u32
sourcepub const MAP_SHARED: u32 = 256u32
pub const MAP_SHARED: u32 = 256u32
Use MAP_SHARED
when calling mmap().
Note
In some cases MAP_SHARED
may be set automatically. For example, some dual mapping implementations must
use MAP_SHARED
instead of MAP_PRIVATE
to ensure that the OS would not apply copy on write on RW page, which
would cause RX page not having the updated content.
sourcepub const MAPPING_PREFER_TMP: u32 = 2_147_483_648u32
pub const MAPPING_PREFER_TMP: u32 = 2_147_483_648u32
Not an access flag, only used by alloc_dual_mapping()
to override the default allocation strategy to always use
a ‘tmp’ directory instead of “/dev/shm” (on POSIX platforms). Please note that this flag will be ignored if the
operating system allows to allocate an executable memory by a different API than open()
or shm_open()
. For
example on Linux memfd_create()
is preferred and on BSDs shm_open(SHM_ANON, ...)
is used if SHM_ANON is
defined.
Note
This flag can only be used with [alloc].
Trait Implementations§
source§impl BitAnd<MemoryFlags> for MemoryFlags
impl BitAnd<MemoryFlags> for MemoryFlags
source§impl BitAnd<u32> for MemoryFlags
impl BitAnd<u32> for MemoryFlags
source§impl BitAndAssign<MemoryFlags> for MemoryFlags
impl BitAndAssign<MemoryFlags> for MemoryFlags
source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
&=
operation. Read moresource§impl BitAndAssign<u32> for MemoryFlags
impl BitAndAssign<u32> for MemoryFlags
source§fn bitand_assign(&mut self, rhs: u32)
fn bitand_assign(&mut self, rhs: u32)
&=
operation. Read moresource§impl BitOr<MemoryFlags> for MemoryFlags
impl BitOr<MemoryFlags> for MemoryFlags
source§impl BitOr<u32> for MemoryFlags
impl BitOr<u32> for MemoryFlags
source§impl BitOrAssign<MemoryFlags> for MemoryFlags
impl BitOrAssign<MemoryFlags> for MemoryFlags
source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
|=
operation. Read moresource§impl BitOrAssign<u32> for MemoryFlags
impl BitOrAssign<u32> for MemoryFlags
source§fn bitor_assign(&mut self, rhs: u32)
fn bitor_assign(&mut self, rhs: u32)
|=
operation. Read moresource§impl Clone for MemoryFlags
impl Clone for MemoryFlags
source§fn clone(&self) -> MemoryFlags
fn clone(&self) -> MemoryFlags
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for MemoryFlags
impl Debug for MemoryFlags
source§impl From<MemoryFlags> for u32
impl From<MemoryFlags> for u32
source§fn from(val: MemoryFlags) -> Self
fn from(val: MemoryFlags) -> Self
source§impl From<u32> for MemoryFlags
impl From<u32> for MemoryFlags
source§impl Hash for MemoryFlags
impl Hash for MemoryFlags
source§impl Ord for MemoryFlags
impl Ord for MemoryFlags
source§fn cmp(&self, other: &MemoryFlags) -> Ordering
fn cmp(&self, other: &MemoryFlags) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<MemoryFlags> for MemoryFlags
impl PartialEq<MemoryFlags> for MemoryFlags
source§fn eq(&self, other: &MemoryFlags) -> bool
fn eq(&self, other: &MemoryFlags) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<u32> for MemoryFlags
impl PartialEq<u32> for MemoryFlags
source§impl PartialOrd<MemoryFlags> for MemoryFlags
impl PartialOrd<MemoryFlags> for MemoryFlags
source§fn partial_cmp(&self, other: &MemoryFlags) -> Option<Ordering>
fn partial_cmp(&self, other: &MemoryFlags) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more