Adds ./lists for S-Macro listings.

This commit is contained in:
Felix Queißner 2016-05-06 19:24:12 +02:00
parent d9d283e5ac
commit 949e1f8e31
11 changed files with 88 additions and 5 deletions

View file

@ -6,7 +6,7 @@ LD=ld
IDT_DISPATCH = _ZN3IDT8dispatchEP8CpuState
FLAGS = -DIDT_DISPATCH=$(IDT_DISPATCH) -ffreestanding -m32 -Werror -Wall -iquote include -O3
FLAGS = -DIDT_DISPATCH=$(IDT_DISPATCH) -ffreestanding -m32 -Werror -Wall -iquote include -iquote lists -O3
ASFLAGS = $(FLAGS)
CFLAGS = $(FLAGS)
CXXFLAGS = $(FLAGS) -std=c++14 -fno-rtti -fno-exceptions -fno-leading-underscore -fno-use-cxa-atexit -nostdlib -fno-builtin

View file

@ -0,0 +1,10 @@
#pragma once
#include "enums.hpp"
enum class Exception
{
#define EXCEPTION(num, shorthand, ident, desc, type) ident = num,
#include "exceptions.lst"
#undef EXCEPTION
};

View file

@ -0,0 +1,2 @@
#pragma once

View file

@ -16,7 +16,7 @@ isr_\nr:
#define ISR(num) isr_stub num
#define ISR_ERR(num) isr_stub_with_err num
#include "interrupt-list.inc"
#include "interrupts.lst"
#undef ISR
#undef ISR_ERR

View file

View file

@ -0,0 +1,32 @@
EXCEPTION(0x00, DE, DiviceByZero, Divide by Zero, Fault)
EXCEPTION(0x01, DB, Debug, Debug, Fault | Trap)
EXCEPTION(0x02, NMI, NonMaskableInterrupt, Non Maskable Interrupt, None)
EXCEPTION(0x03, BP, Breakpoint, Breakpoint, Trap)
EXCEPTION(0x04, OF, Overflow, Overflow, Trap)
EXCEPTION(0x05, BR, BoundRange, Bound Range, Fault)
EXCEPTION(0x06, UD, InvalidOpcode, Invalid Opcode, Fault)
EXCEPTION(0x07, NM, DeviceNotAvailable, Device Not Available, Fault)
EXCEPTION(0x08, DF, DoubleFault, Double Fault, Abort)
EXCEPTION(0x09, CSO, CoprocessorSegmentOverrun, Coprocessor Segment Overrun, None)
EXCEPTION(0x0a, TS, InvalidTSS, Invalid TSS, Fault)
EXCEPTION(0x0b, NP, SegmentNotPresent, Segment not Present, Fault)
EXCEPTION(0x0c, SS, StackFault, Stack Fault, Fault)
EXCEPTION(0x0d, GP, GeneralProtectionFault, General Protection, Fault)
EXCEPTION(0x0e, PF, PageFault, Page Fault, Fault)
EXCEPTION(0x0f, XX, Reserved0, Reserved, None)
EXCEPTION(0x10, MF, x87FloatingPoint, x87 Floating Point, Fault)
EXCEPTION(0x11, AC, AlignmentCheck, Alignment Check, Fault)
EXCEPTION(0x12, MC, MachineCheck, Machine Check, Abort)
EXCEPTION(0x13, XF, SIMDFloatingPoint, SIMD Floating Point, Fault)
EXCEPTION(0x14, XX, Reserved1, Reserved, None)
EXCEPTION(0x15, XX, Reserved2, Reserved, None)
EXCEPTION(0x16, XX, Reserved3, Reserved, None)
EXCEPTION(0x17, XX, Reserved4, Reserved, None)
EXCEPTION(0x18, XX, Reserved5, Reserved, None)
EXCEPTION(0x19, XX, Reserved6, Reserved, None)
EXCEPTION(0x1a, XX, Reserved7, Reserved, None)
EXCEPTION(0x1b, XX, Reserved8, Reserved, None)
EXCEPTION(0x1c, XX, Reserved9, Reserved, None)
EXCEPTION(0x1d, XX, Reserved10, Reserved, None)
EXCEPTION(0x1e, SX, SecuritySensitive, Security-sensitive event in Host, Fault)
EXCEPTION(0x1f, XX, Reserved11, Reserved, None)

View file

@ -0,0 +1,16 @@
IRQ(0, Timer, Programmable Interval Timer)
IRQ(1, PrimaryPS2, Erster PS/2 Port des Keyboard Controller (meist PS/2 Tastatur))
IRQ(2, SecondaryPIC, Verbindung zum zweiten PIC)
IRQ(3, RS232Even, RS-232 Port 2/4)
IRQ(4, RS232Odd, RS-232 Port 1/3)
IRQ(5, SecondaryLPT, LPT 2)
IRQ(6, Floppy, Floppy Disk Controller)
IRQ(7, PrimaryLPT, LPT 1 und Spurious Interrupt)
IRQ(8, RTC, RTC (CMOS Real Time Clock))
IRQ(9, Free, frei)
IRQ(10, FourthIDE, vierter ATA/ATAPI/(E)IDE)
IRQ(11, ThirdIDE, dritter ATA/ATAPI/(E)IDE)
IRQ(12, SecondaryPS2, Zweiter PS/2 Port des Keyboard Controller (meist PS/2 Maus))
IRQ(13, FPU, FPU)
IRQ(14, PrimaryIDE, Primärer ATA/ATAPI/(E)IDE)
IRQ(15, SecondaryIDE, Sekundärer ATA/ATAPI/(E)IDE und Spurious Interrupt)

View file

@ -1,5 +1,26 @@
#include "bsod.hpp"
#include "console.hpp"
#include "exceptions.hpp"
static const char *toString(int interrupt)
{
if(interrupt <= 0x1f) {
switch(interrupt) {
#define EXCEPTION(num, shorthand, ident, desc, type) case num: return #desc;
#include "exceptions.lst"
#undef EXCEPTION
default: return "Unknown Exception";
}
}
if(interrupt >= 0x20 && interrupt <= 0x2F) {
switch(interrupt - 0x20) {
#define IRQ(num, ident, desc) case num: return #desc;
#include "irqs.lst"
#undef IRQ
}
}
return "Unknown Interrupt";
};
void BSOD::die(Error code, const char *msg)
{
@ -29,7 +50,7 @@ void BSOD::die(Error code, const char *msg, CpuState *cpu)
<< "esi = " << hex(cpu->esi) << "\n"
<< "edi = " << hex(cpu->edi) << "\n"
<< "ebp = " << hex(cpu->ebp) << "\n"
<< "intr = " << cpu->interrupt << "\n"
<< "intr = " << cpu->interrupt << "(" << toString(cpu->interrupt) << ")" << "\n"
<< "error = " << cpu->error << "\n"
<< "eip = " << hex(cpu->eip) << "\n"
<< "cs = " << hex(cpu->cs) << "\n"

View file

@ -5,7 +5,7 @@
#define ISR(num) extern "C" void isr_##num();
#define ISR_ERR(num) ISR(num)
#include "../interrupt-list.inc"
#include "interrupts.lst"
#undef ISR
#undef ISR_ERR
@ -38,7 +38,7 @@ void IDT::initialize()
0x08, \
InterruptFlags::Interrupt | InterruptFlags::Use32Bit | InterruptFlags::Ring0 | InterruptFlags::Present);
#define ISR_ERR(num) ISR(num)
#include "../interrupt-list.inc"
#include "interrupts.lst"
#undef ISR
#undef ISR_ERR

View file

@ -0,0 +1,2 @@
#include "vmm.hpp"