18#include <FreeNOS/System.h>
42 ERROR(
"failed to create memory context");
50 ERROR(
"failed to initialize MemoryContext: result = " << (
int) memResult);
63 ERROR(
"failed to allocate user stack");
71 ERROR(
"failed to map user stack");
132 asm volatile (
"ldr sp, =(svcStack + (4096*4))\n"
134 "ldr r0, =loadCoreState0\n"
ARM virtual memory implementation.
void setCpuState(const CPUState *cpuState)
Overwrite the saved CPU registers for this task.
virtual ~ARMProcess()
Destructor function.
const CPUState * cpuState() const
Retrieve saved CPU state.
CPUState m_cpuState
Contains all the CPU registers for this task.
virtual Result join(const uint result)
Complete waiting for another Process.
virtual void reset(const Address entry)
Restart execution at the given entry point.
virtual void execute(Process *previous)
Allow the Process to run on the CPU.
virtual Result initialize()
Initialize the Process.
ARMProcess(ProcessID id, Address entry, bool privileged, const MemoryMap &map)
Constructor function.
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 Result initialize()=0
Initialize the MemoryContext.
virtual Result activate(bool initializeMMU=false)=0
Activate the MemoryContext.
virtual Result mapRangeContiguous(Memory::Range *range)
Map a range of contiguous physical pages to virtual addresses.
Describes virtual memory map layout.
Memory::Range range(Region region) const
Get memory range for the given region.
Represents a process which may run on the host.
MemoryContext * m_memoryContext
MMU memory context.
virtual Result join(const uint result)
Complete waiting for another Process.
virtual Result initialize()
Initialize the Process.
MemoryMap m_map
Virtual memory layout.
bool m_privileged
Privilege level.
Address m_entry
Entry point of the program.
static Kernel * instance()
Retrieve the instance.
#define PAGESIZE
ARM uses 4K pages.
#define USR_MODE
ARM Program Status Register (CPSR)
u32 ProcessID
Process Identification Number.
unsigned long Address
A memory address.
#define ERROR(msg)
Output an error message.
unsigned int uint
Unsigned integer number.
unsigned char u8
Unsigned 8-bit 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.
Contains all the CPU registers.
Size size
Size in number of bytes.
Address phys
Physical address.
Address virt
Virtual address.
Access access
Page access flags.