NVIDIA DRIVE OS Linux SDK API Reference

5.2.6 Release
For Test and Development only
TEE Internal Memory Management

Detailed Description

Describes TEE internal memory management.

Functions

void * TEE_Malloc (size_t size, uint32_t hint)
 This function allocates memory for use by the caller. More...
 
void TEE_Free (void *buffer)
 The TEE_Free function deallocates memory that was previously allocated with the TEE_Malloc() API. More...
 
void TEE_MemMove (void *dest, const void *src, uint32_t size)
 This function copies size bytes from a particular buffer denoted as source buffer to another buffer denoted as destination. More...
 
int32_t TEE_MemCompare (const void *buffer1, const void *buffer2, uint32_t size)
 This function compares the first size bytes of the buffer pointed to by buffer1 to the first size bytes of the buffer pointed to by buffer2. More...
 
void TEE_MemFill (void *buffer, uint32_t x, uint32_t size)
 The TEE_MemFill function writes the byte x (converted to a uint8_t) into the first size bytes of the object pointed to by buffer. More...
 

Function Documentation

◆ TEE_Free()

void TEE_Free ( void *  buffer)

The TEE_Free function deallocates memory that was previously allocated with the TEE_Malloc() API.

(QNX PDK Only) Error behavior: (1) If buffer is a NULL pointer, TEE_Free does nothing. (2) If the provided address is not currently allocated with TEE_Malloc() API, halt the system.

(QNX PDK Only) Side effects: one memory chunk will be returned to the pool if free succeeds.

Parameters
[in]bufferThe pointer to the memory buffer to be freed.

◆ TEE_Malloc()

void* TEE_Malloc ( size_t  size,
uint32_t  hint 
)

This function allocates memory for use by the caller.

(QNX PDK only) Error behavior: (1) If input hint is not a valid memory type, halt the system (2) All other errors return an nullptr.

(QNX PDK Only) Side effects: one memory 256-Byte chunk will be marked as allocated if the allocation succeeds.

Parameters
[in]sizeSize of memory chunk required. Unit: Byte. (QNX PDK Only) Valid range: positive number <= 256.
[in]hintSpecifies the memory type. Valid values:
(1) TEE_ALLOC_HEAP_MEM for normal memory; (2) TEE_ALLOC_DEVICE_MEM for non-speculative memory; (3) TEE_ALLOC_TZSYSRAM_MEM for TZSysRAM memory (QNX PDK only)
Returns
returns a pointer to the allocated space on Success, nullptr, if the space cannot be allocated or parameters are invalid.

◆ TEE_MemCompare()

int32_t TEE_MemCompare ( const void *  buffer1,
const void *  buffer2,
uint32_t  size 
)

This function compares the first size bytes of the buffer pointed to by buffer1 to the first size bytes of the buffer pointed to by buffer2.

(QNX PDK Only) Error behavior: (1) if either buffer parameter is null, halt the system.

(QNX PDK Only) Side effects: N/A

Parameters
[in]buffer1A pointer to the first buffer.
[in]buffer2A pointer to the second buffer.
[in]sizeThe number of bytes to be compared.
Returns
The sign of a non-zero return value is determined by the sign of the difference between the values of the first pair of bytes (both interpreted as type uint8_t) that differ in the objects being compared.
  1. If the first byte that differs is higher in buffer1, then return an integer greater than zero.
  2. If the first size bytes of the two buffers are identical, then return zero.
  3. If the first byte that differs is higher in buffer2, then return an integer lower than zero.
  4. (Linux PDK Only) If either buffer parameter is null, then return '-1'

◆ TEE_MemFill()

void TEE_MemFill ( void *  buffer,
uint32_t  x,
uint32_t  size 
)

The TEE_MemFill function writes the byte x (converted to a uint8_t) into the first size bytes of the object pointed to by buffer.

(QNX PDK Only) Error behavior: (1) if input buffer is nullptr, halt the system. (2) if input arguments (buffer + size) result in an integer overflow, halt the system. (3) if parameter x is outside of the supported range, halt the system.

(QNX PDK Only) Side effects: N/A

Parameters
[out]bufferA pointer to the destination buffer.
[in]xThe value to be set. Valid Range (QNX PDK Only): 0 through 255
[in]sizeThe number of bytes to be set.

◆ TEE_MemMove()

void TEE_MemMove ( void *  dest,
const void *  src,
uint32_t  size 
)

This function copies size bytes from a particular buffer denoted as source buffer to another buffer denoted as destination.

If the source and destination buffer overlap, the API will ensure that the the final destination buffer contents match the contents of the original source buffer.

(QNX PDK Only) Error behavior: (1) if the source or destination buffers are null, halt the system (2) if input arguments (buffer + size) result in an integer overflow, halt the system. (3) if the source address has been allocated with TEE_ALLOC_DEVICE_MEM and the destination address has not been allocated with either TEE_ALLOC_DEVICE_MEM or TEE_ALLOC_TZSYSRAM_MEM, the system will halt. (4) if the source address has been allocated with TEE_ALLOC_TZSYSRAM_MEM and the destination address has not been allocated with either TEE_ALLOC_DEVICE_MEM or TEE_ALLOC_TZSYSRAM_MEM, the system will halt.

(QNX PDK Only) Side effects: N/A

Parameters
[in]srcA pointer to the source buffer.
[out]destA pointer to the destination buffer,
[in]sizeThe number of bytes to be copied.