18#include <FreeNOS/System.h>
19#include <FreeNOS/API.h>
27 : m_id(id), m_map(map), m_shares(id)
182 ERROR(
"failed to allocate kernel event channel object");
193 ERROR(
"failed to allocate kernel event channel pages");
ARMv6 cache management implementation.
virtual Result cleanData(Address addr)
Clean one data page.
static void * set(void *dest, int ch, unsigned count)
Fill memory with a constant byte.
static Size copy(void *dest, const void *src, Size count)
Copy memory from one place to another.
Unidirectional point-to-point channel using shared memory.
virtual Result flush()
Flush message buffers.
virtual Result write(const void *buffer)
Write a message.
Result setVirtual(const Address data, const Address feedback, const bool hardReset=true)
Set memory pages by virtual address.
Virtual memory abstract interface.
virtual Result unmap(Address virt)=0
Unmap a virtual address.
virtual Result releaseSection(const Memory::Range &range, const bool tablesOnly=false)=0
Release memory sections.
virtual Result findFree(Size size, MemoryMap::Region region, Address *virt) const
Find unused memory.
virtual Result map(Address virt, Address phys, Memory::Access access)=0
Map a physical page to a virtual address.
virtual Result mapRangeContiguous(Memory::Range *range)
Map a range of contiguous physical pages to virtual addresses.
Describes virtual memory map layout.
@ UserData
< User program data from libexec, e.g.
@ UserArgs
< Used for copying program arguments and file descriptors
@ UserShare
< User shared dynamic memory mappings
@ UserPrivate
< User private dynamic memory mappings
Memory::Range range(Region region) const
Get memory range for the given region.
Manages memory shares for a Process.
Result setMemoryContext(MemoryContext *context)
Set MemoryContext.
Result createShare(ProcessShares &instance, MemoryShare *share)
Represents a process which may run on the host.
const Timer::Info & getSleepTimer() const
Get sleep timer.
MemoryContext * m_memoryContext
MMU memory context.
Result wait(ProcessID id)
Let Process wait for other Process to terminate.
State
Represents the execution state of the Process.
Size m_wakeups
Number of wakeups received.
const ProcessID m_id
Process Identifier.
virtual Result join(const uint result)
Complete waiting for another Process.
uint getWaitResult() const
Get wait result.
Result stop()
Stop execution of this process.
MemoryChannel * m_kernelChannel
Channel for sending kernel events to the Process.
State m_state
Current process status.
ProcessID getWait() const
Get Wait ID.
Result resume()
Resume execution when this process is stopped.
Result sleep(const Timer::Info *timer, bool ignoreWakeups)
Stops the process for executing until woken up.
State getState() const
Retrieves the current state.
virtual Result initialize()
Initialize the Process.
ProcessShares m_shares
Contains virtual memory shares between this process and others.
ProcessID getID() const
Retrieve our ID number.
void setParent(ProcessID id)
Set parent process ID.
MemoryMap m_map
Virtual memory layout.
ProcessID getParent() const
Retrieve our parent ID.
MemoryContext * getMemoryContext()
Get MMU memory context.
virtual ~Process()
Destructor function.
bool m_privileged
Privilege level.
Process(ProcessID id, Address entry, bool privileged, const MemoryMap &map)
Constructor function.
ProcessShares & getShares()
Get process shares.
ProcessID m_waitId
Waits for exit of this Process.
Result wakeup()
Prevent process from sleeping.
Result raiseEvent(const struct ProcessEvent *event)
Raise kernel event.
bool operator==(Process *proc)
Compare two processes.
uint m_waitResult
Wait exit result of the other Process.
bool isPrivileged() const
Get privilege.
Address m_entry
Entry point of the program.
ProcessID m_parent
Parent process.
Timer::Info m_sleepTimer
Sleep timer value.
static Kernel * instance()
Retrieve the instance.
#define PAGESIZE
ARM uses 4K pages.
u32 ProcessID
Process Identification Number.
unsigned long Address
A memory address.
#define ERROR(msg)
Output an error message.
unsigned int uint
Unsigned integer number.
Describes a range of memory.
Size alignment
Alignment in bytes or ZERO for default alignment.
Address address
Starting address of the memory range.
Size size
Amount of memory in bytes.
Size size
Size in number of bytes.
Address phys
Physical address.
Address virt
Virtual address.
Access access
Page access flags.
Represents a process which may run on the host.
Timer information structure.