Simple Virtual Machine
A simple but flexible virtual machine
|
This module contains API functions to handle SVM processor execution. More...
Functions | |
SVM_FUNCTION SVM_Code | svm_processor_get_currentcode (const void *svm, const SVM_Kernel kernel) |
This function extracts the SVM code actually executed by the processor. More... | |
SVM_FUNCTION SVM_Value_Symbol | svm_processor_get_nextinstruction (const void *svm, const SVM_Kernel kernel) |
This function retrieves the address of the next instruction a processor will execute. More... | |
SVM_FUNCTION SVM_Value_Symbol | svm_processor_get_currentinstruction (const void *svm, const SVM_Kernel kernel) |
This function retrieves the address of the current instruction a processor is executing. More... | |
SVM_FUNCTION void | svm_processor_jump_local (const void *svm, const SVM_Kernel kernel, const SVM_Address address) |
This function does a local jump on a processor. More... | |
SVM_FUNCTION void | svm_processor_jump_global (const void *svm, const SVM_Kernel kernel, const SVM_Value_Symbol symbol) |
This function does a global jump on a processor. More... | |
SVM_FUNCTION void | svm_processor_call_local (const void *svm, const SVM_Kernel kernel, const SVM_Address function, const SVM_Value_Pointer parameters) |
This function does a local SVM code function call on a processor. More... | |
SVM_FUNCTION void | svm_processor_call_global (const void *svm, const SVM_Kernel kernel, const SVM_Value_Symbol function, const SVM_Value_Pointer parameters) |
This function does a global SVM code function call on a processor. More... | |
SVM_FUNCTION void | svm_processor_call_identical (const void *svm, const SVM_Kernel kernel, const SVM_Boolean transfer) |
This function does an identical SVM code function call on a processor. More... | |
SVM_FUNCTION void | svm_processor_return (const void *svm, const SVM_Kernel kernel) |
This function does a SVM code function return on a processor. More... | |
SVM_FUNCTION void | svm_processor_current_shutdown (const void *svm) |
This function shuts down the processor of the current kernel. More... | |
SVM_FUNCTION void | svm_processor_current_sleep (const void *svm, const SVM_Value_Integer seconds, const SVM_Value_Integer milliseconds, const SVM_Boolean soft) |
This function stops the execution of the processor of the current kernel for a given time as integer values. More... | |
SVM_FUNCTION void | svm_processor_current_sleep__raw (const void *svm, const unsigned long int seconds, const unsigned long int milliseconds, const SVM_Boolean soft) |
This function stops the execution of the processor of the current kernel for a given time as raw integers. More... | |
This module contains API functions to handle SVM processor execution.
SVM_FUNCTION void svm_processor_call_global | ( | const void * | svm, |
const SVM_Kernel | kernel, | ||
const SVM_Value_Symbol | function, | ||
const SVM_Value_Pointer | parameters | ||
) |
This function does a global SVM code function call on a processor.
[in] | svm | The SVM pointer passed as first argument of the callback function. |
[in] | kernel | The kernel in which the targeted processor is. |
[in] | function | The address of the function to jump to. |
[in] | parameters | The memory pointer locating the function parameters. |
The current state of the processor is saved on the return stack, then the next instruction is set to the function address eventually outside the current SVM code executed by the processor, and the current memory pointer is set to the parameters location.
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. |
SVM_FUNCTION void svm_processor_call_identical | ( | const void * | svm, |
const SVM_Kernel | kernel, | ||
const SVM_Boolean | transfer | ||
) |
This function does an identical SVM code function call on a processor.
[in] | svm | The SVM pointer passed as first argument of the callback function. |
[in] | kernel | The kernel in which the targeted processor is. |
[in] | transfer | Indicates whether the local memory shall be transferred to the call. |
The current state of the processor is saved on the return stack. The memory already allocated in the current function can not be managed by the two calls: The memory can be managed by the current function call or transferred to the new function call. If the return stack is not modified, it is advised to set the transfer boolean to TRUE.
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. |
SVM_FUNCTION void svm_processor_call_local | ( | const void * | svm, |
const SVM_Kernel | kernel, | ||
const SVM_Address | function, | ||
const SVM_Value_Pointer | parameters | ||
) |
This function does a local SVM code function call on a processor.
[in] | svm | The SVM pointer passed as first argument of the callback function. |
[in] | kernel | The kernel in which the targeted processor is. |
[in] | function | The address of the function to jump to. |
[in] | parameters | The memory pointer locating the function parameters. |
The current state of the processor is saved on the return stack, then the next instruction is set to the function address inside the current SVM code executed by the processor, and the current memory pointer is set to the parameters location.
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. |
SVM_FUNCTION void svm_processor_current_shutdown | ( | const void * | svm | ) |
This function shuts down the processor of the current kernel.
[in] | svm | The SVM pointer passed as first argument of the callback function. |
FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.) |
SVM_FUNCTION void svm_processor_current_sleep | ( | const void * | svm, |
const SVM_Value_Integer | seconds, | ||
const SVM_Value_Integer | milliseconds, | ||
const SVM_Boolean | soft | ||
) |
This function stops the execution of the processor of the current kernel for a given time as integer values.
[in] | svm | The SVM pointer passed as first argument of the callback function. |
[in] | seconds | The number of seconds to wait. |
[in] | milliseconds | The number of extra milliseconds to wait. |
[in] | soft | The process is put in pause while waiting. |
This function put the process on hold for a given while.
FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.) |
FAILURE | interruption when a sleep is performed in protected mode outside a WAITING instruction. |
FAILURE | interruption when this API function is called outside a kernel. |
FAILURE | interruption when seconds or milliseconds are a negative integer. |
SVM_FUNCTION void svm_processor_current_sleep__raw | ( | const void * | svm, |
const unsigned long int | seconds, | ||
const unsigned long int | milliseconds, | ||
const SVM_Boolean | soft | ||
) |
This function stops the execution of the processor of the current kernel for a given time as raw integers.
[in] | svm | The SVM pointer passed as first argument of the callback function. |
[in] | seconds | The number of seconds to wait. |
[in] | milliseconds | The number of extra milliseconds to wait. |
[in] | soft | The process is put in pause while waiting. |
This function put the process on hold for a given while.
FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.) |
FAILURE | interruption when this API function is called outside a kernel. |
FAILURE | interruption when a sleep is performed in protected mode outside a WAITING instruction. |
SVM_FUNCTION SVM_Code svm_processor_get_currentcode | ( | const void * | svm, |
const SVM_Kernel | kernel | ||
) |
This function extracts the SVM code actually executed by the processor.
[in] | svm | The SVM pointer passed as first argument of the callback function. |
[in] | kernel | The kernel from which the code will be extracted. |
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. |
SVM_FUNCTION SVM_Value_Symbol svm_processor_get_currentinstruction | ( | const void * | svm, |
const SVM_Kernel | kernel | ||
) |
This function retrieves the address of the current instruction a processor is executing.
[in] | svm | The SVM pointer passed as first argument of the callback function. |
[in] | kernel | The kernel in which the targeted processor is. |
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. |
SVM_FUNCTION SVM_Value_Symbol svm_processor_get_nextinstruction | ( | const void * | svm, |
const SVM_Kernel | kernel | ||
) |
This function retrieves the address of the next instruction a processor will execute.
[in] | svm | The SVM pointer passed as first argument of the callback function. |
[in] | kernel | The kernel in which the targeted processor is. |
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. |
SVM_FUNCTION void svm_processor_jump_global | ( | const void * | svm, |
const SVM_Kernel | kernel, | ||
const SVM_Value_Symbol | symbol | ||
) |
This function does a global jump on a processor.
[in] | svm | The SVM pointer passed as first argument of the callback function. |
[in] | kernel | The kernel in which the targeted processor is. |
[in] | symbol | The address to jump to. |
The next instruction pointer of the processor is set to an address potentially outside the current SVM code.
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. |
SVM_FUNCTION void svm_processor_jump_local | ( | const void * | svm, |
const SVM_Kernel | kernel, | ||
const SVM_Address | address | ||
) |
This function does a local jump on a processor.
[in] | svm | The SVM pointer passed as first argument of the callback function. |
[in] | kernel | The kernel in which the targeted processor is. |
[in] | address | The address to jump to. |
The next instruction pointer of the processor is set to an address inside the current SVM code.
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. |
SVM_FUNCTION void svm_processor_return | ( | const void * | svm, |
const SVM_Kernel | kernel | ||
) |
This function does a SVM code function return on a processor.
[in] | svm | The SVM pointer passed as first argument of the callback function. |
[in] | kernel | The kernel in which the targeted processor is. |
The current state is replaced by the last pushed state on the return stack, the last pushed state is removed from the return stack, and the allocated memory associated to the destroyed state is deleted.
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 is empty. |