FreeNOS
Public Member Functions | Private Attributes
ARMProcess Class Reference

ARM specific process implementation. More...

#include <ARMProcess.h>

Inheritance diagram for ARMProcess:
Process

Public Member Functions

 ARMProcess (ProcessID id, Address entry, bool privileged, const MemoryMap &map)
 Constructor function. More...
 
virtual ~ARMProcess ()
 Destructor function. More...
 
void setCpuState (const CPUState *cpuState)
 Overwrite the saved CPU registers for this task. More...
 
const CPUStatecpuState () const
 Retrieve saved CPU state. More...
 
virtual Result join (const uint result)
 Complete waiting for another Process. 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)
 Allow the Process to run on the CPU. 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

CPUState m_cpuState
 Contains all the CPU registers for this task. 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...
 
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

ARM specific process implementation.

Definition at line 34 of file ARMProcess.h.

Constructor & Destructor Documentation

◆ ARMProcess()

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

Constructor function.

Parameters
idProcess Identifier
entryInitial program counter value.
privilegedIf true, the process has unlimited access to hardware.
mapMemory mapping to use to create the process.

Definition at line 28 of file ARMProcess.cpp.

◆ ~ARMProcess()

ARMProcess::~ARMProcess ( )
virtual

Destructor function.

Definition at line 82 of file ARMProcess.cpp.

Member Function Documentation

◆ cpuState()

const CPUState * ARMProcess::cpuState ( ) const

Retrieve saved CPU state.

Returns
Saved CPUState for this task.

Definition at line 86 of file ARMProcess.cpp.

References m_cpuState.

Referenced by setCpuState().

◆ execute()

void ARMProcess::execute ( Process previous)
virtual

Allow the Process to run on the CPU.

Implements Process.

Definition at line 117 of file ARMProcess.cpp.

References MemoryContext::activate(), MemoryBlock::copy(), firstProcess, m_cpuState, Process::m_memoryContext, CPUState::padding, and svcStack.

◆ initialize()

Process::Result ARMProcess::initialize ( )
virtual

◆ join()

ARMProcess::Result ARMProcess::join ( const uint  result)
virtual

Complete waiting for another Process.

Parameters
resultExit code of the other process

Reimplemented from Process.

Definition at line 96 of file ARMProcess.cpp.

References Process::join(), m_cpuState, CPUState::r0, Process::Success, and API::Success.

◆ reset()

void ARMProcess::reset ( const Address  entry)
virtual

Restart execution at the given entry point.

Parameters
entryAddress to begin execution.

Implements Process.

Definition at line 107 of file ARMProcess.cpp.

References CPUState::cpsr, entry, m_cpuState, Process::m_map, Process::m_privileged, MEMALIGN8, CPUState::pc, MemoryMap::range(), MemoryBlock::set(), Memory::Range::size, CPUState::sp, SYS_MODE, MemoryMap::UserStack, USR_MODE, and Memory::Range::virt.

Referenced by initialize().

◆ setCpuState()

void ARMProcess::setCpuState ( const CPUState cpuState)

Overwrite the saved CPU registers for this task.

Parameters
cpuStatePointer to newly saved CPU registers

Definition at line 91 of file ARMProcess.cpp.

References MemoryBlock::copy(), cpuState(), and m_cpuState.

Referenced by SunxiKernel::interrupt(), RaspberryKernel::interrupt(), and ARMKernel::trap().

Field Documentation

◆ m_cpuState

CPUState ARMProcess::m_cpuState
private

Contains all the CPU registers for this task.

Definition at line 99 of file ARMProcess.h.

Referenced by cpuState(), execute(), join(), reset(), and setCpuState().


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