BarryServer : Git

All the code for all my projects
// BarryServer : Git / Nucleus / blob / b33d632d85a31b49ca4a764fe3b644a60459387b / kernel / panic.c

// Related

Nucleus

Barry Interrupt handlers b33d632 (3 years, 3 months ago)
/*
 * This file implements the full kernel panic routine.  This routine does not
 * return, and is essentially a shutdown routine.  It will print a message to
 * the debug port and halt the processor.  In an ideal build, this function
 * won't need to be linked in.
 */

#include <stdint.h>
#include <io.h>

/* Kernel panic */
_Noreturn void
panic(char *fmt, ...)
{
	outb(0xE9, '\033');
	outb(0xE9, '[');
	outb(0xE9, '3');
	outb(0xE9, '1');
	outb(0xE9, 'm');

	char *p = fmt;
	while (*p)
		outb(0xE9, *p++);
	outb(0xE9, '\n');

	asm volatile("cli");
	while (1)
		asm volatile("hlt");
}