From 29c4b6fc4cf3565f6c2f641827e12dad22b3358e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Quei=C3=9Fner?= Date: Fri, 6 May 2016 19:30:29 +0200 Subject: [PATCH] Moves Error to lists. --- prototypes/base/include/errors.hpp | 8 +++----- prototypes/base/lists/errors.lst | 5 +++++ prototypes/base/lists/irqs.lst | 18 +++++++++--------- prototypes/base/src/bsod.cpp | 8 +++++++- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/prototypes/base/include/errors.hpp b/prototypes/base/include/errors.hpp index 50c8db4..8e02797 100644 --- a/prototypes/base/include/errors.hpp +++ b/prototypes/base/include/errors.hpp @@ -2,9 +2,7 @@ enum class Error { - Success = 0, - OutOfMemory = 1, - UnhandledException = 2, - UnhandledInterrupt = 3, - DriverAlreadyInstalled = 4, +#define ERROR(num, ident, desc) ident = num, +#include "errors.lst" +#undef ERROR }; \ No newline at end of file diff --git a/prototypes/base/lists/errors.lst b/prototypes/base/lists/errors.lst index e69de29..6fd0b6b 100644 --- a/prototypes/base/lists/errors.lst +++ b/prototypes/base/lists/errors.lst @@ -0,0 +1,5 @@ +ERROR(0, Success, Nothing went wrong. This should never encounter.) +ERROR(1, OutOfMemory, The system has run out of memory.) +ERROR(2, UnhandledException, An unhandled exception has occurred.) +ERROR(3, UnhandledInterrupt, An unhandled interrupt has occurred.) +ERROR(4, DriverAlreadyInstalled, A driver was already installed.) \ No newline at end of file diff --git a/prototypes/base/lists/irqs.lst b/prototypes/base/lists/irqs.lst index 2f5cf20..bb09567 100644 --- a/prototypes/base/lists/irqs.lst +++ b/prototypes/base/lists/irqs.lst @@ -1,16 +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(1, PrimaryPS2, First PS/2 port / Keyboard Controller) +IRQ(2, SecondaryPIC, Connection to secondary 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(7, PrimaryLPT, LPT 1 / 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(9, Free, Free) +IRQ(10, FourthIDE, Fourth ATA/ATAPI/(E)IDE) +IRQ(11, ThirdIDE, Third ATA/ATAPI/(E)IDE) +IRQ(12, SecondaryPS2, Second PS/2 Port / Mouse Controller) 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) \ No newline at end of file +IRQ(14, PrimaryIDE, Primary ATA/ATAPI/(E)IDE) +IRQ(15, SecondaryIDE, Secundary ATA/ATAPI/(E)IDE / Spurious Interrupt) \ No newline at end of file diff --git a/prototypes/base/src/bsod.cpp b/prototypes/base/src/bsod.cpp index 4f1257b..5f39e64 100644 --- a/prototypes/base/src/bsod.cpp +++ b/prototypes/base/src/bsod.cpp @@ -38,7 +38,13 @@ void BSOD::die(Error code, const char *msg, CpuState *cpu) Console::main << FColor(Color::White) << BColor(Color::Red); Console::main.clear(); Console::main - << "OH MY GOD. DasOS crashed! But i can tell you: \n" + << "OH MY GOD. DasOS crashed! But i can tell you: \n"; + switch(code) { + #define ERROR(num, ident, desc) case Error::ident: Console::main << #desc << "\n"; break; +#include "errors.lst" +#undef ERROR + } + Console::main << msg << "\n" << "Also here is some CPU information:\n";