summaryrefslogtreecommitdiff
path: root/src/kernel/panic.c
blob: 5d32bf73365a124c8fdc3463e173d4e34c88c399 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "log.h"
#include "vga.h"
#include "util.h"

__attribute__ ((noreturn))
void panic(const char *filename, uint32_t line, const char *message) {
  set_log_mode(LOG_PANIC);
  vga_blank();
  logsz("Kernel panic [");
  logsz(filename);
  char nbuf[12] = ":";
  u32_dec(line, nbuf + 1);
  logsz(nbuf);
  logsz("]: ");
  logsz(message);
  logsz("\nHalting.");
  while (1)
    asm volatile ("hlt");
}