Simple Virtual Machine A simple but flexible virtual machine

Loading...
Searching...
No Matches
Functions
SVM memory operations
SVM memories

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

## 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | kernel | The kernel in which the targeted memory is.
  [in] | address | The local address to modify.
  [in] | shift | The shift value.

Exceptions

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption when the kernel is not owned by our process or is not in a process locked by ours.
  MEMORY | interruption when the address is not defined.
  MEMORY | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | kernel | The kernel in which the targeted memory is.
  [in] | address | The local address to modify.
  [in] | shift | The shift value.

Exceptions

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption when the kernel is not owned by our process or is not in a process locked by ours.
  MEMORY | interruption when the address is not defined.
  MEMORY | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | kernel | The kernel in which the origin memory is.
  [in] | origin | The origin memory zone to copy.
  [in] | remote | The kernel in which the destination memory is.
  [in] | target | The 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

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption when the kernel is not owned by our process or is not in a process locked by ours.
  FAILURE | interruption when the remote kernel is not owned by our process or is not in a process locked by ours.
  MEMORY | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | kernel | The kernel in which the origin memory is.
  [in] | origin | The origin memory zone to move.
  [in] | remote | The kernel in which the destination memory is.
  [in] | target | The 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

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption when the kernel is not owned by our process or is not in a process locked by ours.
  FAILURE | interruption when the remote kernel is not owned by our process or is not in a process locked by ours.
  MEMORY | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | kernel | The kernel in which the origin memory is.
  [in] | origin | The origin memory zone to share.
  [in] | remote | The kernel in which the destination memory is.
  [in] | target | The 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

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption when the kernel is not owned by our process or is not in a process locked by ours.
  FAILURE | interruption when the remote kernel is not owned by our process or is not in a process locked by ours.
  MEMORY | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | kernel | The kernel in which the memory is.
  [in] | zone | The memory zone where pointers are modified.
  [in] | origin | The origin memory zone targeted by pointers.
  [in] | target | The 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

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption when the kernel is not owned by our process or is not in a process locked by ours.
  MEMORY | interruption 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