This header contains all needed functions to alter the virtual machine from plugins written for it.

These plugins allow users to improve the architecture of the machine by defining their own\+:
\begin{DoxyItemize}
\item instructions\+: allows extension of the SVM processors instruction set,
\item memory types\+: allows extension of the SVM memory storage capacity,
\item interruptions\+: allows dedicated interruptions of a processor,
\item sequencers\+: allows extension of the sequencing of kernels with processes,
\item schedulers\+: allows extension of the orchestration of processes within the virtual machine,
\item functions\+: allows inter plugin communication by acting like private instructions,
\item structures\+: also allows inter plugin communication by acting like private types.
\end{DoxyItemize}

Such objects are defined by a (rather long) string describing each of them and their dependencies on other plugin objects by a call to the svm\+\_\+plugin\+\_\+configure API special function.

Associated to each object and to give them life, some particular plugin callback functions have to be defined\+:
\begin{DoxyItemize}
\item For instructions\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{group__api__types_gaf37a7c40972a9dabfa18b14127c34fb1}{SVM\_Value}} instruction\_<instruction name>(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *svm, \mbox{\hyperlink{group__api__types_gaab347fe7005c87722bd7d80cfe94333c}{SVM\_Size}} argc, \mbox{\hyperlink{group__api__types_gab05a82304ba262cf3ae97b0c5f8ab707}{SVM\_Parameter}} argv[]); \textcolor{comment}{// mandatory}}

\end{DoxyCode}

\item For types\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordtype}{void} type\_<type name>\_delete(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *svm, \textcolor{keywordtype}{void} *handler); \textcolor{comment}{// mandatory}}
\DoxyCodeLine{\textcolor{keywordtype}{void}* type\_<type name>\_copy(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *svm, \textcolor{keyword}{const} \textcolor{keywordtype}{void} *handler); \textcolor{comment}{// optional}}
\DoxyCodeLine{\textcolor{keywordtype}{void}* type\_<type name>\_constant(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *svm, \textcolor{keyword}{const} \mbox{\hyperlink{struct_s_v_m___string}{SVM\_String}} value); \textcolor{comment}{// optional}}
\DoxyCodeLine{\mbox{\hyperlink{struct_s_v_m___string}{SVM\_String}} type\_<type name>\_print(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *svm, \textcolor{keyword}{const} \textcolor{keywordtype}{void} *handler); \textcolor{comment}{// optional}}

\end{DoxyCode}

\item For interruptions\+: No plugin callback to be defined.
\item For sequencers\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordtype}{void}* sequencer\_<sequencer name>\_create(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *svm); \textcolor{comment}{// mandatory}}
\DoxyCodeLine{\textcolor{keywordtype}{void} sequencer\_<sequencer name>\_delete(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *svm, \textcolor{keyword}{const} \textcolor{keywordtype}{void} *handler); \textcolor{comment}{// mandatory}}
\DoxyCodeLine{\mbox{\hyperlink{group__api__types_ga19af2c6060f3ae282ea4e73121fac69c}{SVM\_Kernel}} sequencer\_<sequencer name>\_current(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *svm, \textcolor{keyword}{const} \textcolor{keywordtype}{void} *handler); \textcolor{comment}{// mandatory}}
\DoxyCodeLine{\mbox{\hyperlink{group__api__types_ga872facc2eea0e7296e689134f568b804}{SVM\_Boolean}} sequencer\_<sequencer name>\_attach(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *svm, \textcolor{keyword}{const} \textcolor{keywordtype}{void} *handler, \mbox{\hyperlink{group__api__types_ga19af2c6060f3ae282ea4e73121fac69c}{SVM\_Kernel}} kernel, \mbox{\hyperlink{group__api__types_gaab347fe7005c87722bd7d80cfe94333c}{SVM\_Size}} argc, \mbox{\hyperlink{group__api__types_gab05a82304ba262cf3ae97b0c5f8ab707}{SVM\_Parameter}} argv[]); \textcolor{comment}{// mandatory}}
\DoxyCodeLine{\mbox{\hyperlink{group__api__types_ga872facc2eea0e7296e689134f568b804}{SVM\_Boolean}} sequencer\_<sequencer name>\_detach(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *svm, \textcolor{keyword}{const} \textcolor{keywordtype}{void} *handler, \mbox{\hyperlink{group__api__types_ga19af2c6060f3ae282ea4e73121fac69c}{SVM\_Kernel}} kernel, \mbox{\hyperlink{group__api__types_gaab347fe7005c87722bd7d80cfe94333c}{SVM\_Size}} argc, \mbox{\hyperlink{group__api__types_gab05a82304ba262cf3ae97b0c5f8ab707}{SVM\_Parameter}} argv[]); \textcolor{comment}{// mandatory}}
\DoxyCodeLine{\mbox{\hyperlink{struct_s_v_m___string}{SVM\_String}} sequencer\_<sequencer name>\_print(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *svm, \textcolor{keyword}{const} \textcolor{keywordtype}{void} *handler); \textcolor{comment}{// mandatory}}

\end{DoxyCode}

\item For schedulers\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordtype}{void}* scheduler\_<scheduler name>\_create(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *svm); \textcolor{comment}{// mandatory}}
\DoxyCodeLine{\textcolor{keywordtype}{void} scheduler\_<scheduler name>\_delete(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *svm, \textcolor{keyword}{const} \textcolor{keywordtype}{void} *handler); \textcolor{comment}{// mandatory}}
\DoxyCodeLine{\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} \textcolor{keywordtype}{int} scheduler\_<scheduler name>\_schedule(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *svm, \textcolor{keyword}{const} \textcolor{keywordtype}{void} *handler, \textcolor{keyword}{const} \mbox{\hyperlink{group__api__types_gabbfa54994e431fe68d4f6580c112e1a0}{SVM\_Process}} process, \textcolor{keyword}{const} \mbox{\hyperlink{group__api__types_ga2686a7f08a5ada4b6ae5f59342b4047a}{SVM\_Process\_State}} state); \textcolor{comment}{// mandatory}}
\DoxyCodeLine{\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} \textcolor{keywordtype}{int} scheduler\_<scheduler name>\_notification(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *svm, \textcolor{keyword}{const} \textcolor{keywordtype}{void} *handler, \textcolor{keyword}{const} \mbox{\hyperlink{group__api__types_gacc0b261354e68dbc9b6168e9c1026055}{SVM\_Notification\_Type}} type, \textcolor{keyword}{const} \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} \textcolor{keywordtype}{int} parameter); \textcolor{comment}{// optional}}
\DoxyCodeLine{\mbox{\hyperlink{group__api__types_ga872facc2eea0e7296e689134f568b804}{SVM\_Boolean}} scheduler\_<scheduler name>\_attach(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *svm, \textcolor{keyword}{const} \textcolor{keywordtype}{void} *handler, \textcolor{keyword}{const} \mbox{\hyperlink{group__api__types_gabbfa54994e431fe68d4f6580c112e1a0}{SVM\_Process}} process, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} \textcolor{keywordtype}{int} parameter); \textcolor{comment}{// mandatory}}
\DoxyCodeLine{\mbox{\hyperlink{group__api__types_ga872facc2eea0e7296e689134f568b804}{SVM\_Boolean}} scheduler\_<scheduler name>\_detach(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *svm, \textcolor{keyword}{const} \textcolor{keywordtype}{void} *handler, \textcolor{keyword}{const} \mbox{\hyperlink{group__api__types_gabbfa54994e431fe68d4f6580c112e1a0}{SVM\_Process}} process, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} \textcolor{keywordtype}{int} parameter); \textcolor{comment}{// mandatory}}
\DoxyCodeLine{\mbox{\hyperlink{struct_s_v_m___string}{SVM\_String}} scheduler\_<scheduler name>\_print(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *svm, \textcolor{keyword}{const} \textcolor{keywordtype}{void} *handler); \textcolor{comment}{// mandatory}}

\end{DoxyCode}

\item For functions\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{group__api__types_gad01adf1b14e8f8309ff0c059b2a51196}{SVM\_Variable}} function\_<function name>(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *svm, \mbox{\hyperlink{group__api__types_gaab347fe7005c87722bd7d80cfe94333c}{SVM\_Size}} argc, \mbox{\hyperlink{group__api__types_gab05a82304ba262cf3ae97b0c5f8ab707}{SVM\_Parameter}} argv[]); \textcolor{comment}{// mandatory}}

\end{DoxyCode}

\item For structures\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordtype}{void} struct\_<struct name>\_delete(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *svm, \textcolor{keywordtype}{void} *handler); \textcolor{comment}{// mandatory}}
\DoxyCodeLine{\textcolor{keywordtype}{void}* struct\_<struct name>\_copy(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *svm, \textcolor{keyword}{const} \textcolor{keywordtype}{void} *handler); \textcolor{comment}{// optional}}

\end{DoxyCode}

\end{DoxyItemize}

Please refer to the svm manpage to get details about the call, parameters and expected return values of these callbacks.

To let the plugin callbacks interact with the SVM, some API functions are defined in this file.

\begin{DoxyNote}{Note}
API functions have some default behavior\+:
\begin{DoxyItemize}
\item when an invalid condition is reached in the API function, it will interrupt the full plugin callback and also the calling program. To avoid interruptions, other API functions can be called to detect errors conditions.
\item when a parameter is a pointer and is passed NULL, a FAILURE interruption will be raised with a message complaining about a void parameter,
\item when a parameter is a pointer that has not been returned by a previous API function call or coming from a callback parameter, a FAILURE interruption will be raised with a message complaining about an invalid parameter,
\item when a parameter is a pointer that has been returned by a previous API function call or a callback parameter but has an invalid type, a FAILURE interruption will be raised with a message complaining about a parameter not being of the wanted type,
\item when a function returns a SVM\+\_\+$<$something$>$ pointer or a \mbox{\hyperlink{struct_s_v_m___string}{SVM\+\_\+\+String}} structure, never free or delete the pointer or the buffer. The SVM will automatically manage the life time of objects created in plugin callbacks. (Explicit void$\ast$ are not concerned and have to be freed manually.)
\end{DoxyItemize}
\end{DoxyNote}
\begin{DoxyWarning}{Warning}
Freeing or deleting a pointer returned by an API function will result in an undefined behavior.
\end{DoxyWarning}
\begin{DoxyNote}{Note}
Any API function requires a pointer as first parameter. This parameter is given as first parameter of the plugin callback.
\end{DoxyNote}
\begin{DoxyWarning}{Warning}
Passing to an API function a first parameter not being the first one of a plugin callback will result in an undefined behavior. Any modification attempt to this pointer will also result in an undefined behavior.
\end{DoxyWarning}
\begin{DoxyNote}{Note}
When a function requires a SVM\+\_\+\+Kernel or a SVM\+\_\+\+Process, by default if the provided SVM\+\_\+\+Kernel or SVM\+\_\+\+Process is not the current process, the given process has to be locked by the current process to achieve its action. A FAILURE interruption will be raised otherwise. A lock can be obtained by the svm\+\_\+process\+\_\+ownership\+\_\+lock API function.
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__configuration}{SVM plugin configuration}} 

\mbox{\hyperlink{group__ownershipprocesses_ga535796c3203a2baa8095c951b9b2c205}{svm\+\_\+process\+\_\+ownership\+\_\+lock}} 
\end{DoxySeeAlso}
