Simple Virtual Machine A simple but flexible virtual machine

Functions
SVM processor return stack
SVM processors

This module contains API functions to handle SVM processor function return stack. More...

## Functions
SVM_FUNCTION SVM_Size | svm_processor_returnstack_get_size (const void *svm, const SVM_Kernel kernel)
| This function retrieves the return stack size of a processor. More...
SVM_FUNCTION void | svm_processor_returnstack_swap_level (const void *svm, const SVM_Kernel kernel, const SVM_Index level)
| This function swaps a state in the return stack of a processor with the current state of this processor. More...
SVM_FUNCTION SVM_Index | svm_processor_returnstack_find_flag (const void *svm, const SVM_Kernel kernel, const SVM_Value_String flag, const SVM_Index start)
| This function returns the level of the nearest frame having the flag raised within the return stack of a processor from a given level. More...
SVM_FUNCTION SVM_Index | svm_processor_returnstack_find_flag__string (const void *svm, const SVM_Kernel kernel, const SVM_String flag, const SVM_Index start)
| This function returns the level of the nearest frame having the flag raised within the return stack of a processor from a given level. More...
SVM_FUNCTION SVM_Index | svm_processor_returnstack_find_flag__raw (const void *svm, const SVM_Kernel kernel, const char *flag, const SVM_Index start)
| This function returns the level of the nearest frame having the flag raised within the return stack of a processor from a given level. More...
SVM_FUNCTION void | svm_processor_returnstack_move_level (const void *svm, const SVM_Kernel kernel, const SVM_Index start, const SVM_Index end, const SVM_Index target)
| This function moves a portion of the return stack to another level. More...

## Detailed Description

This module contains API functions to handle SVM processor function return stack.

## Function Documentation

## ◆ svm_processor_returnstack_find_flag()

SVM_FUNCTION SVM_Index svm_processor_returnstack_find_flag | ( | const void * | svm,
|  | const SVM_Kernel | kernel,
|  | const SVM_Value_String | flag,
|  | const SVM_Index | start
| ) |  |

This function returns the level of the nearest frame having the flag raised within the return stack of a processor from a given level.

Parameters

  [in] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | kernel | The kernel in which the targeted processor is.
  [in] | flag | The flag name to find.
  [in] | start | The level of the state to be swaped in the return stack.

The start has to be set between 0 and the return stack size. When the return stack size is provided, no search is done and the return stack size is immediately returned.

Returns
  Returns the first level when the flag is found. Returns the return stack size when not found.

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.
  PROCESSOR | interruption when the return stack does not contain enough levels.

See also
  svm_process_ownership_lock
  svm_kernel_get_current

## ◆ svm_processor_returnstack_find_flag__raw()

SVM_FUNCTION SVM_Index svm_processor_returnstack_find_flag__raw | ( | const void * | svm,
|  | const SVM_Kernel | kernel,
|  | const char * | flag,
|  | const SVM_Index | start
| ) |  |

This function returns the level of the nearest frame having the flag raised within the return stack of a processor from a given level.

Parameters

  [in] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | kernel | The kernel in which the targeted processor is.
  [in] | flag | The flag name to find.
  [in] | start | The level of the state to be swaped in the return stack.

The start has to be set between 0 and the return stack size. When the return stack size is provided, no search is done and the return stack size is immediately returned.

Returns
  Returns the first level when the flag is found. Returns the return stack size when not found.

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.
  PROCESSOR | interruption when the return stack does not contain enough levels.

See also
  svm_process_ownership_lock
  svm_kernel_get_current

## ◆ svm_processor_returnstack_find_flag__string()

SVM_FUNCTION SVM_Index svm_processor_returnstack_find_flag__string | ( | const void * | svm,
|  | const SVM_Kernel | kernel,
|  | const SVM_String | flag,
|  | const SVM_Index | start
| ) |  |

This function returns the level of the nearest frame having the flag raised within the return stack of a processor from a given level.

Parameters

  [in] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | kernel | The kernel in which the targeted processor is.
  [in] | flag | The flag name to find.
  [in] | start | The level of the state to be swaped in the return stack.

The start has to be set between 0 and the return stack size. When the return stack size is provided, no search is done and the return stack size is immediately returned.

Returns
  Returns the first level when the flag is found. Returns the return stack size when not found.

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.
  PROCESSOR | interruption when the return stack does not contain enough levels.

See also
  svm_process_ownership_lock
  svm_kernel_get_current

## ◆ svm_processor_returnstack_get_size()

SVM_FUNCTION SVM_Size svm_processor_returnstack_get_size | ( | const void * | svm,
|  | const SVM_Kernel | kernel
| ) |  |

This function retrieves the return stack size of a processor.

Parameters

  [in] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | kernel | The kernel in which the targeted processor is.

Returns
  The number of function returns the processor can do.

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.

See also
  svm_process_ownership_lock
  svm_kernel_get_current

## ◆ svm_processor_returnstack_move_level()

SVM_FUNCTION void svm_processor_returnstack_move_level | ( | const void * | svm,
|  | const SVM_Kernel | kernel,
|  | const SVM_Index | start,
|  | const SVM_Index | end,
|  | const SVM_Index | target
| ) |  |

This function moves a portion of the return stack to another level.

Parameters

  [in] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | kernel | The kernel in which the targeted processor is.
  [in] | start | The first return stack level to move.
  [in] | end | The first return stack level after the portion to move.
  [in] | target | The level where to move the portion of the return stack.

After the move, the first level of the moved is placed at the target.

Note
  The start and end levels can be between 0 and the return stack size included, and the start shall be inferior to the end.
  The target can be between 0 and the size of the stack minus the portion size, included.

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 start and end levels are inconsistent.
  PROCESSOR | interruption when the return stack does not contain enough levels.
  PROCESSOR | interruption when the move targets a level outside the return stack.

See also
  svm_process_ownership_lock
  svm_kernel_get_current

## ◆ svm_processor_returnstack_swap_level()

SVM_FUNCTION void svm_processor_returnstack_swap_level | ( | const void * | svm,
|  | const SVM_Kernel | kernel,
|  | const SVM_Index | level
| ) |  |

This function swaps a state in the return stack of a processor with the current state of this processor.

Parameters

  [in] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | kernel | The kernel in which the targeted processor is.
  [in] | level | The level of the state to be swaped in the return stack.

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.
  PROCESSOR | interruption when the return stack does not contain enough levels.

See also
  svm_process_ownership_lock
  svm_kernel_get_current