18#include <FreeNOS/System.h>
19#include <FreeNOS/ProcessManager.h>
38 else if (!(proc = procs->
get(procID)))
54 ERROR(
"failed to lookup virtual address " << (
void *) range->
virt <<
55 ": " << (
int) memResult);
61 range->
phys += range->
virt & ~PAGEMASK;
71 ERROR(
"failed to find free virtual address in UserPrivate: " <<
75 range->
virt += range->
phys & ~PAGEMASK;
84 ERROR(
"failed to map memory range " << (
void *)range->
virt <<
"->" <<
85 (
void *) range->
phys <<
": " << (
int) memResult);
94 ERROR(
"failed to unmap range at virtual address " << (
void *)range->
virt <<
95 ": " << (
int) memResult);
104 ERROR(
"failed to release range at virtual address " << (
void *)range->
virt <<
105 ": " << (
int) memResult);
114 ERROR(
"failed to release sections at virtual address " << (
void *)range->
virt <<
115 ": " << (
int) memResult);
131 ERROR(
"failed to invalidate cache at address " << (
void *) range->
virt <<
132 ": result = " << (
int) r);
164 ERROR(
"address " << (
void *)addr <<
" is already allocated");
169 ERROR(
"failed to allocate " << (
void *)addr <<
", result = " << (
int)allocResult);
Result
Enumeration of generic kernel API result codes.
ARMv6 cache management implementation.
virtual Result invalidateAddress(Type type, Address addr)
Invalidate one memory page.
virtual Result cleanInvalidate(Type type)
Clean and invalidate entire cache.
Result
Allocation results.
virtual Result cleanData(Address addr)
Clean one data page.
SplitAllocator * getAllocator()
Get physical memory allocator.
ProcessManager * getProcessManager()
Get process manager.
Virtual memory abstract interface.
virtual Result mapRangeSparse(Memory::Range *range)
Map and allocate a range of sparse (non-contiguous) physical pages to virtual addresses.
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 unmapRange(Memory::Range *range)
Unmaps a range of virtual memory.
virtual Result releaseRange(Memory::Range *range)=0
Release a range of physical memory by its virtual memory pages.
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.
@ UserPrivate
< User private dynamic memory mappings
Represents a process which may run on the host.
Process * get(const ProcessID id)
Retrieve a Process by it's ID.
Process * current()
Current process running.
Represents a process which may run on the host.
MemoryContext * getMemoryContext()
Get MMU memory context.
Allocator which separates kernel mapped memory at virtual and physical addresses.
virtual Result allocate(Range &args)
Allocate physical memory.
bool isAllocated(const Address page) const
Check if a physical page is allocated.
static Kernel * instance()
Retrieve the instance.
API::Result VMCtlHandler(const ProcessID procID, const MemoryOperation op, Memory::Range *range)
Kernel handler prototype.
MemoryOperation
Memory operations which may be used as an argument to VMCtl().
#define PAGESIZE
ARM uses 4K pages.
#define PAGEMASK
Mask to find the page.
#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.
#define DEBUG(msg)
Output a debug message to standard output.
Size size
Size in number of bytes.
Address phys
Physical address.
Address virt
Virtual address.
Access access
Page access flags.