Simple Virtual Machine A simple but flexible virtual machine

Data Structures | Enumerations | Variables
SVM API types

This module contains all types used by API functions. More...

## Data Structures
struct | SVM_String
struct | SVM_Comparison_Result
struct | SVM_Status_Boolean

## Enumerations
enum | SVM_Boolean { FALSE = 0 , TRUE = 1 }
| This type corresponds to a simple boolean. More...
enum | SVM_Type_Internal { AUTOMATIC , INTEGER , STRING , BOOLEAN , POINTER , LIBRARY , SYMBOL , PLUGIN_ENTRY_POINT , INTERRUPTION }
| This type corresponds to value types the SVM can store in its memory. More...
enum | SVM_Interruption_Internal { CLONE , DEVICE , FAILURE , FIRST , MEMORY , NUMERIC , PROCESSOR , SECOND , SECURITY , TERMINATE , TERMINAL , GENERIC }
| This type corresponds to interruption types the SVM can use to stop program executions. More...
enum | SVM_Interruption_Kind { SOFTWARE , HARDWARE }
| This type represents the two major classes of interruptions the SVM can handle. More...
enum | SVM_Notification_Type { NOTIFICATION , TIMER }
| This type represents the reason that triggered a callback call to a specific scheduler function. More...
enum | SVM_Process_State { RUNNING , SUSPENDED , WAITING , CONTINUE , LOCKED , DEBUG , ZOMBIE , INTERRUPTED , ERROR }
| This type represents the status of a process. More...
enum | SVM_Object_Level { LOCAL , CASCADE , GLOBAL }
| This type corresponds to the level of definition of an object. More...
enum | SVM_Value_Plugin_Comparison { EQUIVALENCE_EQUAL = 0x0 , EQUIVALENCE_DIFFERENT = 0x3 , ORDER_EQUAL = 0x4 , ORDER_INFERIOR = 0x5 , ORDER_SUPERIOR = 0x6 , ORDER_UNCOMPARABLE = 0x7 , ORDER_TOTAL = 0x0 , ORDER_PARTIAL = 0x8 , COMPARISON_STRONG = 0x0 , COMPARISON_WEAK = 0x10 }
| This type corresponds to the result of SVM_Value_Plugin comparison. More...

## Variables
SVM_TYPE typedef const void * | SVM_Variable
| This type is used to represent any object managed by the SVM. More...
SVM_TYPE typedef const void * | SVM_Parameter
| This type is used by the SVM to pass instruction parameters to the corresponding plugin function. More...
SVM_TYPE typedef const void * | SVM_Structure
| This type is used to convey a C pointer used for data exchange between plugins. More...
SVM_TYPE typedef const void * | SVM_AccessControl
| This type is used to represent quotas on code execution. More...
SVM_TYPE typedef const void * | SVM_Memory_Zone
| This type is used to represent the types of a contiguous zone of memory prior to its allocation. More...
SVM_TYPE typedef const void * | SVM_Lock
| This type is used as a simple synchronisation facility. More...
SVM_TYPE typedef const void * | SVM_LockGuard_Read
| This type is used to represent the aquisition of a SVM_Lock as a reader. More...
SVM_TYPE typedef const void * | SVM_LockGuard_Write
| This type is used to represent the aquisition of a SVM_Lock as a writer. More...
SVM_TYPE typedef const void * | SVM_Event_Queue
| This type is used as a complex synchronisation facility. More...
SVM_TYPE typedef const void * | SVM_Event_Queue_Address
| This type is used to represent an entity able to post and get events from an event queue. More...
SVM_TYPE typedef unsigned long int | SVM_Address
| This type is used to represent: More...
SVM_TYPE typedef unsigned long int | SVM_Index
| This type is used to represent an index. More...
SVM_TYPE typedef unsigned long int | SVM_Size
| This type is used to represent an object size. More...
SVM_TYPE typedef const void * | SVM_Code
| This type is used to represent a section of code of the SVM. More...
SVM_TYPE typedef const void * | SVM_Kernel
| This type is used to represent an atomic execution environment. More...
SVM_TYPE typedef const void * | SVM_Process
| This type is used to represent an execution thread in the SVM. More...
SVM_TYPE typedef const void * | SVM_Process_Lock
| This type is used to represent the aquisition of a lock on a remote process. More...
SVM_TYPE typedef const void * | SVM_Scheduler
| This type is used to represent an execution scheduler. More...
SVM_TYPE typedef const void * | SVM_Debug_Form
| This type is used to represent the a formular in the debugger user interface. More...
SVM_TYPE typedef SVM_Process_State | SVM_Kernel_State
| This type represents the status of a kernel. More...
SVM_TYPE typedef const void * | SVM_Type
| This type is used to represent types of any value the SVM can store in one of its memories. More...
SVM_TYPE typedef const void * | SVM_Value
| This type is used to represent any value the SVM can store in one of its memories. More...
SVM_TYPE typedef const void * | SVM_Value_Integer
| This type is used to represent an integer the SVM can store in one of its memories. More...
SVM_TYPE typedef const void * | SVM_Value_String
| This type is used to represent a string the SVM can store in one of its memories. More...
SVM_TYPE typedef const void * | SVM_Value_Boolean
| This type is used to represent a boolean the SVM can store in one of its memories. More...
SVM_TYPE typedef const void * | SVM_Value_Pointer
| This type is used to represent a pointer the SVM can store in one of its memories. More...
SVM_TYPE typedef const void * | SVM_Value_Library
| This type is used to represent a library the SVM can store in one of its memories. More...
SVM_TYPE typedef const void * | SVM_Value_Symbol
| This type is used to represent a symbol the SVM can store in one of its memories. More...
SVM_TYPE typedef const void * | SVM_Value_PluginEntryPoint
| This type is used to represent a plugin entry point the SVM can store in one of its memories. More...
SVM_TYPE typedef const void * | SVM_Value_Interruption
| This type is used to represent an interruption name the SVM can store in one of its memories. More...
SVM_TYPE typedef const void * | SVM_Value_Plugin
| This type is used to represent a value defined by a plugin the SVM can store in one of its memories. More...
SVM_TYPE typedef const void * | SVM_Value_Automatic
| This type is used to represent a null automatic value. More...

## Detailed Description

This module contains all types used by API functions.

Some are only enumeration constants used in various ways, like named booleans or SVM elements states or types.

One is a buffer containers to give a access to non-nul terminated strings, sometimes useful while conveying binary data over virtual machine strings.

The others ones are all typedefs on:

const void *

These are various variable types:

- A parameter with SVM_Variable type can accept a variable of any other type,
- A parameter with SVM_Value type can accept a variable of any type starting with SVM_Value_ prefix.

See also
  SVM variables

## Enumeration Type Documentation

## ◆ SVM_Boolean

enum SVM_Boolean

This type corresponds to a simple boolean.

This boolean is compatible with C ones.

Enumerator
FALSE | self-explained
TRUE | self-explained

## ◆ SVM_Interruption_Internal

enum SVM_Interruption_Internal

This type corresponds to interruption types the SVM can use to stop program executions.

Enumerator
CLONE | raised on SIGCHLD
DEVICE | raised on SIGPIPE, SIGBUS
FAILURE | raised on SIGABRT, SIGQUIT or generic failure in instruction
FIRST | raised on SIGUSR1
MEMORY | raised on memory access failure
NUMERIC | raised on SIGFPE
PROCESSOR | raised on SIGILL or processor invalid action
SECOND | raised on SIGUSR2
SECURITY | raised on security violation or quota overflow
TERMINATE | raised on SIGTERM, SIGINT, SIGHUP, SIGALRM
TERMINAL | raised on SIGTTIN, SIGTTOU, SIGWINCH
GENERIC | raised on all other signals

## ◆ SVM_Interruption_Kind

enum SVM_Interruption_Kind

This type represents the two major classes of interruptions the SVM can handle.

Enumerator
SOFTWARE | the class of interruptions coming from instructions and execution errors
HARDWARE | the class of interruptions coming from the OS signals

## ◆ SVM_Notification_Type

enum SVM_Notification_Type

This type represents the reason that triggered a callback call to a specific scheduler function.

(See scheduler API functions below for more details.)

Enumerator
NOTIFICATION | the callback has been triggered manually by the plugin developper
TIMER | the callback has been triggered after a timer expiration

## ◆ SVM_Object_Level

enum SVM_Object_Level

This type corresponds to the level of definition of an object.

Enumerator
LOCAL | the object is located in the current state of the processor
CASCADE | the object is located in the current state and all sub states of the processor
GLOBAL | the object is located in the processor

## ◆ SVM_Process_State

enum SVM_Process_State

This type represents the status of a process.

Enumerator
RUNNING | the process lets the processor of the current kernel executing instructions
SUSPENDED | the process is in a light sleep, and can return in running mode anytime
WAITING | the process is blocked in a state in which it may not answer to scheduler requests
CONTINUE | the process is blocked in a state in which it will only accept an execution request
LOCKED | the process is temporarly owned by someone and can not return in running mode
DEBUG | the process is blocked in a state it answers only to the debugger
ZOMBIE | the process has completed its execution and is not destroyed yet
INTERRUPTED | the process has completed its execution on a non-handled interruption
ERROR | the process reached an invalid state

## ◆ SVM_Type_Internal

enum SVM_Type_Internal

This type corresponds to value types the SVM can store in its memory.

The last one represents the class of types the plugin developpers can define in theirs plugins.

Enumerator
AUTOMATIC | generic type to be replaced at first assignation
INTEGER | integer type corresponding to long long int
STRING | string type corresponding to SVM_String
BOOLEAN | boolean type corresponding to SVM_Boolean
POINTER | pointer type used to target memory zones
LIBRARY | library type corresponding to SVM_Code
SYMBOL | symbol type used to target code location
PLUGIN_ENTRY_POINT | plugin entry point type used to identify a plugin object
INTERRUPTION | interruption type corresponds to processor interruptions

## ◆ SVM_Value_Plugin_Comparison

enum SVM_Value_Plugin_Comparison

This type corresponds to the result of SVM_Value_Plugin comparison.

It can be used by plugin value comparison callbacks as explicit return value.

Enumerator
EQUIVALENCE_EQUAL | Used to specify that values are equal.
EQUIVALENCE_DIFFERENT | Used to specify that values are different.
ORDER_EQUAL | Used to specify that values are equal.
ORDER_INFERIOR | Used to specify that left value is inferior to right value.
ORDER_SUPERIOR | Used to specify that left value is superior to right value.
ORDER_UNCOMPARABLE | Used to specify that left value and the right value can not be compared.
ORDER_TOTAL | Used to specify that the order is total (unused when an equivalence is used)
ORDER_PARTIAL | Used to specify that the order is partial (unused when an equivalence is used, set automatically when ORDER_UNCOMPARABLE is used)
COMPARISON_STRONG | Used to specify that the real comparison has been computed.
COMPARISON_WEAK | Used to specify that an heuristic or arbitrary comparison has been computed.

## Variable Documentation

## ◆ SVM_AccessControl

SVM_AccessControl

This type is used to represent quotas on code execution.

See also
  SVM variables

## ◆ SVM_Address

SVM_Address

This type is used to represent:

- either a local code address,
- or a memory address.

## ◆ SVM_Code

SVM_Code

This type is used to represent a section of code of the SVM.

It consists in:

- a name for debugging purpose,
- a list of instructions,
- a local anchor mapping (built from :label instructions),
- a global anchor mapping (built from :symbol instructions).

See also
  SVM variables

## ◆ SVM_Debug_Form

SVM_Debug_Form

This type is used to represent the a formular in the debugger user interface.

See also
  SVM variables

## ◆ SVM_Event_Queue

SVM_Event_Queue

This type is used as a complex synchronisation facility.

It allows synchronisation of several clients through event exchange.

See also
  SVM variables

## ◆ SVM_Event_Queue_Address

SVM_Event_Queue_Address

This type is used to represent an entity able to post and get events from an event queue.

See also
  SVM variables

## ◆ SVM_Index

SVM_Index

This type is used to represent an index.

## ◆ SVM_Kernel

SVM_Kernel

This type is used to represent an atomic execution environment.

It consists in:

- a state,
- a processor,
- a memory.

In this API, functions managing processors and memories access them through the kernel holding them.

See also
  SVM variables

## ◆ SVM_Kernel_State

SVM_Kernel_State

This type represents the status of a kernel.

## ◆ SVM_Lock

SVM_Lock

This type is used as a simple synchronisation facility.

This lock mutually excludes a unique writter against several concurrent readers.

See also
  SVM variables

## ◆ SVM_LockGuard_Read

SVM_LockGuard_Read

This type is used to represent the aquisition of a SVM_Lock as a reader.

See also
  SVM variables

## ◆ SVM_LockGuard_Write

SVM_LockGuard_Write

This type is used to represent the aquisition of a SVM_Lock as a writer.

See also
  SVM variables

## ◆ SVM_Memory_Zone

SVM_Memory_Zone

This type is used to represent the types of a contiguous zone of memory prior to its allocation.

See also
  SVM variables

## ◆ SVM_Parameter

SVM_Parameter

This type is used by the SVM to pass instruction parameters to the corresponding plugin function.

It is also used to pass parameters to plugin function calls.

See also
  SVM variables

## ◆ SVM_Process

SVM_Process

This type is used to represent an execution thread in the SVM.

It consists in:

- a name for debugging purpose,
- a state,
- a sequencer deciding in which order the kernels are executed,
- a list of kernels.

In this API:

- functions managing the sequencer access it through the process holding it,
- functions managing a process will check whether the process can be safely managed:
  - the action is done on the current process,
  - the action is done on another process: in such case, the process has to be locked by the current one,
  - for few functions, this lock is not needed even on other processes, and this will be mentionned in the help of these functions.

See also
  SVM variables

## ◆ SVM_Process_Lock

SVM_Process_Lock

This type is used to represent the aquisition of a lock on a remote process.

See also
  SVM variables

## ◆ SVM_Scheduler

SVM_Scheduler

This type is used to represent an execution scheduler.

A scheduler is a process execution orchestrator.

See also
  SVM variables

## ◆ SVM_Size

SVM_Size

This type is used to represent an object size.

## ◆ SVM_Structure

SVM_Structure

This type is used to convey a C pointer used for data exchange between plugins.

See also
  SVM variables

## ◆ SVM_Type

SVM_Type

This type is used to represent types of any value the SVM can store in one of its memories.

See also
  SVM_Value

## ◆ SVM_Value

SVM_Value

This type is used to represent any value the SVM can store in one of its memories.

This type is not equivalent to the automatic type. It just means the type of the value will not be considered from this variable.

See also
  SVM variables

## ◆ SVM_Value_Automatic

SVM_Value_Automatic

This type is used to represent a null automatic value.

This type has no corresponding type in C.

See also
  SVM variables

## ◆ SVM_Value_Boolean

SVM_Value_Boolean

This type is used to represent a boolean the SVM can store in one of its memories.

The corresponding C type is SVM_Boolean.

See also
  SVM variables

## ◆ SVM_Value_Integer

SVM_Value_Integer

This type is used to represent an integer the SVM can store in one of its memories.

The corresponding C type is long long int.

See also
  SVM variables

## ◆ SVM_Value_Interruption

SVM_Value_Interruption

This type is used to represent an interruption name the SVM can store in one of its memories.

This type has no corresponding type in C, as it is made of:

- an internal interruption type,
- a plugin entry point for interruptions defined by plugins.

An interruption name can be used to alter the program behavior in case of interruption, or can be used to interrupt a program, raising an event or an error.

See also
  SVM variables

## ◆ SVM_Value_Library

SVM_Value_Library

This type is used to represent a library the SVM can store in one of its memories.

This type has no corresponding type in C, as it is made of an SVM_Code instance.

See also
  SVM variables

## ◆ SVM_Value_Plugin

SVM_Value_Plugin

This type is used to represent a value defined by a plugin the SVM can store in one of its memories.

This type has no corresponding type in C, as it is made of:

- a plugin entry point describing the type of the value,
- a void* pointer managed by plugin callbacks.

See also
  SVM variables

## ◆ SVM_Value_PluginEntryPoint

SVM_Value_PluginEntryPoint

This type is used to represent a plugin entry point the SVM can store in one of its memories.

This type has no corresponding type in C, as it is made of:

- a plugin name,
- an entry name in this plugin.

A plugin entry point can be used to reference an object in a plugin.

See also
  SVM variables

## ◆ SVM_Value_Pointer

SVM_Value_Pointer

This type is used to represent a pointer the SVM can store in one of its memories.

This type has no corresponding type in C, as it is made of:

- a memory address,
- a size.

A pointer can then represent a zone in memory.

See also
  SVM variables

## ◆ SVM_Value_String

SVM_Value_String

This type is used to represent a string the SVM can store in one of its memories.

The corresponding C type is SVM_String or C-nul terminated strings.

See also
  SVM variables

## ◆ SVM_Value_Symbol

SVM_Value_Symbol

This type is used to represent a symbol the SVM can store in one of its memories.

This type has no corresponding type in C, as it is made of:

- an SVM_Code instance,
- a local address.

A symbol can be used in jumps or functions calls.

See also
  SVM variables

## ◆ SVM_Variable

SVM_Variable

This type is used to represent any object managed by the SVM.

See also
  SVM variables