Go to the documentation of this file.
18 #include <FreeNOS/ProcessManager.h>
19 #include <FreeNOS/System.h>
58 for (
int i = 0; i < 17; i++)
63 for (
int i = 17; i < 256; i++)
90 NOTICE(
"Using APIC timer");
108 NOTICE(
"Using PIT timer");
virtual void enableIRQ(u32 irq, bool enabled)
Enable or disable an hardware interrupt (IRQ).
Size getFrequency() const
Get timer frequency.
Intel virtual memory implementation.
static void clocktick(CPUState *state, ulong param, ulong vector)
i8253 system clock interrupt handler.
C void executeInterrupt(CPUState state)
virtual Result clear(uint irq)=0
Clear hardware interrupt (IRQ).
virtual Result allocate(Range &args)
Allocate physical memory.
uint getCounter() const
Get timer initial counter.
Represents a process which may run on the host.
Result invoke(Number number, ulong arg1, ulong arg2, ulong arg3, ulong arg4, ulong arg5)
Execute a generic API function.
unsigned long ulong
Unsigned long number.
#define NOTICE(msg)
Output a notice message.
CoreInfo * m_coreInfo
CoreInfo object for this core.
static void * set(void *dest, int ch, unsigned count)
Fill memory with a constant byte.
virtual IntController::Result clear(uint irq)
Clear hardware interrupt (IRQ).
Timer * m_timer
Timer device.
ProcessID getID() const
Retrieve our ID number.
IntelKernel(CoreInfo *info)
Constructor function.
#define PAGESIZE
ARM uses 4K pages.
virtual Timer::Result stop()
Stop the APIC timer.
#define ltr(sel)
Loads the Task State Register (LTR) with the given segment.
unsigned long Address
A memory address.
Memory::Range memory
Defines the physical memory available to the core.
void param(Terminal *term, int key, int value)
Set terminal parameters.
Number
Enumeration of supported generic kernel API functions.
static void trap(CPUState *state, ulong param, ulong vector)
Kernel trap handler (system calls).
volatile u32 readCR3() const
Read the CR3 register.
ProcessManager * getProcessManager()
Get process manager.
IntelPIT m_pit
PIT timer instance.
TSS kernelTss
Task State Segment.
uint coreId
Core identifier.
#define MegaByte(v)
Convert megabytes to bytes.
Intel's Task State Segment.
#define C
Used to define external C functions.
#define FATAL(msg)
Output a critical message and terminate program immediatly.
IntController * m_intControl
Interrupt Controller.
Address phys
Physical address.
Timer::Result start(IntelPIT *pit)
Start the timer using PIT as reference timer.
virtual void enableIRQ(u32 irq, bool enabled)
Enable or disable an hardware interrupt (IRQ).
static void interrupt(CPUState *state, ulong param, ulong vector)
Default interrupt handler.
#define KERNEL_TSS
Kernel Task State Segment.
Implements an x86 compatible kernel.
unsigned int u32
Unsigned 32-bit number.
void logException(CPUState *state) const
Log a CPU exception.
unsigned int Size
Any sane size indicator cannot go negative.
static Kernel * instance()
Retrieve the instance.
Result schedule()
Schedule next process to run.
Result initialize()
Initialize the PIC.
FreeNOS kernel implementation.
IntelAPIC m_apic
APIC instance (used if available)
Contains all the CPU registers.
Per-Core information structure.
CoreInfo coreInfo
Local CoreInfo instance.
uint timerCounter
Arch-specific timer counter.
IntelPIC m_pic
PIC instance.
virtual Result initialize()
Initialize the MemoryContext.
#define assert(exp)
Insert program diagnostics.
static void exception(CPUState *state, ulong param, ulong vector)
Called when the CPU detects a fault.
C void(* interruptRun)(CPUState state)
Process an interrupt.
virtual void hookIntVector(u32 vec, InterruptHandler h, ulong p)
Hooks a function to an hardware interrupt.
void remove(Process *proc, const uint exitStatus=0)
Remove a Process.
uint getBase() const
Get interrupt number base offset.
Segment gdt[]
Global Descriptor Table.
virtual Result setFrequency(Size hertz)
Set interrupt frequency.
virtual Result activate(bool initializeMMU=false)
Activate the MemoryContext.
Size getInterrupt() const
Get timer interrupt number.
Defines memory map for Intel systems.
SplitAllocator * m_alloc
Physical memory allocator.
struct TSS TSS
Intel's Task State Segment.
Process * current()
Current process running.
virtual void executeIntVector(u32 vec, CPUState *state)
Execute an interrupt handler.
virtual Timer::Result initialize()
Initialize the APIC.
virtual Result tick()
Process timer tick.