Colorful errors
This commit is contained in:
+3
-3
@@ -18,9 +18,9 @@
|
||||
|
||||
#define kdebug(f, ...) debugf(DEBUG_DEFAULT, "[%s] " f, __func__, ##__VA_ARGS__)
|
||||
#define kinfo(f, ...) debugf(DEBUG_INFO, "[%s] " f, __func__, ##__VA_ARGS__)
|
||||
#define kwarn(f, ...) debugf(DEBUG_WARN, "[%s] " f, __func__, ##__VA_ARGS__)
|
||||
#define kerror(f, ...) debugf(DEBUG_ERROR, "[%s] " f, __func__, ##__VA_ARGS__)
|
||||
#define kfatal(f, ...) debugf(DEBUG_FATAL, "[%s] " f, __func__, ##__VA_ARGS__)
|
||||
#define kwarn(f, ...) debugf(DEBUG_WARN, "\033[1m\033[33m[%s] " f "\033[0m", __func__, ##__VA_ARGS__)
|
||||
#define kerror(f, ...) debugf(DEBUG_ERROR, "\033[1m\033[31m[%s] " f "\033[0m", __func__, ##__VA_ARGS__)
|
||||
#define kfatal(f, ...) debugf(DEBUG_FATAL, "\033[41m[%s] " f "\033[0m", __func__, ##__VA_ARGS__)
|
||||
#define kprint(l, f, ...) debugf(l, "[%s] " f, __func__, ##__VA_ARGS__)
|
||||
|
||||
void fmtsiz(char *buf, size_t sz);
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#define CGA_BUFFER_ADDR 0xB8000
|
||||
#define ATTR_DEFAULT 0x1700ULL
|
||||
|
||||
#define ATTR_BOLD 1
|
||||
|
||||
static uint16_t *con_buffer;
|
||||
static uint16_t x = 0, y = 0;
|
||||
static uint16_t con_width, con_height;
|
||||
@@ -54,6 +56,7 @@ static size_t esc_argc;
|
||||
static char esc_letter = 0;
|
||||
static int esc_mode = 0;
|
||||
static uint16_t attr = ATTR_DEFAULT;
|
||||
static uint16_t xattr = 0;
|
||||
|
||||
static void setc(uint16_t row, uint16_t col, uint16_t v);
|
||||
|
||||
@@ -140,6 +143,15 @@ static void process_csi(void) {
|
||||
case 0:
|
||||
// Reset
|
||||
attr = ATTR_DEFAULT;
|
||||
xattr = 0;
|
||||
break;
|
||||
case 1:
|
||||
// Bright
|
||||
xattr |= ATTR_BOLD;
|
||||
break;
|
||||
case 2:
|
||||
// Dim
|
||||
xattr &= ~ATTR_BOLD;
|
||||
break;
|
||||
case 7:
|
||||
// Reverse
|
||||
@@ -251,6 +263,10 @@ static void process_csi(void) {
|
||||
}
|
||||
|
||||
static void setc(uint16_t row, uint16_t col, uint16_t v) {
|
||||
if (xattr & ATTR_BOLD) {
|
||||
v += 0x800;
|
||||
}
|
||||
|
||||
con_buffer[row * con_width + col] = v;
|
||||
|
||||
if (vesa_available) {
|
||||
|
||||
@@ -278,6 +278,8 @@ int sys_execve(const char *filename, const char *const argv[], const char *const
|
||||
thread_platctx_init(thr, 0, NULL);
|
||||
|
||||
if ((res = elf_load(thr, &thr->ioctx, &fd)) != 0) {
|
||||
vfs_close(&thr->ioctx, &fd);
|
||||
|
||||
kdebug("%u exited with code -1: elf load failed\n", thr->pid);
|
||||
thr->exit_code = -1;
|
||||
thr->flags |= THREAD_STOPPED;
|
||||
|
||||
@@ -7,7 +7,9 @@ void panicf(const char *fmt, ...) {
|
||||
kfatal("--- Panic ---\n");
|
||||
|
||||
va_start(args, fmt);
|
||||
debugs(DEBUG_FATAL, "\033[41m");
|
||||
debugfv(DEBUG_FATAL, fmt, args);
|
||||
debugs(DEBUG_FATAL, "\033[0m");
|
||||
va_end(args);
|
||||
|
||||
kfatal("--- Panic ---\n");
|
||||
|
||||
Reference in New Issue
Block a user