1

Implement most InterruptService functionality

This commit is contained in:
2022-12-08 02:20:49 +01:00
parent 4b84c254ff
commit 1cfc94199c
2 changed files with 79 additions and 0 deletions

View File

@ -1 +1,45 @@
#include "InterruptService.h"
#include "kernel/exception/Bluescreen.h"
#include "device/cpu/CPU.h"
#include "kernel/system/System.h"
// TODO: Move to interrupt_interface or sth.
extern "C" void int_disp(uint8_t vector);
void int_disp(uint8_t vector) {
/* hier muss Code eingefuegt werden */
// Exception
if (vector < 32) {
bs_dump(vector);
Device::CPU::halt();
}
Kernel::System::getService<Kernel::InterruptService>().dispatchInterrupt(
static_cast<Kernel::IntDispatcher::Vector>(vector));
}
namespace Kernel {
void InterruptService::assignInterrupt(IntDispatcher::Vector vector, ISR &isr) {
intDispatcher.assign(vector, isr);
}
void InterruptService::dispatchInterrupt(IntDispatcher::Vector vector) {
intDispatcher.dispatch(vector);
}
void InterruptService::allowInterrupt(Device::PIC::Irq irq) {
Device::PIC::allow(irq);
}
void InterruptService::forbidInterrupt(Device::PIC::Irq irq) {
Device::PIC::forbid(irq);
}
bool InterruptService::status(Device::PIC::Irq irq) {
return Device::PIC::status(irq);
}
}

View File

@ -1,4 +1,39 @@
#ifndef CHURLOS_INTERRUPTSERVICE_H
#define CHURLOS_INTERRUPTSERVICE_H
#include "Service.h"
#include "kernel/interrupt/IntDispatcher.h"
#include "device/interrupt/PIC.h"
namespace Kernel {
class InterruptService : public Service {
public:
static const constexpr uint8_t ID = 0;
public:
InterruptService() = default;
// TODO: Rest of constructors
void assignInterrupt(IntDispatcher::Vector vector, ISR &isr);
void dispatchInterrupt(IntDispatcher::Vector vector);
bool isSpurious(IntDispatcher::Vector vector);
void allowInterrupt(Device::PIC::Irq irq);
void forbidInterrupt(Device::PIC::Irq irq);
bool status(Device::PIC::Irq irq);
void sendEndOfInterrupt();
private:
Kernel::IntDispatcher intDispatcher;
};
}
#endif //CHURLOS_INTERRUPTSERVICE_H