FreeNOS
Public Member Functions | Private Attributes | Static Private Attributes
IntelProcess Class Reference

Process which may execute on an Intel CPU. More...

#include <IntelProcess.h>

Inheritance diagram for IntelProcess:
Process

Public Member Functions

 IntelProcess (ProcessID id, Address entry, bool privileged, const MemoryMap &map)
 Constructor function. More...
 
virtual ~IntelProcess ()
 Destructor function. More...
 
virtual Result initialize ()
 Initialize the Process. More...
 
virtual void reset (const Address entry)
 Restart execution at the given entry point. More...
 
virtual void execute (Process *previous)
 Execute the process. More...
 
- Public Member Functions inherited from Process
 Process (ProcessID id, Address entry, bool privileged, const MemoryMap &map)
 Constructor function. More...
 
virtual ~Process ()
 Destructor function. More...
 
ProcessID getID () const
 Retrieve our ID number. More...
 
ProcessID getParent () const
 Retrieve our parent ID. More...
 
ProcessID getWait () const
 Get Wait ID. More...
 
uint getWaitResult () const
 Get wait result. More...
 
ProcessSharesgetShares ()
 Get process shares. More...
 
State getState () const
 Retrieves the current state. More...
 
MemoryContextgetMemoryContext ()
 Get MMU memory context. More...
 
bool isPrivileged () const
 Get privilege. More...
 
bool operator== (Process *proc)
 Compare two processes. More...
 

Private Attributes

Address m_kernelStack
 Current kernel stack address (changes during execution). More...
 
Address m_kernelStackBase
 Base kernel stack (fixed) More...
 

Static Private Attributes

static const Size KernelStackSize = PAGESIZE
 Size of the kernel stack. More...
 

Additional Inherited Members

- Public Types inherited from Process
enum  Result {
  Success, InvalidArgument, MemoryMapError, OutOfMemory,
  WakeupPending
}
 Result codes. More...
 
enum  State { Ready, Sleeping, Waiting, Stopped }
 Represents the execution state of the Process. More...
 
- Protected Member Functions inherited from Process
Result wakeup ()
 Prevent process from sleeping. More...
 
Result sleep (const Timer::Info *timer, bool ignoreWakeups)
 Stops the process for executing until woken up. More...
 
Result wait (ProcessID id)
 Let Process wait for other Process to terminate. More...
 
virtual Result join (const uint result)
 Complete waiting for another Process. More...
 
Result stop ()
 Stop execution of this process. More...
 
Result resume ()
 Resume execution when this process is stopped. More...
 
Result raiseEvent (const struct ProcessEvent *event)
 Raise kernel event. More...
 
const Timer::InfogetSleepTimer () const
 Get sleep timer. More...
 
void setParent (ProcessID id)
 Set parent process ID. More...
 
- Protected Attributes inherited from Process
const ProcessID m_id
 Process Identifier. More...
 
ProcessID m_parent
 Parent process. More...
 
State m_state
 Current process status. More...
 
ProcessID m_waitId
 Waits for exit of this Process. More...
 
uint m_waitResult
 Wait exit result of the other Process. More...
 
bool m_privileged
 Privilege level. More...
 
Address m_entry
 Entry point of the program. More...
 
MemoryMap m_map
 Virtual memory layout. More...
 
MemoryContextm_memoryContext
 MMU memory context. More...
 
Size m_wakeups
 Number of wakeups received. More...
 
Timer::Info m_sleepTimer
 Sleep timer value. More...
 
ProcessShares m_shares
 Contains virtual memory shares between this process and others. More...
 
MemoryChannelm_kernelChannel
 Channel for sending kernel events to the Process. More...
 

Detailed Description

Process which may execute on an Intel CPU.

Todo:
IntelProcess currently has a per-process kernel stack, while the ARMProcess does not. The kernel stack should not be needed anymore, and can be removed to reduce overhead.

Definition at line 38 of file IntelProcess.h.

Constructor & Destructor Documentation

◆ IntelProcess()

IntelProcess::IntelProcess ( ProcessID  id,
Address  entry,
bool  privileged,
const MemoryMap map 
)

Constructor function.

Parameters
idProcess Identifier.
entryInitial EIP register value.
privilegedIf true, the Process has unlimited access to hardware.
mapVirtual memory layout.

Definition at line 25 of file IntelProcess.cpp.

◆ ~IntelProcess()

IntelProcess::~IntelProcess ( )
virtual

Member Function Documentation

◆ execute()

void IntelProcess::execute ( Process previous)
virtual

Execute the process.

Saves and restores registers, then perform a context switch.

Implements Process.

Definition at line 142 of file IntelProcess.cpp.

References MemoryContext::activate(), TSS::esp0, kernelTss, m_kernelStack, m_kernelStackBase, Process::m_memoryContext, switchCoreState(), and ZERO.

◆ initialize()

Process::Result IntelProcess::initialize ( )
virtual

◆ reset()

void IntelProcess::reset ( const Address  entry)
virtual

Field Documentation

◆ KernelStackSize

const Size IntelProcess::KernelStackSize = PAGESIZE
staticprivate

Size of the kernel stack.

Definition at line 43 of file IntelProcess.h.

Referenced by initialize(), and ~IntelProcess().

◆ m_kernelStack

Address IntelProcess::m_kernelStack
private

Current kernel stack address (changes during execution).

Definition at line 89 of file IntelProcess.h.

Referenced by execute(), and reset().

◆ m_kernelStackBase

Address IntelProcess::m_kernelStackBase
private

Base kernel stack (fixed)

Definition at line 92 of file IntelProcess.h.

Referenced by execute(), initialize(), reset(), and ~IntelProcess().


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