FreeNOS
Public Types | Public Member Functions | Private Attributes
API Class Reference

Generic Kernel API implementation. More...

#include <API.h>

Public Types

enum  Number {
  PrivExecNumber = 1, ProcessCtlNumber, SystemInfoNumber, VMCopyNumber,
  VMCtlNumber, VMShareNumber
}
 Enumeration of supported generic kernel API functions. More...
 
enum  Result {
  Success = 0, AccessViolation, RangeError, NotFound,
  InvalidArgument, OutOfMemory, IOError, AlreadyExists,
  TemporaryUnavailable, MaxValue = UINT_MAX
}
 Enumeration of generic kernel API result codes. More...
 
enum  Operation {
  Create = 0, Delete = 1, Send = 2, Receive = 3,
  SendReceive = 4, Read = 5, Write = 6, ReadPhys = 7
}
 Various actions which may be performed inside an APIHandler. More...
 
typedef enum API::Number Number
 Enumeration of supported generic kernel API functions. More...
 
typedef Result Handler(ulong, ulong, ulong, ulong, ulong)
 Function which handles an kernel API (system call) request. More...
 
typedef enum API::Operation Operation
 Various actions which may be performed inside an APIHandler. More...
 

Public Member Functions

 API ()
 Constructor. More...
 
Result invoke (Number number, ulong arg1, ulong arg2, ulong arg3, ulong arg4, ulong arg5)
 Execute a generic API function. More...
 

Private Attributes

Vector< Handler * > m_apis
 API handlers. More...
 

Detailed Description

Generic Kernel API implementation.

Todo:
System calls currently do not verify whether a process has permission to use it. Possible solution is to add a capability based mechanism, that defines whether a Process is allowed to execute the system call. Capabilities can describe any resource owned by the Process. For example, a virtual or physical memory range. Capabilities may be transferred between core local and remote processes.

Definition at line 39 of file API.h.

Member Typedef Documentation

◆ Handler

typedef Result API::Handler(ulong, ulong, ulong, ulong, ulong)

Function which handles an kernel API (system call) request.

Returns
Status code of the APIHandler execution.

Definition at line 86 of file API.h.

◆ Number

typedef enum API::Number API::Number

Enumeration of supported generic kernel API functions.

Architectures or System implementations can optionally introduce additional specific APIs.

◆ Operation

Various actions which may be performed inside an APIHandler.

Member Enumeration Documentation

◆ Number

Enumeration of supported generic kernel API functions.

Architectures or System implementations can optionally introduce additional specific APIs.

Enumerator
PrivExecNumber 
ProcessCtlNumber 
SystemInfoNumber 
VMCopyNumber 
VMCtlNumber 
VMShareNumber 

Definition at line 49 of file API.h.

◆ Operation

Various actions which may be performed inside an APIHandler.

Enumerator
Create 
Delete 
Send 
Receive 
SendReceive 
Read 
Write 
ReadPhys 

Definition at line 91 of file API.h.

◆ Result

Enumeration of generic kernel API result codes.

Note
This type must have the same size as the native register size of the underlying architecture (typically ulong). Some API handlers will return additional data in upper bits of return value which has the type API::Result
Enumerator
Success 
AccessViolation 
RangeError 
NotFound 
InvalidArgument 
OutOfMemory 
IOError 
AlreadyExists 
TemporaryUnavailable 
MaxValue 

Definition at line 68 of file API.h.

Constructor & Destructor Documentation

◆ API()

API::API ( )

Member Function Documentation

◆ invoke()

API::Result API::invoke ( Number  number,
ulong  arg1,
ulong  arg2,
ulong  arg3,
ulong  arg4,
ulong  arg5 
)

Execute a generic API function.

Definition at line 35 of file API.cpp.

References Vector< T >::get(), InvalidArgument, and m_apis.

Referenced by ARMKernel::trap(), and IntelKernel::trap().

Field Documentation

◆ m_apis

Vector<Handler *> API::m_apis
private

API handlers.

Definition at line 124 of file API.h.

Referenced by API(), and invoke().


The documentation for this class was generated from the following files: