Go to the source code of this file.
Macros | |
#define | _POSIX_C_SOURCE 200809L |
#define | PAGE_ROUND_UP(x) ( (((uintptr_t)(x)) + MAX_PAGE_SIZE-1) & (~(MAX_PAGE_SIZE-1)) ) |
Functions | |
int | verify_no_mem_leaks (void) |
void * | platform_alloc_rw (uint64_t len) |
void * | platform_alloc_rwe (uint64_t len) |
void | platform_free_rw (void *addr, uint64_t len) |
void | platform_free_rwe (void *addr, uint64_t len) |
void * | platform_virt_to_phys (void *virt) |
void | platform_memset (void *ptr, char value, uint64_t num) |
void | platform_memcpy (void *dst, const void *src, uint64_t num) |
void | platform_start (void) |
void | platform_stop (void) |
int64_t | platform_num_cpus (void) |
int64_t | platform_set_affinity (int64_t affinity) |
void | platform_restore_affinity (int64_t affinity) |
void | platform_vmcall (struct vmcall_registers_t *regs) |
void | platform_vmcall_event (struct vmcall_registers_t *regs) |
Variables | |
int | alloc_count_rw = 0 |
int | alloc_count_rwe = 0 |
uint64_t | g_malloc_fails = 0 |
uint64_t | g_set_afinity_fails = 0 |
uint64_t | g_vmcall = 0 |
#define _POSIX_C_SOURCE 200809L |
Definition at line 23 of file platform.c.
#define PAGE_ROUND_UP | ( | x | ) | ( (((uintptr_t)(x)) + MAX_PAGE_SIZE-1) & (~(MAX_PAGE_SIZE-1)) ) |
Definition at line 35 of file platform.c.
int verify_no_mem_leaks | ( | void | ) |
Definition at line 42 of file platform.c.
void* platform_alloc_rw | ( | uint64_t | len | ) |
Allocate Memory
Used by the common code to allocate virtual memory.
len | the size of virtual memory to be allocated in bytes. |
Definition at line 51 of file platform.c.
void* platform_alloc_rwe | ( | uint64_t | len | ) |
Allocate Executable Memory
Used by the common code to allocate executable virtual memory.
len | the size of virtual memory to be allocated in bytes. |
Definition at line 63 of file platform.c.
void platform_free_rw | ( | void * | addr, |
uint64_t | len | ||
) |
Free Memory
Used by the common code to free virtual memory that was allocated using the platform_alloc function.
addr | the virtual address returned from platform_alloc |
len | the size of the memory allocated |
Definition at line 87 of file platform.c.
void platform_free_rwe | ( | void * | addr, |
uint64_t | len | ||
) |
Free Executable Memory
Used by the common code to free virtual memory that was allocated using the platform_alloc_exec function.
addr | the virtual address returned from platform_alloc_exec |
len | the size of the memory allocated |
Definition at line 96 of file platform.c.
void* platform_virt_to_phys | ( | void * | virt | ) |
Convert Virtual Address to Physical Address
Given a virtual address, this function returns the associated physical address. Note that any page pool issues should be handle by the platform (i.e. the users of this function should be able to provide any virtual address, regardless of where the address originated from).
virt | the virtual address to convert |
Definition at line 105 of file platform.c.
void platform_memset | ( | void * | ptr, |
char | value, | ||
uint64_t | num | ||
) |
Memset
ptr | a pointer to the memory to set |
value | the value to set each byte to |
num | the number of bytes to set |
Definition at line 111 of file platform.c.
void platform_memcpy | ( | void * | dst, |
const void * | src, | ||
uint64_t | num | ||
) |
Memcpy
dst | a pointer to the memory to copy to |
src | a pointer to the memory to copy from |
num | the number of bytes to copy |
Definition at line 120 of file platform.c.
void platform_start | ( | void | ) |
void platform_stop | ( | void | ) |
int64_t platform_num_cpus | ( | void | ) |
Get Number of CPUs
Definition at line 139 of file platform.c.
int64_t platform_set_affinity | ( | int64_t | affinity | ) |
Set CPU affinity
Changes the current core that the driver is running on.
affinity | the cpu number to change to |
Definition at line 145 of file platform.c.
void platform_restore_affinity | ( | int64_t | affinity | ) |
Restore CPU affinity
If an OS requires the cores used by the user space thread to match on return from a call into the kernel (e.g. IOCTL), reset the affinity to it's previous state.
affinity | the cpu affinity mask. |
Definition at line 156 of file platform.c.
void platform_vmcall | ( | struct vmcall_registers_t * | regs | ) |
VMCall
regs | the vmcall registers used in the vmcall |
Definition at line 162 of file platform.c.
void platform_vmcall_event | ( | struct vmcall_registers_t * | regs | ) |
VMCall Event
regs | the vmcall registers used in the vmcall |
Definition at line 168 of file platform.c.
int alloc_count_rw = 0 |
Definition at line 32 of file platform.c.
int alloc_count_rwe = 0 |
Definition at line 33 of file platform.c.
uint64_t g_malloc_fails = 0 |
Definition at line 37 of file platform.c.
uint64_t g_set_afinity_fails = 0 |
Definition at line 38 of file platform.c.
uint64_t g_vmcall = 0 |
Definition at line 39 of file platform.c.