Go to the documentation of this file.
18 #include <FreeNOS/System.h>
19 #include <FreeNOS/Config.h>
224 i.current()->handler(state, i.current()->param, vec);
233 FATAL(
"failed to raise interrupt notification for IRQ #" << vec);
245 FATAL(
"failed to initialize BootImageStorage: result = " << (
int) result);
267 FATAL(
"failed to read BootSymbol: result = " << (
int) readResult);
280 FATAL(
"failed to load BootSymbol " << program.
name <<
": result = " << (
int) loadResult);
301 FATAL(
"failed to create boot program: " << program.
name);
322 FATAL(
"failed to read BootSegment for BootProgram " <<
323 program.
name <<
": result = " << (
int) result);
338 " for BootProgram " << program.
name <<
": result = " << (
int) mapResult);
353 " for BootProgram " << program.
name <<
": result = " << (
int) readResult);
370 FATAL(
"failed to allocate program arguments page");
378 FATAL(
"failed to map program arguments page");
static Size copy(void *dest, const void *src, Size count)
Copy memory from one place to another.
virtual Result allocate(Range &args)
Allocate physical memory.
API * m_api
API handlers object.
Represents a process which may run on the host.
void InterruptHandler(struct CPUState *state, ulong param, ulong vector)
Function which is called when the CPU is interrupted.
Virtual memory abstract interface.
virtual Result loadBootProgram(const BootImageStorage &bootImage, const BootSymbol &program)
Load a boot program.
unsigned long ulong
Unsigned long number.
#define NOTICE(msg)
Output a notice message.
CoreInfo * m_coreInfo
CoreInfo object for this core.
@ BootProgram
Executable program.
Represents a process which may run on the host.
static void * set(void *dest, int ch, unsigned count)
Fill memory with a constant byte.
Address bootImageSize
Boot image size in bytes.
Process * create(const Address entry, const MemoryMap &map, const bool readyToRun=false, const bool privileged=false)
Create a new Process.
@ BootPrivProgram
Privileged executable program.
Address heapAddress
Physical memory address of the kernel heap.
MemoryContext * getMemoryContext()
Get the current MMU context.
Timer * m_timer
Timer device.
virtual FileSystem::Result read(const u64 offset, void *buffer, const Size size) const
Reads data from the boot image.
BootSymbolType type
Type of boot symbol.
#define PAGESIZE
ARM uses 4K pages.
static Error initializeHeap()
Initialize heap.
Uses a BootImage as a storage provider.
u32 segmentsOffset
Offset in the segments table.
virtual Result send(const uint targetCoreId, const uint irq)
Send an inter-processor-interrupt (IPI).
struct InterruptHook InterruptHook
Interrupt hook class.
Memory::Range memory
Defines the physical memory available to the core.
int run()
Execute the kernel.
Address address
Starting address of the memory range.
const BootImage bootImage() const
Get BootImage header.
SplitAllocator * getAllocator()
Get physical memory allocator.
Address coreChannelAddress
Physical memory address of IPC channel for CoreServer of this core.
char name[BOOTIMAGE_NAMELEN]
Name of the boot symbol.
Size alignment
Alignment in bytes or ZERO for default alignment.
Generic Kernel API implementation.
#define BOOTIMAGE_NAMELEN
Maximum length of BootSymbol names.
Represents a configurable timer device.
virtual Result sendIRQ(const uint coreId, const uint irq)
Send a inter-processor-interrupt (IPI) to another core.
virtual void fill(T value)
Fill the Sequence with the given value.
ProcessManager * getProcessManager()
Get process manager.
unsigned int uint
Unsigned integer number.
Size size
Amount of memory in bytes.
uint coreId
Core identifier.
Allocator which separates kernel mapped memory at virtual and physical addresses.
#define MegaByte(v)
Convert megabytes to bytes.
Keeps growing allocated memory, and can't actually free memory (hence the name).
Memory mapping for the kernel and user processes on the ARM architecture.
void append(const char *str)
Append to buffered output.
#define FATAL(msg)
Output a critical message and terminate program immediatly.
MemoryContext * getMemoryContext()
Get MMU memory context.
IntController * m_intControl
Interrupt Controller.
CoreInfo * getCoreInfo()
Get CoreInfo.
Address phys
Physical address.
virtual bool hasCurrent() const
Check if there is a current item on the List.
Vector< List< InterruptHook * > * > m_interrupts
Interrupt handlers.
virtual Result enable(uint irq)=0
Enable hardware interrupt (IRQ).
Memory::Range range(Region region) const
Get memory range for the given region.
u32 segmentsTableOffset
Offset of the segments table.
virtual void enableIRQ(u32 irq, bool enabled)
Enable or disable an hardware interrupt (IRQ).
slong Error
Error code defined in Error.h.
u16 symbolTableCount
Number of entries in the symbols table.
Kernel(CoreInfo *info)
Constructor function.
unsigned int u32
Unsigned 32-bit number.
unsigned int Size
Any sane size indicator cannot go negative.
virtual Result disable(uint irq)=0
Disable hardware interrupt (IRQ).
static Log * instance()
Retrieve the instance.
Result schedule()
Schedule next process to run.
Address bootImageAddress
Boot image physical memory address.
#define BANNER
Print this banner per default on new Terminals.
virtual int insert(const T &item)
Adds the given item to the Vector, if possible.
FreeNOS kernel implementation.
Singleton design pattern: only one instance is allowed.
Contains all the CPU registers.
Per-Core information structure.
CoreInfo coreInfo
Local CoreInfo instance.
virtual FileSystem::Result initialize()
Initialize the Storage device.
Program embedded in the BootImage.
Describes a range of memory.
Result interruptNotify(const u32 vector)
Raise interrupt notifications for a interrupt vector.
static void setDefault(Allocator *alloc)
Makes the given Allocator the default.
#define assert(exp)
Insert program diagnostics.
#define ERROR(msg)
Output an error message.
Memory allocator which uses pools that each manage same-sized objects.
u32 virtualAddress
Virtual memory address to load the segment.
Result
Result code for filesystem Actions.
Size coreChannelSize
Size of the IPC channel in bytes.
virtual void hookIntVector(u32 vec, InterruptHandler h, ulong p)
Hooks a function to an hardware interrupt.
ProcessManager * m_procs
Process Manager.
Memory::Range kernel
Kernel memory range.
u16 segmentsCount
Number of contiguous entries in the segment table.
uint getBase() const
Get interrupt number base offset.
u32 symbolTableOffset
Offset of the symbol table.
Address toPhysical(const Address virt) const
Convert Address to physical pointer.
u32 entry
Program entry point (only valid for BootProgram symbols).
Address virt
Virtual address.
@ UserArgs
< Used for copying program arguments and file descriptors
BootImage contains executable programs to be loaded at system bootup.
u32 size
Total size of the segment.
SplitAllocator * m_alloc
Physical memory allocator.
Size heapSize
Size in bytes of the kernel heap.
virtual Result loadBootImage()
Loads the boot image.
Process * current()
Current process running.
Size size
Size in number of bytes.
u32 offset
Offset in the boot image of the segment contents.
Access access
Page access flags.
Timer * getTimer()
Get Timer.
virtual void executeIntVector(u32 vec, CPUState *state)
Execute an interrupt handler.
@ KernelData
< Kernel program data from libexec, e.g.
Address toVirtual(const Address phys) const
Convert Address to virtual pointer.
virtual Result mapRangeContiguous(Memory::Range *range)
Map a range of contiguous physical pages to virtual addresses.