|
FreeNOS
|
Process which may execute on an Intel CPU. More...
#include <IntelProcess.h>
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... | |
| 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 | |
| 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::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... | |
Process which may execute on an Intel CPU.
Definition at line 38 of file IntelProcess.h.
Constructor function.
| id | Process Identifier. |
| entry | Initial EIP register value. |
| privileged | If true, the Process has unlimited access to hardware. |
| map | Virtual memory layout. |
Definition at line 25 of file IntelProcess.cpp.
|
virtual |
Destructor function.
Definition at line 92 of file IntelProcess.cpp.
References Kernel::getAllocator(), WeakSingleton< Kernel >::instance(), KernelStackSize, m_kernelStackBase, SplitAllocator::release(), and SplitAllocator::toPhysical().
|
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.
|
virtual |
Initialize the Process.
Allocates various (architecture specific) resources, creates MMU context and stacks.
Reimplemented from Process.
Definition at line 30 of file IntelProcess.cpp.
References Memory::Range::access, Allocator::Range::address, Allocator::Range::alignment, ERROR, MemoryContext::initialize(), Process::initialize(), WeakSingleton< Kernel >::instance(), KernelStackSize, Process::m_entry, m_kernelStackBase, 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 |
Restart execution at the given entry point.
| entry | Address to begin execution. |
Implements Process.
Definition at line 99 of file IntelProcess.cpp.
References IRQRegs0::cs, IRQRegs3::cs, SegRegs::ds, CPURegs::ebp, IRQRegs0::eflags, IRQRegs3::eflags, IRQRegs0::eip, IRQRegs3::eip, SegRegs::es, CPURegs::esp0, IRQRegs3::esp3, SegRegs::fs, SegRegs::gs, INTEL_EFLAGS_DEFAULT, INTEL_EFLAGS_IRQ, CPUState::irq, KERNEL_CS_SEL, KERNEL_DS_SEL, loadCoreState(), Process::m_entry, m_kernelStack, m_kernelStackBase, Process::m_map, Process::m_privileged, MEMALIGN, MemoryMap::range(), CPUState::regs, CPUState::seg, MemoryBlock::set(), Memory::Range::size, SegRegs::ss0, IRQRegs3::ss3, USER_CS_SEL, USER_DS_SEL, MemoryMap::UserStack, and Memory::Range::virt.
Referenced by initialize().
Size of the kernel stack.
Definition at line 43 of file IntelProcess.h.
Referenced by initialize(), and ~IntelProcess().
|
private |
Current kernel stack address (changes during execution).
Definition at line 89 of file IntelProcess.h.
|
private |
Base kernel stack (fixed)
Definition at line 92 of file IntelProcess.h.
Referenced by execute(), initialize(), reset(), and ~IntelProcess().
1.8.17