Go to the documentation of this file.
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++)
static Size copy(void *dest, const void *src, Size count)
Copy memory from one place to another.
Result raiseEvent(Process *proc, const struct ProcessEvent *event)
Raise kernel event for a Process.
virtual ~ProcessShares()
Destructor function.
Size tagId
Share tag id is defined by the application.
Represents a process which may run on the host.
Virtual memory abstract interface.
virtual Result unmapRange(Memory::Range *range)
Unmaps a range of virtual memory.
virtual Result access(Address virt, Memory::Access *access) const =0
Get Access flags for a virtual address.
ProcessID pid
Remote process id for this share.
Represents a process which may run on the host.
static void * set(void *dest, int ch, unsigned count)
Fill memory with a constant byte.
#define PAGEMASK
Mask to find the page.
#define PAGESIZE
ARM uses 4K pages.
u32 ProcessID
Process Identification Number.
@ UserShare
< User shared dynamic memory mappings
unsigned long Address
A memory address.
Address address
Starting address of the memory range.
SplitAllocator * getAllocator()
Get physical memory allocator.
Memory::Range range
Physical memory address range.
Size alignment
Alignment in bytes or ZERO for default alignment.
Size coreId
CoreId for the other process.
ProcessManager * getProcessManager()
Get process manager.
ProcessShares & getShares()
Get process shares.
Size size
Amount of memory in bytes.
uint coreId
Core identifier.
virtual Result lookup(Address virt, Address *phys) const =0
Translate virtual address to physical address.
CoreInfo * getCoreInfo()
Get CoreInfo.
Represents a process which may run on the host.
Address phys
Physical address.
virtual bool hasCurrent() const
Check if there is a current item on the List.
ARMv6 cache management implementation.
void append(T t)
Insert an item at the end of the list.
virtual Result findFree(Size size, MemoryMap::Region region, Address *virt) const
Find unused memory.
ProcessShares(ProcessID pid)
Constructor.
unsigned int Size
Any sane size indicator cannot go negative.
static Kernel * instance()
Retrieve the instance.
virtual Result cleanData(Address addr)
Clean one data page.
Process * get(const ProcessID id)
Retrieve a Process by it's ID.
Result readShare(MemoryShare *share)
Read memory share by Process, Core and Tag IDs.
Result createShare(ProcessShares &instance, MemoryShare *share)
MemoryShare * findShare(const ProcessID pid, const Size coreId, const Size tagId)
Retrieve MemoryShare object.
CoreInfo coreInfo
Local CoreInfo instance.
bool attached
True if the share is attached (used by both processes)
ProcessShares::MemoryShare share
Describes a range of memory.
MemoryContext * getMemoryContext()
Get MemoryContext object.
#define assert(exp)
Insert program diagnostics.
#define ERROR(msg)
Output an error message.
Result releaseShare(MemoryShare *share, Size idx)
Release one memory share.
virtual Result release(const Address addr)
Release memory.
virtual bool contains(const T t) const
Check whether an element is on the List.
Address virt
Virtual address.
const ProcessID getProcessID() const
Get process.
Index< MemoryShare, MaximumMemoryShares > m_shares
Contains all memory shares.
Simple linked list template class.
Size size
Size in number of bytes.
Access access
Page access flags.
MemoryContext * m_memory
MemoryContext instance.
Result removeShares(ProcessID pid)
Remove all shares for the given ProcessID.
virtual Result mapRangeContiguous(Memory::Range *range)
Map a range of contiguous physical pages to virtual addresses.
Result setMemoryContext(MemoryContext *context)
Set MemoryContext.
ProcessID m_pid
ProcessID associated to these shares.
Manages memory shares for a Process.