14 #ifndef LLVM_SUPPORT_MEMORY_H
15 #define LLVM_SUPPORT_MEMORY_H
17 #include "llvm/Support/DataTypes.h"
19 #include <system_error>
33 void *
base()
const {
return Address; }
34 size_t size()
const {
return Size; }
124 std::string *ErrMsg =
nullptr);
OwningMemoryBlock()=default
static bool setRangeWritable(const void *Addr, size_t Size)
setRangeWritable - Mark the page containing a range of addresses as writable.
This class provides various memory handling functions that manipulate MemoryBlock instances...
static std::error_code releaseMappedMemory(MemoryBlock &Block)
This method releases a block of memory that was allocated with the allocateMappedMemory method...
static MemoryBlock allocateMappedMemory(size_t NumBytes, const MemoryBlock *const NearBlock, unsigned Flags, std::error_code &EC)
This method allocates a block of memory that is suitable for loading dynamically generated code (e...
OwningMemoryBlock(MemoryBlock M)
struct fuzzer::@269 Flags
static void InvalidateInstructionCache(const void *Addr, size_t Len)
InvalidateInstructionCache - Before the JIT can run a block of code that has been emitted it must inv...
MemoryBlock getMemoryBlock() const
MemoryBlock(void *addr, size_t size)
static bool ReleaseRWX(MemoryBlock &block, std::string *ErrMsg=nullptr)
This method releases a block of Read/Write/Execute memory that was allocated with the AllocateRWX met...
static bool setRangeExecutable(const void *Addr, size_t Size)
setRangeExecutable - Mark the page containing a range of addresses as executable. ...
OwningMemoryBlock & operator=(OwningMemoryBlock &&Other)
This class encapsulates the notion of a memory block which has an address and a size.
static MemoryBlock AllocateRWX(size_t NumBytes, const MemoryBlock *NearBlock, std::string *ErrMsg=nullptr)
This method allocates a block of Read/Write/Execute memory that is suitable for executing dynamically...
Owning version of MemoryBlock.
OwningMemoryBlock(OwningMemoryBlock &&Other)
static bool setExecutable(MemoryBlock &M, std::string *ErrMsg=nullptr)
setExecutable - Before the JIT can run a block of code, it has to be given read and executable privil...
static bool setWritable(MemoryBlock &M, std::string *ErrMsg=nullptr)
setWritable - When adding to a block of code, the JIT may need to mark a block of code as RW since th...
static std::error_code protectMappedMemory(const MemoryBlock &Block, unsigned Flags)
This method sets the protection flags for a block of memory to the state specified by /p Flags...