kiba-engine
Functions
memory.c File Reference

Linux specific implementation of memory functionality. More...

#include <kiba/platform/memory.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for memory.c:

Go to the source code of this file.

Functions

void * platform_memory_allocate (usize size)
 Allocate memory. More...
 
void platform_memory_free (void *mem, usize size)
 Free memory. More...
 
void * platform_memory_set (void *mem, u8 byte, usize size)
 Set memory block to a specific byte value. More...
 
void * platform_memory_copy (void *dst, const void *src, usize size)
 Copy memory. More...
 

Detailed Description

Linux specific implementation of memory functionality.

Definition in file memory.c.

Function Documentation

◆ platform_memory_allocate()

void* platform_memory_allocate ( usize  size)

Allocate memory.

Uses platform specific implementation to allocate memory.

Parameters
sizenumber of bytes to be allocated
Returns
pointer to beginning of allocated block

Definition at line 11 of file memory.c.

◆ platform_memory_copy()

void* platform_memory_copy ( void *  dst,
const void *  src,
usize  size 
)

Copy memory.

Uses platform specific implementation to copy memory.

Parameters
dstpointer to beginning of the destination memory block
srcpointer to beginning of the source memory block
sizenumber of bytes to be copied
Returns
pointer to beginning of the destination block

Definition at line 20 of file memory.c.

◆ platform_memory_free()

void platform_memory_free ( void *  mem,
usize  size 
)

Free memory.

Uses platform specific implementation to free memory.

Parameters
mempointer to beginning of memory block
sizenumber of bytes to be freed

Definition at line 13 of file memory.c.

◆ platform_memory_set()

void* platform_memory_set ( void *  mem,
u8  byte,
usize  size 
)

Set memory block to a specific byte value.

Uses platform specific implementation to set memory.

Parameters
mempointer to beginning of memory block
bytethe value to set every byte to
sizenumber of bytes to be set
Returns
pointer to beginning of the provided block

Definition at line 18 of file memory.c.