18#include <FreeNOS/System.h>
41 for (
Size i = 0; i < size; i++)
103 ERROR(
"failed to allocate MemoryShare");
110 share->
tagId = tagId;
120 ERROR(
"failed to translate share virtual address at " <<
121 (
void *)share->
range.
virt <<
": " << (
int)result);
130 ERROR(
"failed to retrieve share access permissions for virtual address " <<
131 (
void *)share->
range.
virt <<
": " << (
int)result);
162 if (remoteShare && !remoteShare->
attached)
171 ERROR(
"failed to allocate MemoryShare for local process");
179 ERROR(
"failed to allocate MemoryShare for remote process");
191 ERROR(
"failed to allocate pages for MemoryShare");
213 ERROR(
"failed to map MemoryShare in local process");
231 ERROR(
"failed to map MemoryShare in remote process");
238 instance.
m_shares.insert(idx, remoteShare);
245 event.number =
m_pid;
259 for (
Size i = 0; i < size; i++)
292 for (
Size i = 0; i < size; i++)
340 for (
Size i = 0; i < size; i++)
ARMv6 cache management implementation.
virtual Result release(const Address addr)
Release memory.
virtual Result cleanData(Address addr)
Clean one data page.
CoreInfo * getCoreInfo()
Get CoreInfo.
SplitAllocator * getAllocator()
Get physical memory allocator.
ProcessManager * getProcessManager()
Get process manager.
virtual bool hasCurrent() const
Check if there is a current item on the List.
Simple linked list template class.
void append(T t)
Insert an item at the end of the list.
virtual bool contains(const T t) const
Check whether an element is on the List.
Size size() const
Get the size of the list.
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.
Virtual memory abstract interface.
virtual Result findFree(Size size, MemoryMap::Region region, Address *virt) const
Find unused memory.
virtual Result unmapRange(Memory::Range *range)
Unmaps a range of virtual memory.
virtual Result mapRangeContiguous(Memory::Range *range)
Map a range of contiguous physical pages to virtual addresses.
virtual Result access(Address virt, Memory::Access *access) const =0
Get Access flags for a virtual address.
virtual Result lookup(Address virt, Address *phys) const =0
Translate virtual address to physical address.
@ UserShare
< User shared dynamic memory mappings
Represents a process which may run on the host.
Result raiseEvent(Process *proc, const struct ProcessEvent *event)
Raise kernel event for a Process.
Process * get(const ProcessID id)
Retrieve a Process by it's ID.
Manages memory shares for a Process.
const ProcessID getProcessID() const
Get process.
Result readShare(MemoryShare *share)
Read memory share by Process, Core and Tag IDs.
Result setMemoryContext(MemoryContext *context)
Set MemoryContext.
Result createShare(ProcessShares &instance, MemoryShare *share)
ProcessID m_pid
ProcessID associated to these shares.
MemoryShare * findShare(const ProcessID pid, const Size coreId, const Size tagId)
Retrieve MemoryShare object.
MemoryContext * m_memory
MemoryContext instance.
Result releaseShare(MemoryShare *share, Size idx)
Release one memory share.
ProcessShares(ProcessID pid)
Constructor.
virtual ~ProcessShares()
Destructor function.
Result removeShares(ProcessID pid)
Remove all shares for the given ProcessID.
MemoryContext * getMemoryContext()
Get MemoryContext object.
Index< MemoryShare, MaximumMemoryShares > m_shares
Contains all memory shares.
Represents a process which may run on the host.
ProcessShares & getShares()
Get process shares.
static Kernel * instance()
Retrieve the instance.
#define PAGESIZE
ARM uses 4K pages.
#define PAGEMASK
Mask to find the page.
CoreInfo coreInfo
Local CoreInfo instance.
#define assert(exp)
Insert program diagnostics.
u32 ProcessID
Process Identification Number.
unsigned long Address
A memory address.
#define ERROR(msg)
Output an error message.
unsigned int Size
Any sane size indicator cannot go negative.
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.
uint coreId
Core identifier.
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.
ProcessShares::MemoryShare share
bool attached
True if the share is attached (used by both processes)
ProcessID pid
Remote process id for this share.
Size tagId
Share tag id is defined by the application.
Memory::Range range
Physical memory address range.
Size coreId
CoreId for the other process.