Functions
platform.h File Reference

Go to the source code of this file.

Functions

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)
 

Function Documentation

◆ platform_alloc_rw()

void* platform_alloc_rw ( uint64_t  len)

Allocate Memory

Used by the common code to allocate virtual memory.

Parameters
lenthe size of virtual memory to be allocated in bytes.
Returns
a virtual address pointing to the newly allocated memory

Definition at line 43 of file platform.c.

◆ platform_alloc_rwe()

void* platform_alloc_rwe ( uint64_t  len)

Allocate Executable Memory

Used by the common code to allocate executable virtual memory.

Parameters
lenthe size of virtual memory to be allocated in bytes.
Returns
a virtual address pointing to the newly allocated memory

Definition at line 62 of file platform.c.

◆ platform_free_rw()

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.

Parameters
addrthe virtual address returned from platform_alloc
lenthe size of the memory allocated

Definition at line 81 of file platform.c.

◆ platform_free_rwe()

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.

Parameters
addrthe virtual address returned from platform_alloc_exec
lenthe size of the memory allocated

Definition at line 95 of file platform.c.

◆ platform_virt_to_phys()

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).

Parameters
virtthe virtual address to convert
Returns
the physical address assocaited with the provided virtual address

Definition at line 109 of file platform.c.

◆ platform_memset()

void platform_memset ( void *  ptr,
char  value,
uint64_t  num 
)

Memset

Parameters
ptra pointer to the memory to set
valuethe value to set each byte to
numthe number of bytes to set

Definition at line 118 of file platform.c.

◆ platform_memcpy()

void platform_memcpy ( void *  dst,
const void *  src,
uint64_t  num 
)

Memcpy

Parameters
dsta pointer to the memory to copy to
srca pointer to the memory to copy from
numthe number of bytes to copy

Definition at line 127 of file platform.c.

◆ platform_start()

void platform_start ( void  )

Start

Run after the start function has been executed.

Definition at line 136 of file platform.c.

◆ platform_stop()

void platform_stop ( void  )

Stop

Run after the stop function has been executed.

Definition at line 144 of file platform.c.

◆ platform_num_cpus()

int64_t platform_num_cpus ( void  )

Get Number of CPUs

Returns
returns the total number of CPUs available to the driver.

Definition at line 152 of file platform.c.

◆ platform_set_affinity()

int64_t platform_set_affinity ( int64_t  affinity)

Set CPU affinity

Changes the current core that the driver is running on.

Parameters
affinitythe cpu number to change to
Returns
The affinity mask of the CPU before the change

Definition at line 163 of file platform.c.

◆ platform_restore_affinity()

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.

Parameters
affinitythe cpu affinity mask.

Definition at line 182 of file platform.c.

◆ platform_vmcall()

void platform_vmcall ( struct vmcall_registers_t regs)

VMCall

Parameters
regsthe vmcall registers used in the vmcall

Definition at line 162 of file platform.c.

◆ platform_vmcall_event()

void platform_vmcall_event ( struct vmcall_registers_t regs)

VMCall Event

Parameters
regsthe vmcall registers used in the vmcall

Definition at line 168 of file platform.c.