OS/K works on real hw

This commit is contained in:
Adrien Bourmault 2019-04-28 15:30:54 +02:00
parent 836d967eee
commit 404f1ab20c
3 changed files with 9 additions and 19 deletions

View File

@ -120,19 +120,6 @@ void IdtSetup(void)
IdtSetGate(45, (ulong)isr45, codeSeg, 0x8E); IdtSetGate(45, (ulong)isr45, codeSeg, 0x8E);
IdtSetGate(46, (ulong)isr46, codeSeg, 0x8E); IdtSetGate(46, (ulong)isr46, codeSeg, 0x8E);
IdtSetGate(47, (ulong)isr47, codeSeg, 0x8E); IdtSetGate(47, (ulong)isr47, codeSeg, 0x8E);
IdtSetGate(48, (ulong)isr48, codeSeg, 0x8E);
IdtSetGate(49, (ulong)isr49, codeSeg, 0x8E);
IdtSetGate(50, (ulong)isr50, codeSeg, 0x8E);
IdtSetGate(51, (ulong)isr51, codeSeg, 0x8E);
IdtSetGate(52, (ulong)isr52, codeSeg, 0x8E);
IdtSetGate(53, (ulong)isr53, codeSeg, 0x8E);
IdtSetGate(54, (ulong)isr54, codeSeg, 0x8E);
IdtSetGate(55, (ulong)isr55, codeSeg, 0x8E);
IdtSetGate(56, (ulong)isr56, codeSeg, 0x8E);
IdtSetGate(57, (ulong)isr57, codeSeg, 0x8E);
IdtSetGate(58, (ulong)isr58, codeSeg, 0x8E);
IdtSetGate(59, (ulong)isr59, codeSeg, 0x8E);
IdtSetGate(60, (ulong)isr60, codeSeg, 0x8E);
// Load IDT // Load IDT
IdtInit(); IdtInit();
@ -172,8 +159,8 @@ static void EnablePIC(void)
IoWriteByteOnPort(0xa1, 0x28); IoWriteByteOnPort(0xa1, 0x28);
// Set ICW3 // Set ICW3
IoWriteByteOnPort(0x21, 0x0); IoWriteByteOnPort(0x21, 0x4);
IoWriteByteOnPort(0xa1, 0x0); IoWriteByteOnPort(0xa1, 0x2);
// Set ICW4 // Set ICW4
IoWriteByteOnPort(0x21, 0x1); IoWriteByteOnPort(0x21, 0x1);
@ -231,6 +218,7 @@ void IsrHandler(ISRFrame_t *regs)
} }
bprintf(BStdOut, "[ISR 0x%x] %s\n", regs->intNo, "Unknown ISR Exception"); bprintf(BStdOut, "[ISR 0x%x] %s\n", regs->intNo, "Unknown ISR Exception");
IoSendEOItoPIC(regs->intNo);
/* KeStartPanic("[ISR 0x%x] Unknown ISR Exception Abort\n" */ /* KeStartPanic("[ISR 0x%x] Unknown ISR Exception Abort\n" */
/* " Error code : 0x%x\n" */ /* " Error code : 0x%x\n" */
/* " RIP:\t\t%p\n" */ /* " RIP:\t\t%p\n" */

View File

@ -86,9 +86,11 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
IoPrintRtcTime(); IoPrintRtcTime();
KernLog("There was %d ticks\n", IoGetRtcTicks()); KernLog("There was %d ticks\n", IoGetRtcTicks());
for (uint i = 1; i < 2048*15 ; i++) { uint i = 0;
//IoPrintRtcTime(); while (1) {
if (!(i % 2048)) IoPrintRtcTime();
KePauseCPU(); KePauseCPU();
i++;
} }
//divideByZero(); //divideByZero();

View File

@ -184,9 +184,9 @@ static void UpdateRtcTime(void)
uchar minRemain, hourRemain, dayRemain; uchar minRemain, hourRemain, dayRemain;
IoRtcTime.sec = IoRtcTime.sec =
(uchar)(((ulong)IoRtcOriginTime.sec + (IoRtcTicks / frequency) + 1) % 60); (uchar)(((ulong)IoRtcOriginTime.sec + (IoRtcTicks / frequency)) % 60);
minRemain = minRemain =
(uchar)(((ulong)IoRtcOriginTime.sec + (IoRtcTicks / frequency) + 1) / 60); (uchar)(((ulong)IoRtcOriginTime.sec + (IoRtcTicks / frequency)) / 60);
IoRtcTime.min = IoRtcTime.min =
(uchar)(((ulong)IoRtcOriginTime.min + minRemain) % 60); (uchar)(((ulong)IoRtcOriginTime.min + minRemain) % 60);