FreeNOS
|
Implements an x86 compatible kernel. More...
#include <IntelKernel.h>
Public Member Functions | |
IntelKernel (CoreInfo *info) | |
Constructor function. More... | |
virtual void | enableIRQ (u32 irq, bool enabled) |
Enable or disable an hardware interrupt (IRQ). More... | |
Public Member Functions inherited from Kernel | |
Kernel (CoreInfo *info) | |
Constructor function. More... | |
SplitAllocator * | getAllocator () |
Get physical memory allocator. More... | |
ProcessManager * | getProcessManager () |
Get process manager. More... | |
API * | getAPI () |
Get API. More... | |
MemoryContext * | getMemoryContext () |
Get the current MMU context. More... | |
CoreInfo * | getCoreInfo () |
Get CoreInfo. More... | |
Timer * | getTimer () |
Get Timer. More... | |
int | run () |
Execute the kernel. More... | |
virtual Result | sendIRQ (const uint coreId, const uint irq) |
Send a inter-processor-interrupt (IPI) to another core. More... | |
virtual void | hookIntVector (u32 vec, InterruptHandler h, ulong p) |
Hooks a function to an hardware interrupt. More... | |
virtual void | executeIntVector (u32 vec, CPUState *state) |
Execute an interrupt handler. More... | |
virtual Result | loadBootImage () |
Loads the boot image. More... | |
Public Member Functions inherited from WeakSingleton< Kernel > | |
WeakSingleton (Kernel *obj) | |
Constructor. More... | |
Static Private Member Functions | |
static void | exception (CPUState *state, ulong param, ulong vector) |
Called when the CPU detects a fault. More... | |
static void | interrupt (CPUState *state, ulong param, ulong vector) |
Default interrupt handler. More... | |
static void | trap (CPUState *state, ulong param, ulong vector) |
Kernel trap handler (system calls). More... | |
static void | clocktick (CPUState *state, ulong param, ulong vector) |
i8253 system clock interrupt handler. More... | |
Private Attributes | |
IntelPIT | m_pit |
PIT timer instance. More... | |
IntelAPIC | m_apic |
APIC instance (used if available) More... | |
IntelPIC | m_pic |
PIC instance. More... | |
Additional Inherited Members | |
Public Types inherited from Kernel | |
enum | Result { Success, InvalidBootImage, ProcessError, IOError } |
Result codes. More... | |
Static Public Member Functions inherited from Kernel | |
static Error | initializeHeap () |
Initialize heap. More... | |
Static Public Member Functions inherited from WeakSingleton< Kernel > | |
static Kernel * | instance () |
Retrieve the instance. More... | |
Protected Attributes inherited from Kernel | |
SplitAllocator * | m_alloc |
Physical memory allocator. More... | |
ProcessManager * | m_procs |
Process Manager. More... | |
API * | m_api |
API handlers object. More... | |
CoreInfo * | m_coreInfo |
CoreInfo object for this core. More... | |
Vector< List< InterruptHook * > * > | m_interrupts |
Interrupt handlers. More... | |
IntController * | m_intControl |
Interrupt Controller. More... | |
Timer * | m_timer |
Timer device. More... | |
Implements an x86 compatible kernel.
Definition at line 43 of file IntelKernel.h.
IntelKernel::IntelKernel | ( | CoreInfo * | info | ) |
Constructor function.
Definition at line 37 of file IntelKernel.cpp.
References IntelPaging::activate(), SplitAllocator::allocate(), Segment::baseHigh, Segment::baseLow, Segment::baseMid, TSS::bitmap, clocktick(), CoreInfo::coreId, enableIRQ(), TSS::esp0, exception(), executeInterrupt(), gdt, IntController::getBase(), IntelAPIC::getCounter(), Timer::getFrequency(), Timer::getInterrupt(), Segment::granularity, Kernel::hookIntVector(), IntelPaging::initialize(), IntelPIC::initialize(), IntelAPIC::initialize(), interrupt(), interruptRun, KERNEL_DS_SEL, KERNEL_TSS, KERNEL_TSS_SEL, kernelTss, Segment::limitHigh, Segment::limitLow, ltr, Kernel::m_alloc, m_apic, Kernel::m_coreInfo, Kernel::m_intControl, m_pic, m_pit, Kernel::m_timer, MegaByte, CoreInfo::memory, NOTICE, PAGESIZE, Memory::Range::phys, Segment::present, Segment::privilege, IntelCore::readCR3(), MemoryBlock::set(), IntelPIT::setFrequency(), TSS::ss0, IntelAPIC::start(), Timer::Success, CoreInfo::timerCounter, trap(), and Segment::type.
i8253 system clock interrupt handler.
state | CPU registers on time of interrupt. |
param | Not used. |
vector | Not used. |
Definition at line 192 of file IntelKernel.cpp.
References IntelAPIC::clear(), enableIRQ(), Timer::getInterrupt(), Kernel::getProcessManager(), WeakSingleton< Kernel >::instance(), m_apic, Kernel::m_timer, ProcessManager::schedule(), and Timer::tick().
Referenced by IntelKernel().
|
virtual |
Enable or disable an hardware interrupt (IRQ).
irq | IRQ number. |
enabled | True to enable, and false to disable. |
Reimplemented from Kernel.
Definition at line 140 of file IntelKernel.cpp.
References Kernel::enableIRQ(), Timer::getInterrupt(), m_apic, IntelAPIC::start(), and IntelAPIC::stop().
Referenced by clocktick(), and IntelKernel().
Called when the CPU detects a fault.
state | Contains CPU registers, interrupt vector and error code. |
param | Not used. |
vector | Not used. |
Definition at line 155 of file IntelKernel.cpp.
References assert, CoreInfo::coreId, coreInfo, ProcessManager::current(), FATAL, Process::getID(), Kernel::getProcessManager(), WeakSingleton< Kernel >::instance(), IntelCore::logException(), ProcessManager::remove(), ProcessManager::schedule(), and ZERO.
Referenced by IntelKernel().
Default interrupt handler.
state | Contains CPU registers, interrupt vector and error code. |
param | Not used. |
vector | Not used. |
Definition at line 168 of file IntelKernel.cpp.
References IntController::clear(), IntController::getBase(), WeakSingleton< Kernel >::instance(), Kernel::m_intControl, and CPUState::vector.
Referenced by IntelKernel().
Kernel trap handler (system calls).
state | Contains the arguments for the APIHandler, in CPU registers. |
param | Not used. |
vector | Not used. |
Definition at line 180 of file IntelKernel.cpp.
References CPURegs::eax, CPURegs::ebx, CPURegs::ecx, CPURegs::edi, CPURegs::edx, CPURegs::esi, Kernel::getAPI(), WeakSingleton< Kernel >::instance(), API::invoke(), and CPUState::regs.
Referenced by IntelKernel().
|
private |
APIC instance (used if available)
Definition at line 104 of file IntelKernel.h.
Referenced by clocktick(), enableIRQ(), and IntelKernel().
|
private |
|
private |