Memory Enumeration

API for enumerating memory blocks.

Functions

struct metal_memory *metal_get_memory_from_address(const uintptr_t address)

Get the memory block which services the given address.

Given a physical memory address, get a handle for the memory block to which that address is mapped.

Return

The memory block handle, or NULL if the address is not mapped to a memory block

Parameters
  • address: The address to query

__inline__ uintptr_t metal_memory_get_base_address(const struct metal_memory *memory)

Get the base address for a memory block.

Return

The base address of the memory block

Parameters
  • memory: The handle for the memory block

__inline__ size_t metal_memory_get_size(const struct metal_memory *memory)

Get the size of a memory block.

Return

The size of the memory block

Parameters
  • memory: The handle for the memory block

__inline__ int metal_memory_supports_atomics(const struct metal_memory *memory)

Query if a memory block supports atomic operations.

Return

nonzero if the memory block supports atomic operations

Parameters
  • memory: The handle for the memory block

__inline__ int metal_memory_is_cachable(const struct metal_memory *memory)

Query if a memory block is cacheable.

Return

nonzero if the memory block is cachable

Parameters
  • memory: The handle for the memory block

struct metal_memory
#include <memory.h>

A handle for a memory block.