20 #include "pedigree/kernel/panic.h" 21 #include "pedigree/kernel/Log.h" 22 #include "pedigree/kernel/Service.h" 23 #include "pedigree/kernel/ServiceFeatures.h" 24 #include "pedigree/kernel/ServiceManager.h" 25 #include "pedigree/kernel/debugger/DebuggerIO.h" 26 #include "pedigree/kernel/debugger/LocalIO.h" 27 #include "pedigree/kernel/debugger/SerialIO.h" 28 #include "pedigree/kernel/graphics/GraphicsService.h" 29 #include "pedigree/kernel/machine/Display.h" 30 #include "pedigree/kernel/machine/Machine.h" 31 #include "pedigree/kernel/processor/Processor.h" 32 #include "pedigree/kernel/processor/types.h" 33 #include "pedigree/kernel/utilities/StaticString.h" 34 #include "pedigree/kernel/utilities/String.h" 35 #include "pedigree/kernel/utilities/utility.h" 37 static size_t newlineCount(
const char *pString)
40 while (*pString !=
'\0')
41 if (*pString++ ==
'\n')
48 static void _panic(
const char *msg,
DebuggerIO *pScreen)
53 panic_output.append(
"PANIC: ");
54 panic_output.append(msg);
57 pScreen->
drawString(panic_output, 0, 0, DebuggerIO::Red, DebuggerIO::Black);
59 size_t nLines = newlineCount(panic_output) + 2;
65 size_t iEntry = 0, iUsedEntries = 0;
66 if ((pScreen->getHeight() - nLines) <
69 (pScreen->getHeight() - nLines) + 1;
70 bool bPrintThisLine =
false;
85 Line.append(entry.
str);
88 bPrintThisLine =
true;
100 Line.append(entry.
timestamp, 10, 8,
'0');
102 Line.append(entry.
str);
105 bPrintThisLine =
true;
110 if (bPrintThisLine ==
true)
114 Line, nLines + iUsedEntries, 0, DebuggerIO::White,
116 bPrintThisLine =
false;
123 static String graphicsService(
"graphics");
129 ByteSet(&provider, 0,
sizeof(provider));
135 bool bSuccess =
false;
138 bSuccess = pService->
serve(
145 #ifdef MULTIPROCESSOR 146 Machine::instance().stopAllOtherProcessors();
152 SerialIO serialIO(Machine::instance().getSerial(0));
157 if (Machine::instance()
161 Machine::instance().getVga(0), Machine::instance().getKeyboard());
162 #ifdef DONT_LOG_TO_SERIAL 163 pInterfaces[0] = &localIO;
166 pInterfaces[0] = &localIO;
167 pInterfaces[1] = &serialIO;
171 #ifndef DONT_LOG_TO_SERIAL 174 pInterfaces[0] = &serialIO;
179 for (
int nIFace = 0; nIFace < nInterfaces; nIFace++)
180 _panic(msg, pInterfaces[nIFace]);
StaticString< LOG_LENGTH > str
size_t getStaticEntryCount() const
virtual bool provides(Type service)
const StaticLogEntry & getStaticEntry(size_t n) const
const DynamicLogEntry & getDynamicEntry(size_t n) const
size_t getDynamicEntryCount() const
static void setInterrupts(bool bEnable)
virtual void drawString(const char *str, size_t row, size_t col, Colour foreColour, Colour backColour)=0
static EXPORTED_PUBLIC Log & instance()
Service * getService(const String &serviceName)
virtual bool serve(ServiceFeatures::Type type, void *pData, size_t dataLen)=0
void panic(const char *msg)
ServiceFeatures * enumerateOperations(const String &serviceName)
virtual bool setScreenMode(ScreenMode sm)