Simple Virtual Machine
A simple but flexible virtual machine
SVM memory operations

This module contains API functions to handle SVM memory operations. More...

Functions

SVM_FUNCTION void svm_memory_copy (const void *svm, const SVM_Kernel kernel, const SVM_Value_Pointer origin, const SVM_Kernel remote, const SVM_Value_Pointer target)
 This function copies a memory zone to another. More...
 
SVM_FUNCTION void svm_memory_move (const void *svm, const SVM_Kernel kernel, const SVM_Value_Pointer origin, const SVM_Kernel remote, const SVM_Value_Pointer target)
 This function moves a memory zone to another. More...
 
SVM_FUNCTION void svm_memory_share (const void *svm, const SVM_Kernel kernel, const SVM_Value_Pointer origin, const SVM_Kernel remote, const SVM_Value_Pointer target)
 This function shares a memory zone to another. More...
 
SVM_FUNCTION void svm_memory_translate (const void *svm, const SVM_Kernel kernel, const SVM_Value_Pointer zone, const SVM_Value_Pointer origin, const SVM_Value_Pointer target)
 This function translates pointers within a memory zone. More...
 
SVM_FUNCTION void svm_memory_address_shift (const void *svm, const SVM_Kernel kernel, const SVM_Address address, const SVM_Value_Integer shift)
 This function increases or decreases an integer in a memory by an integer value. More...
 
SVM_FUNCTION void svm_memory_address_shift__raw (const void *svm, const SVM_Kernel kernel, const SVM_Address address, signed long int shift)
 This function increases or decreases an integer in a memory by a raw integer. More...
 

Detailed Description

This module contains API functions to handle SVM memory operations.

Function Documentation

◆ svm_memory_address_shift()

SVM_FUNCTION void svm_memory_address_shift ( const void *  svm,
const SVM_Kernel  kernel,
const SVM_Address  address,
const SVM_Value_Integer  shift 
)

This function increases or decreases an integer in a memory by an integer value.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]kernelThe kernel in which the targeted memory is.
[in]addressThe local address to modify.
[in]shiftThe shift value.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the kernel is not owned by our process or is not in a process locked by ours.
MEMORYinterruption when the address is not defined.
MEMORYinterruption when the type of the address is not INTEGER.
See also
svm_memory_address_is_defined
svm_memory_address_get_type
svm_process_ownership_lock
svm_kernel_get_current

◆ svm_memory_address_shift__raw()

SVM_FUNCTION void svm_memory_address_shift__raw ( const void *  svm,
const SVM_Kernel  kernel,
const SVM_Address  address,
signed long int  shift 
)

This function increases or decreases an integer in a memory by a raw integer.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]kernelThe kernel in which the targeted memory is.
[in]addressThe local address to modify.
[in]shiftThe shift value.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the kernel is not owned by our process or is not in a process locked by ours.
MEMORYinterruption when the address is not defined.
MEMORYinterruption when the type of the address is not INTEGER.
See also
svm_memory_address_is_defined
svm_memory_address_get_type
svm_process_ownership_lock
svm_kernel_get_current

◆ svm_memory_copy()

SVM_FUNCTION void svm_memory_copy ( const void *  svm,
const SVM_Kernel  kernel,
const SVM_Value_Pointer  origin,
const SVM_Kernel  remote,
const SVM_Value_Pointer  target 
)

This function copies a memory zone to another.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]kernelThe kernel in which the origin memory is.
[in]originThe origin memory zone to copy.
[in]remoteThe kernel in which the destination memory is.
[in]targetThe target memory zone.

The two kernels can be equal.

Pointers indicating a sub-part of the zone are updated to reflect the new location.

Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the kernel is not owned by our process or is not in a process locked by ours.
FAILUREinterruption when the remote kernel is not owned by our process or is not in a process locked by ours.
MEMORYinterruption when the two memory zones are incompatibles.
See also
svm_process_ownership_lock
svm_kernel_get_current

◆ svm_memory_move()

SVM_FUNCTION void svm_memory_move ( const void *  svm,
const SVM_Kernel  kernel,
const SVM_Value_Pointer  origin,
const SVM_Kernel  remote,
const SVM_Value_Pointer  target 
)

This function moves a memory zone to another.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]kernelThe kernel in which the origin memory is.
[in]originThe origin memory zone to move.
[in]remoteThe kernel in which the destination memory is.
[in]targetThe target memory zone.

The two kernels can be equal.

After the move, the original zone is left non-initialised. Pointers indicating a sub-part of the zone are updated to reflect the new location.

Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the kernel is not owned by our process or is not in a process locked by ours.
FAILUREinterruption when the remote kernel is not owned by our process or is not in a process locked by ours.
MEMORYinterruption when the two memory zones are incompatibles.
See also
svm_process_ownership_lock
svm_kernel_get_current

◆ svm_memory_share()

SVM_FUNCTION void svm_memory_share ( const void *  svm,
const SVM_Kernel  kernel,
const SVM_Value_Pointer  origin,
const SVM_Kernel  remote,
const SVM_Value_Pointer  target 
)

This function shares a memory zone to another.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]kernelThe kernel in which the origin memory is.
[in]originThe origin memory zone to share.
[in]remoteThe kernel in which the destination memory is.
[in]targetThe target memory zone.

The two kernels can be equal.

If the two kernels are different, the synchronisation is enabled on the shared memory.

After the share, any change to one memory zone will be automatically reflected to the other one.

Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the kernel is not owned by our process or is not in a process locked by ours.
FAILUREinterruption when the remote kernel is not owned by our process or is not in a process locked by ours.
MEMORYinterruption when the two memory zones are incompatibles.
See also
svm_process_ownership_lock
svm_kernel_get_current
svm_memory_synchronisation_enable
svm_memory_synchronisation_disable

◆ svm_memory_translate()

SVM_FUNCTION void svm_memory_translate ( const void *  svm,
const SVM_Kernel  kernel,
const SVM_Value_Pointer  zone,
const SVM_Value_Pointer  origin,
const SVM_Value_Pointer  target 
)

This function translates pointers within a memory zone.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]kernelThe kernel in which the memory is.
[in]zoneThe memory zone where pointers are modified.
[in]originThe origin memory zone targeted by pointers.
[in]targetThe target memory zone in which pointers shall reference.

Only non-null pointers are modified within the memory zone. Other values are ignored. All addresses shall be defined within the memory zone.

When a pointer is read and is pointing towards the origin memory zone, its address is changed to the same offset within the target memory zone. If the pointer destination exceeds the origin and target zones, the pointer is not modified.

Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the kernel is not owned by our process or is not in a process locked by ours.
MEMORYinterruption when a wrong memory access is performed.
See also
svm_process_ownership_lock
svm_kernel_get_current
svm_memory_copy
svm_memory_move
svm_memory_share