class UserMemory
Defined at line 30 of file ../../zircon/kernel/lib/unittest/include/lib/unittest/user_memory.h
UserMemory facilitates testing code that requires user memory.
Example:
unique_ptr
<UserMemory
> mem = UserMemory::Create(sizeof(thing));
auto mem_out = make_user_out_ptr(mem->out());
mem_out.copy_array_to_user(
&thing
, sizeof(thing));
Public Methods
ktl::unique_ptr<UserMemory> Create (size_t size)
static
Defined at line 81 of file ../../zircon/kernel/lib/unittest/user_memory.cc
ktl::unique_ptr<UserMemory> Create (fbl::RefPtr<VmObject> vmo, uint8_t tag, uint8_t align_pow2)
static
Defined at line 68 of file ../../zircon/kernel/lib/unittest/user_memory.cc
ktl::unique_ptr<UserMemory> CreateInAspace (fbl::RefPtr<VmObject> vmo, fbl::RefPtr<VmAspace> & aspace, uint8_t tag, uint8_t align_pow2)
static
Defined at line 58 of file ../../zircon/kernel/lib/unittest/user_memory.cc
ktl::unique_ptr<UserMemory> CreateInVmar (fbl::RefPtr<VmObject> vmo, fbl::RefPtr<VmAddressRegion> & vmar, uint8_t tag, uint8_t align_pow2)
static
Defined at line 20 of file ../../zircon/kernel/lib/unittest/user_memory.cc
void ~UserMemory ()
Defined at line 14 of file ../../zircon/kernel/lib/unittest/user_memory.cc
vaddr_t base ()
Defined at line 43 of file ../../zircon/kernel/lib/unittest/include/lib/unittest/user_memory.h
uint8_t tag ()
Defined at line 51 of file ../../zircon/kernel/lib/unittest/include/lib/unittest/user_memory.h
const fbl::RefPtr<VmObject> & vmo ()
Defined at line 53 of file ../../zircon/kernel/lib/unittest/include/lib/unittest/user_memory.h
const fbl::RefPtr<VmAspace> & aspace ()
Defined at line 55 of file ../../zircon/kernel/lib/unittest/include/lib/unittest/user_memory.h
const fbl::RefPtr<VmMapping> & mapping ()
Defined at line 57 of file ../../zircon/kernel/lib/unittest/include/lib/unittest/user_memory.h
template <typename T>
void put (const T & value, size_t i)
Defined at line 60 of file ../../zircon/kernel/lib/unittest/include/lib/unittest/user_memory.h
template <typename T>
T get (size_t i)
Defined at line 66 of file ../../zircon/kernel/lib/unittest/include/lib/unittest/user_memory.h
template <typename T>
user_out_ptr<T> user_out ()
Defined at line 74 of file ../../zircon/kernel/lib/unittest/include/lib/unittest/user_memory.h
template <typename T>
user_in_ptr<const T> user_in ()
Defined at line 79 of file ../../zircon/kernel/lib/unittest/include/lib/unittest/user_memory.h
zx_status_t CommitAndMap (size_t size, uint64_t offset)
Ensures the mapping is committed and mapped such that usages will cause no faults.
Defined at line 84 of file ../../zircon/kernel/lib/unittest/include/lib/unittest/user_memory.h
zx_status_t MapExisting (size_t size, uint64_t offset)
Map in any pages that are committed in the vmo. Ignores existing mappings allowing this to be
called multiple times.
Defined at line 90 of file ../../zircon/kernel/lib/unittest/include/lib/unittest/user_memory.h
zx_status_t Protect (uint flags, uint64_t offset)
Defined at line 94 of file ../../zircon/kernel/lib/unittest/include/lib/unittest/user_memory.h
zx_status_t MakeRX ()
Changes the mapping permissions to be a Read-Only Executable mapping.
Defined at line 101 of file ../../zircon/kernel/lib/unittest/include/lib/unittest/user_memory.h
zx_status_t VmoRead (void * ptr, uint64_t offset, uint64_t len)
Read or write to the underlying VMO directly, bypassing the mapping.
Defined at line 104 of file ../../zircon/kernel/lib/unittest/include/lib/unittest/user_memory.h
zx_status_t VmoWrite (const void * ptr, uint64_t offset, uint64_t len)
Defined at line 108 of file ../../zircon/kernel/lib/unittest/include/lib/unittest/user_memory.h