FreeNOS
Data Structures | Typedefs | Enumerations | Functions
API (system call interface)

Application Programming Interface (API) provided by the Kernel for user programs. More...

Data Structures

struct  ProcessInfo
 Process information structure, used for Info. More...
 
struct  SystemInformation
 System information structure. More...
 

Typedefs

typedef enum PrivOperation PrivOperation
 Available operations to perform using PrivExec(). More...
 
typedef enum ProcessOperation ProcessOperation
 Available operation to perform using ProcessCtl. More...
 
typedef struct ProcessInfo ProcessInfo
 Process information structure, used for Info. More...
 
typedef struct SystemInformation SystemInformation
 System information structure. More...
 
typedef enum MemoryOperation MemoryOperation
 Memory operations which may be used as an argument to VMCtl(). More...
 

Enumerations

enum  PrivOperation {
  Idle = 0, RebootSystem = 1, ShutdownSystem = 2, WriteConsole = 3,
  Panic = 4
}
 Available operations to perform using PrivExec(). More...
 
enum  ProcessOperation {
  Spawn = 0, KillPID, GetPID, GetParent,
  WatchIRQ, EnableIRQ, DisableIRQ, SendIRQ,
  InfoPID, WaitPID, InfoTimer, WaitTimer,
  EnterSleep, Schedule, Wakeup, Stop,
  Resume, Reset
}
 Available operation to perform using ProcessCtl. More...
 
enum  MemoryOperation {
  MapContiguous = 0, MapSparse, UnMap, Release,
  ReleaseSections, LookupVirtual, Access, ReserveMem,
  AddMem, CacheClean, CacheInvalidate, CacheCleanInvalidate
}
 Memory operations which may be used as an argument to VMCtl(). More...
 

Functions

API::Result PrivExec (const PrivOperation op, const Address param=0)
 Prototype for user applications. More...
 
Logoperator<< (Log &log, ProcessOperation op)
 Operator to print a ProcessOperation to a Log. More...
 
API::Result ProcessCtl (const ProcessID proc, const ProcessOperation op, const Address addr=0, const Address output=0)
 Prototype for user applications. More...
 
API::Result SystemInfo (SystemInformation *info)
 Prototype for user applications. More...
 
API::Result VMCopy (const ProcessID proc, const API::Operation how, const Address ours, const Address theirs, const Size sz)
 Prototype for user applications. More...
 
API::Result VMCtl (const ProcessID procID, const MemoryOperation op, Memory::Range *range=ZERO)
 Prototype for user applications. More...
 
API::Result VMShare (const ProcessID pid, const API::Operation op, ProcessShares::MemoryShare *share)
 Prototype for user applications. More...
 

Static Process IDs

#define ANY   65535
 
#define SELF   65534
 
#define KERNEL_PID   65533
 
#define CORESRV_PID   0
 
#define DATASTORE_PID   1
 
#define RECOVERY_PID   2
 
#define ROOTFS_PID   3
 

Detailed Description

Application Programming Interface (API) provided by the Kernel for user programs.

Macro Definition Documentation

◆ ANY

#define ANY   65535

Definition at line 34 of file ProcessID.h.

◆ CORESRV_PID

#define CORESRV_PID   0

Definition at line 38 of file ProcessID.h.

◆ DATASTORE_PID

#define DATASTORE_PID   1

Definition at line 39 of file ProcessID.h.

◆ KERNEL_PID

#define KERNEL_PID   65533

Definition at line 36 of file ProcessID.h.

◆ RECOVERY_PID

#define RECOVERY_PID   2

Definition at line 40 of file ProcessID.h.

◆ ROOTFS_PID

#define ROOTFS_PID   3

Definition at line 41 of file ProcessID.h.

◆ SELF

#define SELF   65534

Definition at line 35 of file ProcessID.h.

Typedef Documentation

◆ MemoryOperation

Memory operations which may be used as an argument to VMCtl().

◆ PrivOperation

Available operations to perform using PrivExec().

See also
PrivExec

◆ ProcessInfo

typedef struct ProcessInfo ProcessInfo

Process information structure, used for Info.

◆ ProcessOperation

Available operation to perform using ProcessCtl.

See also
ProcessCtl

◆ SystemInformation

System information structure.

Enumeration Type Documentation

◆ MemoryOperation

Memory operations which may be used as an argument to VMCtl().

Enumerator
MapContiguous 
MapSparse 
UnMap 
Release 
ReleaseSections 
LookupVirtual 
Access 
ReserveMem 
AddMem 
CacheClean 
CacheInvalidate 
CacheCleanInvalidate 

Definition at line 35 of file VMCtl.h.

◆ PrivOperation

Available operations to perform using PrivExec().

See also
PrivExec
Enumerator
Idle 
RebootSystem 
ShutdownSystem 
WriteConsole 
Panic 

Definition at line 34 of file PrivExec.h.

◆ ProcessOperation

Available operation to perform using ProcessCtl.

See also
ProcessCtl
Enumerator
Spawn 
KillPID 
GetPID 
GetParent 
WatchIRQ 
EnableIRQ 
DisableIRQ 
SendIRQ 
InfoPID 
WaitPID 
InfoTimer 
WaitTimer 
EnterSleep 
Schedule 
Wakeup 
Stop 
Resume 
Reset 

Definition at line 37 of file ProcessCtl.h.

Function Documentation

◆ operator<<()

Log& operator<< ( Log log,
ProcessOperation  op 
)

Operator to print a ProcessOperation to a Log.

Definition at line 185 of file ProcessCtl.cpp.

References Log::append(), DisableIRQ, EnableIRQ, EnterSleep, GetParent, GetPID, InfoPID, InfoTimer, KillPID, Schedule, Spawn, WaitPID, Wakeup, and WatchIRQ.

◆ PrivExec()

API::Result PrivExec ( const PrivOperation  op,
const Address  param = 0 
)
inline

Prototype for user applications.

Performs various privileged operations.

Parameters
opThe operation to perform.
paramOptional parameter value for the given operation
Returns
API::Success on success and other API::ErrorCode on failure.

Definition at line 52 of file PrivExec.h.

References param(), API::PrivExecNumber, and trapKernel2().

Referenced by Shutdown::exec(), main(), setupHeap(), KernelLog::terminate(), StdioLog::terminate(), and KernelLog::write().

◆ ProcessCtl()

API::Result ProcessCtl ( const ProcessID  proc,
const ProcessOperation  op,
const Address  addr = 0,
const Address  output = 0 
)
inline

Prototype for user applications.

Process management related operations.

Parameters
procTarget Process' ID.
opThe operation to perform.
addrInput argument address, used for program entry point for Spawn, ProcessInfo pointer for Info.
outputOutput argument address (optional).
Returns
API::Success on success and other API::ErrorCode on failure. For WaitPID, the process exit status is stored in the upper 16-bits of this return value on success. For Spawn, the new PID is stored in the upper 16-bits.

Definition at line 93 of file ProcessCtl.h.

References API::ProcessCtlNumber, and trapKernel4().

Referenced by ChannelServer< DatastoreServer, DatastoreMessage >::ChannelServer(), ChannelClient::connect(), BenchMark::exec(), SysInfo::exec(), exit(), gettimeofday(), IntelCoreServer::initialize(), SunxiCoreServer::initialize(), i8250::initialize(), PL011::initialize(), NS16550::initialize(), Sun8iEmac::initialize(), i8250::interrupt(), PL011::interrupt(), Sun8iEmac::interrupt(), kill(), main(), ProcessClient::processInfo(), MpiProxy::processRecv(), Keyboard::read(), NS16550::read(), ChannelServer< DatastoreServer, DatastoreMessage >::readChannels(), MpiTarget::receive(), DeviceServer::registerInterrupt(), RecoveryServer::restartProcess(), SysControl::resumeProcess(), RecoveryServer::rewriteProgram(), SECTION(), MpiTarget::send(), SunxiCoreServer::sendIPI(), ChannelClient::sendRequest(), FileSystemServer::sendResponse(), ChannelServer< DatastoreServer, DatastoreMessage >::setTimeout(), setupHeap(), setupMappings(), setupRandomizer(), sleep(), ChannelServer< DatastoreServer, DatastoreMessage >::sleepUntilWakeup(), spawn(), SysControl::stopProcess(), ChannelClient::syncReceiveFrom(), ChannelClient::syncSendTo(), KernelLog::terminate(), KernelTimer::tick(), IntelAPIC::wait(), IntelCoreServer::waitIPI(), SunxiCoreServer::waitIPI(), and waitpid().

◆ SystemInfo()

API::Result SystemInfo ( SystemInformation info)
inline

Prototype for user applications.

Retrieves system information.

Parameters
infoPointer to SystemInformation output buffer.
Returns
API::Success on success and other API::ErrorCode on failure.

Definition at line 40 of file SystemInfo.h.

References API::SystemInfoNumber, and trapKernel1().

Referenced by SystemInformation::SystemInformation().

◆ VMCopy()

API::Result VMCopy ( const ProcessID  proc,
const API::Operation  how,
const Address  ours,
const Address  theirs,
const Size  sz 
)
inline

Prototype for user applications.

Copies virtual memory between two processes.

Parameters
procRemote process.
howRead or Write.
oursVirtual address of the buffer of this process.
theirsVirtual address of the remote process' buffer.
szAmount of memory to copy.
Returns
API::Success on success and any other value on error.

Definition at line 42 of file VMCopy.h.

References trapKernel5(), and API::VMCopyNumber.

Referenced by IntelMP::boot(), SunxiCoreServer::bootCore(), CoreServer::createProcess(), FileSystemServer::getFileSystemsHandler(), SunxiCoreServer::initialize(), Mount::listMounts(), FileSystemServer::mountHandler(), CoreServer::prepareCore(), ProcessClient::processInfo(), FileSystemServer::processRequest(), IOBuffer::read(), RecoveryServer::restartProcess(), spawn(), and IOBuffer::write().

◆ VMCtl()

API::Result VMCtl ( const ProcessID  procID,
const MemoryOperation  op,
Memory::Range range = ZERO 
)
inline

◆ VMShare()

API::Result VMShare ( const ProcessID  pid,
const API::Operation  op,
ProcessShares::MemoryShare share 
)
inline

Prototype for user applications.

Creates and removes shared virtual memory mappings.

Parameters
pidRemote process.
opDetermines which operation to perform.
sharePointer to the MemoryShare to use in the operation
Returns
API::Success on success and other API::ErrorCode on failure.

Definition at line 41 of file VMShare.h.

References trapKernel3(), and API::VMShareNumber.

Referenced by ChannelServer< DatastoreServer, DatastoreMessage >::ChannelServer(), ChannelClient::connect(), ChannelServer< DatastoreServer, DatastoreMessage >::readKernelEvents(), and ChannelServer< DatastoreServer, DatastoreMessage >::recoverChannels().