Xyris  0.5
Panic.cpp File Reference
#include <Devices/Graphics/console.hpp>
#include <Devices/Graphics/framebuffer.hpp>
#include <Devices/Graphics/graphics.hpp>
#include <Devices/Serial/rs232.hpp>
#include <Library/stdio.hpp>
#include <Panic.hpp>
#include <Stacktrace.hpp>
#include <Scheduler/tasks.hpp>
#include <x86gprintrin.h>
+ Include dependency graph for Panic.cpp:

Go to the source code of this file.

Macros

#define PANIC_MAX_TRACE   64
 
#define PANIC_MOO_BUF_SZ   256
 
#define PANIC_MSG_BUF_SZ   256
 
#define PANIC_REG_BUG_SZ   512
 
#define PANIC_COLOR_FORE   0xFFFFFF
 
#define PANIC_COLOR_BACK   0x2D2D2D
 
#define PANIC_REG_DUMP_MSG   "Kernel exception - Dumping register state..."
 

Functions

void panic (const char *msg)
 
void panicf (const char *fmt,...)
 
void panic (struct registers *registers)
 

Variables

const char * funnyMessagesForMoo []
 
const size_t funnyMessagesForMooSize = sizeof(funnyMessagesForMoo) / sizeof(funnyMessagesForMoo[0])
 

Detailed Description

Early CGA-mode panic (no framebuffer)

Author
Keeton Feavel (keeto.nosp@m.nfea.nosp@m.vel@c.nosp@m.edar.nosp@m.ville.nosp@m..edu)
Micah Switzer (mswit.nosp@m.zer@.nosp@m.cedar.nosp@m.vill.nosp@m.e.edu)
Version
0.3
Date
2020-10-11
Author
Keeton Feavel (keeto.nosp@m.n@xy.nosp@m.r.is)
Version
0.1
Date
2021-11-05

Definition in file Panic.cpp.

Macro Definition Documentation

◆ PANIC_COLOR_BACK

#define PANIC_COLOR_BACK   0x2D2D2D

Definition at line 26 of file Panic.cpp.

◆ PANIC_COLOR_FORE

#define PANIC_COLOR_FORE   0xFFFFFF

Definition at line 25 of file Panic.cpp.

◆ PANIC_MAX_TRACE

#define PANIC_MAX_TRACE   64

Definition at line 21 of file Panic.cpp.

◆ PANIC_MOO_BUF_SZ

#define PANIC_MOO_BUF_SZ   256

Definition at line 22 of file Panic.cpp.

◆ PANIC_MSG_BUF_SZ

#define PANIC_MSG_BUF_SZ   256

Definition at line 23 of file Panic.cpp.

◆ PANIC_REG_BUG_SZ

#define PANIC_REG_BUG_SZ   512

Definition at line 24 of file Panic.cpp.

◆ PANIC_REG_DUMP_MSG

#define PANIC_REG_DUMP_MSG   "Kernel exception - Dumping register state..."

Definition at line 28 of file Panic.cpp.

Function Documentation

◆ panic() [1/2]

void panic ( const char *  msg)

Halt the system and print the provided message on the panic screen.

Parameters
msgPanic message

Definition at line 82 of file Panic.cpp.

83 {
84  panicInternal(msg, NULL);
85 }
+ Here is the caller graph for this function:

◆ panic() [2/2]

void panic ( struct registers registers)

Halt the system and print information about the provided register dump.

Parameters
registersArchitecture register structure

Definition at line 98 of file Panic.cpp.

99 {
100  panicInternal(PANIC_REG_DUMP_MSG, registers);
101 }

◆ panicf()

void panicf ( const char *  fmt,
  ... 
)

Halt the system and print the provided message and arguments on the panic screen.

Parameters
fmtprintf style format panic message
...arguments

Definition at line 87 of file Panic.cpp.

88 {
89  va_list args;
90  char buf[PANIC_MSG_BUF_SZ];
91  va_start(args, fmt);
92  kvsprintf(buf, fmt, args);
93  va_end(args);
94 
95  panic(buf);
96 }
+ Here is the call graph for this function:

Variable Documentation

◆ funnyMessagesForMoo

const char* funnyMessagesForMoo[]
Initial value:
= {
"Oh, it’s you. It’s been a long time.\nHow have you been?",
"Sorry, I accidentally let the magic smoke out.",
"Not sure how we got here, but here we are.",
"Whatever you just did, don't do it again.",
"Something udderly terrible happened!",
"Still more stable than DOS!",
"Yeah, that's about right.",
"I'm Moo, the Xryis cow!",
"Guru meditation time!",
"Yahaha, you found me!",
"Minecraft crashed!",
"Get Dunked On!",
}

Definition at line 30 of file Panic.cpp.

◆ funnyMessagesForMooSize

const size_t funnyMessagesForMooSize = sizeof(funnyMessagesForMoo) / sizeof(funnyMessagesForMoo[0])

Definition at line 44 of file Panic.cpp.

kvsprintf
int kvsprintf(char *buf, const char *fmt, va_list args)
Sends formatted output to a string using an argument list.
Definition: printf.cpp:333
registers
A structure definining values for all x86 registers. Cannot be namespaced due to C linkage and ASM in...
Definition: regs.hpp:19
panic
void panic(const char *msg)
Halt the system and print the provided message on the panic screen.
Definition: Panic.cpp:82
PANIC_REG_DUMP_MSG
#define PANIC_REG_DUMP_MSG
Definition: Panic.cpp:28
PANIC_MSG_BUF_SZ
#define PANIC_MSG_BUF_SZ
Definition: Panic.cpp:23