FreeNOS
|
ARM specific process implementation. More...
#include <ARMProcess.h>
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 CPUState * | cpuState () 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... | |
ProcessShares & | getShares () |
Get process shares. More... | |
State | getState () const |
Retrieves the current state. More... | |
MemoryContext * | getMemoryContext () |
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::Info & | getSleepTimer () 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... | |
MemoryContext * | m_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... | |
MemoryChannel * | m_kernelChannel |
Channel for sending kernel events to the Process. More... | |
ARM specific process implementation.
Definition at line 34 of file ARMProcess.h.
Constructor function.
id | Process Identifier |
entry | Initial program counter value. |
privileged | If true, the process has unlimited access to hardware. |
map | Memory mapping to use to create the process. |
Definition at line 28 of file ARMProcess.cpp.
|
virtual |
Destructor function.
Definition at line 82 of file ARMProcess.cpp.
const CPUState * ARMProcess::cpuState | ( | ) | const |
Retrieve saved CPU state.
Definition at line 86 of file ARMProcess.cpp.
References m_cpuState.
Referenced by setCpuState().
|
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.
|
virtual |
Initialize the Process.
Allocates various (architecture specific) resources, creates MMU context and stacks.
Reimplemented from Process.
Definition at line 33 of file ARMProcess.cpp.
References Memory::Range::access, Allocator::Range::address, Allocator::Range::alignment, ERROR, MemoryContext::initialize(), Process::initialize(), WeakSingleton< Kernel >::instance(), Process::m_entry, Process::m_map, Process::m_memoryContext, MemoryContext::mapRangeContiguous(), Process::MemoryMapError, Process::OutOfMemory, PAGESIZE, Memory::Range::phys, MemoryMap::range(), Memory::Readable, reset(), Memory::Range::size, Allocator::Range::size, MemoryContext::Success, Allocator::Success, Memory::User, MemoryMap::UserStack, and Memory::Writable.
|
virtual |
Complete waiting for another Process.
result | Exit 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.
|
virtual |
Restart execution at the given entry point.
entry | Address 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().
void ARMProcess::setCpuState | ( | const CPUState * | cpuState | ) |
Overwrite the saved CPU registers for this task.
cpuState | Pointer 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().
|
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().