|
The Pedigree Project 0.1
|
#include <Subsystem.h>
Inheritance diagram for Subsystem:
Collaboration diagram for Subsystem:Public Types | |
| enum class | UserReturnResult { Continue , Terminal } |
| enum class | UserReturnEventResult { Deliver , Consumed , Terminal } |
| enum | SubsystemType { Posix = 0 , Native = 1 , None = 255 } |
| enum | KillReason { Interrupted = 0 , Terminated = 1 , Unknown = 255 } |
| enum class | ExitCause { Normal , Signal } |
| 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 , FileMappingFault = 14 , Other = 255 } |
Public Member Functions | |
| virtual UserReturnResult | userReturnCheckpoint (Thread &, UserReturnFrame &) |
| virtual UserReturnEventResult | userReturnEvent (Thread &, Event &, UserReturnFrame &) |
| Subsystem () | |
| Subsystem (const Subsystem &s) | |
| Subsystem (SubsystemType type) | |
| virtual | ~Subsystem () |
| virtual void | acquire () |
| Acquire full mutual exclusion for all Subsystem resources. | |
| virtual void | release () |
| virtual void | exit (int code, ExitCause cause=ExitCause::Normal)=0 |
| virtual bool | kill (KillReason killReason, Thread *pThread=0)=0 |
| virtual void | threadException (Thread *pThread, ExceptionType eType, InterruptState *pState=nullptr, uintptr_t faultAddress=0, uintptr_t errorCode=0) |
| virtual bool | resolveUserPageFault (Thread &, InterruptState &, uintptr_t, uintptr_t) |
| 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 |
Protected Member Functions | |
| virtual void | prepareThreadsForExec (Thread *owner) |
| virtual void | preserveProcessSignalsForThreadExit (Thread *thread) |
| virtual void | threadExiting (Thread *pThread) |
| 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 44 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 70 of file Subsystem.h.
|
strong |
How a process reached its terminal state.
Definition at line 64 of file Subsystem.h.
Reason for kill()
Definition at line 61 of file Subsystem.h.
Defines the different types of subsystems
Definition at line 58 of file Subsystem.h.
|
strong |
Definition at line 49 of file Subsystem.h.
|
strong |
Definition at line 48 of file Subsystem.h.
|
inline |
Default constructor
Definition at line 90 of file Subsystem.h.
|
inline |
Copy constructor
Definition at line 93 of file Subsystem.h.
|
inline |
Parameterised constructor
Definition at line 96 of file Subsystem.h.
|
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().
Here is the caller graph for this function:
|
pure virtual |
Need to exit this process.
Implemented in PosixSubsystem.
Referenced by PerProcessorScheduler::commitUserReturnTerminalState(), X64SyscallManager::syscall(), and Thread::threadExited().
Here is the caller graph for this function:
|
inline |
Gets the type of this subsystem
Definition at line 140 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().
Here is the caller graph for this function:
|
inlineprotectedvirtual |
Preserves process state after exec admission closes and before peers exit.
Reimplemented in PosixSubsystem.
Definition at line 169 of file Subsystem.h.
|
inlineprotectedvirtual |
Preserves process-owned pending work before an exiting thread drains it.
Reimplemented in PosixSubsystem.
Definition at line 172 of file Subsystem.h.
Referenced by Process::transferExecProcessSignals().
Here is the caller graph for this function:
|
virtual |
Release mutual exclusion acquired via acquire().
Reimplemented in PosixSubsystem.
Definition at line 29 of file Subsystem.cc.
|
inlinevirtual |
Retry a userspace page fault after raw interrupt scopes have retired.
Reimplemented in PosixSubsystem.
Definition at line 135 of file Subsystem.h.
Referenced by PerProcessorScheduler::serviceDeferredSubsystemException().
Here is the caller graph for this function:
|
inlinevirtual |
Sets the process that this subsystem is linked to.
Reimplemented in PosixSubsystem.
Definition at line 145 of file Subsystem.h.
Referenced by PosixSubsystem::setProcess().
Here is the caller graph for this function:
|
virtual |
A thread has thrown an exception.
The interrupt state is borrowed for this call only. Architecture-neutral and synthetic exceptions may omit the optional machine context.
Reimplemented in PosixSubsystem.
Definition at line 33 of file Subsystem.cc.
Referenced by Process::publishTerminationStatus(), PerProcessorScheduler::serviceDeferredSubsystemException(), and Process::suspendInternal().
Here is the caller graph for this function:
|
inlineprotectedvirtual |
Notifies the subsystem immediately before a thread announces exit.
Reimplemented in PosixSubsystem.
Definition at line 175 of file Subsystem.h.
Referenced by Process::threadExiting().
Here is the caller graph for this function:
|
inlineprotectedvirtual |
Notifies the subsystem that the given thread has been removed.
Reimplemented in PosixSubsystem.
Definition at line 178 of file Subsystem.h.
Referenced by Process::removeThread().
Here is the caller graph for this function:
|
inlinevirtual |
Definition at line 50 of file Subsystem.h.
|
inlinevirtual |
Definition at line 53 of file Subsystem.h.
|
friend |
Definition at line 45 of file Subsystem.h.
|
protected |
Definition at line 182 of file Subsystem.h.
|
protected |
Definition at line 180 of file Subsystem.h.