56 lines
1.0 KiB
C
56 lines
1.0 KiB
C
#include <system.h>
|
|
#include "cpu/cpu.h"
|
|
#include "clock/clock.h"
|
|
#include "floppy/floppy.h"
|
|
#include <drivers/keyboard.h>
|
|
//BSOD
|
|
|
|
extern void _STOP_ERROR_SCREEN(ISR_stack_regs *);
|
|
|
|
void DriversInstall()
|
|
{
|
|
// Initialize CPU stuff (GDT, IDT etc)
|
|
i86_CpuInitialize();
|
|
|
|
// Install default fault handler
|
|
int i;
|
|
for (i=0; i<32; i++)
|
|
i86_IsrsInstallHandler(i, _STOP_ERROR_SCREEN);
|
|
|
|
|
|
// Start installing keyboard
|
|
i86_IrqInstallHandler(1, i86_KeyboardHandler);
|
|
KeyboardInstallA();
|
|
|
|
// Install PIT
|
|
i86_PitInitialize(100);
|
|
i86_IrqInstallHandler(0, i86_PitHandler);
|
|
|
|
// Finish installing keyboard
|
|
KeyboardInstallB();
|
|
|
|
// Install floppy driver
|
|
asm volatile ("sti");
|
|
i86_IrqInstallHandler(6, i86_FloppyHandler);
|
|
FloppyInstall();
|
|
|
|
}
|
|
|
|
void SystemShutDown()
|
|
{
|
|
i86_CpuShutdown();
|
|
// TODO: real shutdown
|
|
}
|
|
|
|
void SystemReboot()
|
|
{
|
|
unsigned char good = 0x02;
|
|
while ((good & 0x02) != 0)
|
|
good = inportb(0x64);
|
|
outportb(0x64, 0xFE);
|
|
|
|
asm volatile ("cli");
|
|
asm volatile ("hlt");
|
|
}
|
|
|