The Pedigree Project
0.1
|
#include <Subsystem.h>
Public Types | |
enum | SubsystemType { Posix = 0, Native = 1, None = 255 } |
enum | KillReason { Interrupted = 0, Terminated = 1, Unknown = 255 } |
enum | ExceptionType { InvalidOpcode = 0, PageFault = 1, GeneralProtectionFault = 2, DivideByZero = 3, FpuError = 4, SpecialFpuError = 5, TerminalInput = 6, TerminalOutput = 7, Continue = 8, Stop = 9, Interrupt = 10, Quit = 11, Child = 12, Pipe = 13, Other = 255 } |
Public Member Functions | |
Subsystem () | |
Subsystem (const Subsystem &s) | |
Subsystem (SubsystemType type) | |
virtual | ~Subsystem () |
virtual void | acquire () |
Acquire full mutual exclusion for all Subsystem resources. More... | |
virtual void | release () |
virtual void | exit (int code)=0 |
virtual bool | kill (KillReason killReason, Thread *pThread=0)=0 |
virtual void | threadException (Thread *pThread, ExceptionType eType) |
SubsystemType | getType () |
virtual void | setProcess (Process *p) |
virtual bool | invoke (const char *name, Vector< String > &argv, Vector< String > &env)=0 |
virtual bool | invoke (const char *name, Vector< String > &argv, Vector< String > &env, SyscallState &state)=0 |
virtual bool | invoke (File *originalFile, const String &originalName, Vector< String > &argv, Vector< String > &env)=0 |
virtual bool | invoke (File *originalFile, const String &originalName, Vector< String > &argv, Vector< String > &env, SyscallState &state)=0 |
virtual File * | findFile (const String &path, File *workingDir)=0 |
Protected Member Functions | |
virtual void | threadRemoved (Thread *pThread) |
Protected Attributes | |
SubsystemType | m_Type |
Process * | m_pProcess |
Private Member Functions | |
const Subsystem & | operator= (const Subsystem &) |
Friends | |
class | Process |
The abstract base class for a generic application subsystem. This provides a well-defined interface to the kernel that allows global behaviour to have correct results on different applications. This also allows the kernel to keep subsystem-specific code to a minimum.
Basically, when inheriting from this class, you are creating a layer between your subsystem and the kernel.
Definition at line 42 of file Subsystem.h.
Type of exception. This is passed to the subsystem when a Thread throws an exception, which allows subsystem-specific behaviour to be performed.
Definition at line 67 of file Subsystem.h.
Reason for kill()
Definition at line 56 of file Subsystem.h.
Defines the different types of subsystems
Definition at line 48 of file Subsystem.h.
|
inline |
Default constructor
Definition at line 87 of file Subsystem.h.
|
inline |
Copy constructor
Definition at line 92 of file Subsystem.h.
|
inline |
|
virtualdefault |
Default destructor
|
virtual |
Acquire full mutual exclusion for all Subsystem resources.
It is sometimes necessary to perform an operation that would require the entire Subsystem to be owned by a specific thread. For example, Subsystem termination often requires all other threads to exit the Subsystem's critical sections before it can complete.
This call allows that thread to acquire that mutual exclusion.
Reimplemented in PosixSubsystem.
Definition at line 25 of file Subsystem.cc.
Referenced by Process::~Process().
|
pure virtual |
Need to exit this process.
Implemented in PosixSubsystem.
Referenced by PerProcessorScheduler::timer().
Finds a file, performing any subsystem-specific logic as needed.
Implemented in PosixSubsystem.
|
inline |
Gets the type of this subsystem
Definition at line 131 of file Subsystem.h.
|
pure virtual |
Invokes the given command (thread mechanism).
Implemented in PosixSubsystem.
|
pure virtual |
Invokes the given command (SyscallState mechanism).
Implemented in PosixSubsystem.
|
pure virtual |
Invokes the given file (thread mechanism).
Implemented in PosixSubsystem.
|
pure virtual |
Invokes the given file (SyscallState mechanism).
Implemented in PosixSubsystem.
|
pure virtual |
A thread (or process, depending on implementation) needs to be killed! This must block until the thread/process ceases to exist.
Implemented in PosixSubsystem.
Referenced by MemoryPressureProcessKiller::compact(), and WaitCleanup::terminated().
|
virtual |
Release mutual exclusion acquired via acquire().
Reimplemented in PosixSubsystem.
Definition at line 30 of file Subsystem.cc.
|
inlinevirtual |
Sets the process that this subsystem is linked to.
Definition at line 137 of file Subsystem.h.
References WARNING.
Referenced by Process::getEffectiveGroup().
|
virtual |
A thread has thrown an exception!
Reimplemented in PosixSubsystem.
Definition at line 35 of file Subsystem.cc.
References ERROR.
Referenced by PosixSubsystem::exit(), HostedInterruptManager::interrupt(), X64InterruptManager::interrupt(), X86InterruptManager::interrupt(), and Process::suspend().
|
inlineprotectedvirtual |
Notifies the subsystem that the given thread has been removed.
Reimplemented in PosixSubsystem.
Definition at line 170 of file Subsystem.h.
Referenced by Process::removeThread().