It provides some low-level services to the other threads, like thread creation and termination, a timing service and so on.
typedef struct { |
This datatype defines the structure of the messages the SSI can handle. The available services are described below, after the SSI function description. |
void InitSSI( void ) |
explained below |
void SSIrequest( int service, int payload, Message *reply ) |
explained below |
Look at the header files: SSI.e,
sysinterface.e
void InitSSI( void ) |
Sets up the SSI thread, allocating its stack and inserting it into the kernel ready queue. The SSI will run with interrupts disabled: this will give it an infinite time slice. |
void SSIrequest( int service, int payload, Message *reply ) |
This is the interface function used by other threads to communicate
with the SSI.
As |
void SSI( void ) |
This is the heart of the SSI thread.
It consists of a MsgRecv() -> process request -> send answer
loop.If an unknown service is requested, the calling thread will be terminated.
After receiving a message, it will be dispatched to the right routine
for the execution of the service. These routines will return a boolean
value telling the SSI whether it has to send the answer to the calling
thread right ahead or not. The latter means that the calling thread has
been terminated or that it needs to stay in the wait queue
( |
int CreateBrother( Message *msg ) |
Creates a thread whose initial state is the one passed as
state_t *
in the Payload field of the SSIMsg. The new thread will be inserted
in the ready queue.The function also take care of inheriting trap managers from the parent thread, if it exists.
The return value is a |
int CreateSon( Message *msg ) |
This is almost the same of the previous service. The only difference
is that the new thread will be inserted in the children list of the
caller. Note that children will be terminated when their parent is, and that brothers of a "son" will be considered as children of its parent thread. |
int Terminate( Message *msg ) |
Kills the thread (and its descendants) specified in the payload field. |
int SpecPrgMgr( Message *msg ) |
Specifies a PRGTRAP manager for the calling thread. Once the manager has been defined, an attempt to set a new one will cause the thread termination. |
int SpecMemMgr( Message *msg ) |
As above, but related to TLBTRAP's. |
int SpecSysMgr( Message *msg ) |
As above, but related to SYSTRAP's. |
int GetCPUTime( Message *msg ) |
Returns the CPU time used by the calling thread so far. |
int WaitForIO( Message *msg ) |
The calling thread wants to be blocked until the IO device with
the specified Virtual Base Address raises an interrupt.
As the interrupt could preceed the call to |
int WaitForClock( Message *msg ) |
The calling thread wants to be blocked until the pseudoclock
will tick (it happens every 100ms), thus this function does nothing
but set its WaitFor code to WF_CLOCK.
|
int PseudoClock( Message *msg ) |
This function will unblock all the threads waiting for the pseudo-clock tick. |
Look at the code: SSI.cc