You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
989 B
C
61 lines
989 B
C
/* Copyright (C) 2021,2022 fef <owo@fef.moe>. All rights reserved. */
|
|
|
|
#include <arch/cpufunc.h>
|
|
|
|
#include <gay/cdefs.h>
|
|
#include <gay/config.h>
|
|
#include <gay/kprintf.h>
|
|
#include <gay/ktrace.h>
|
|
#include <gay/systm.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
__noreturn
|
|
void panic(const char *fmt, ...)
|
|
{
|
|
va_list args;
|
|
va_start(args, fmt);
|
|
|
|
disable_intr();
|
|
|
|
kprintf("Kernel panic: ");
|
|
if (fmt == nil)
|
|
kprintf("(nil)\n");
|
|
else
|
|
kvprintf(fmt, args);
|
|
|
|
kprintf("\n");
|
|
ktrace_print();
|
|
|
|
kprintf("\nKernel version: %s\nSystem halted", GAY_VERSION_STR);
|
|
|
|
/* no need for va_end() here i guess */
|
|
while (1) {
|
|
halt();
|
|
disable_intr();
|
|
}
|
|
}
|
|
|
|
__noreturn
|
|
void panic_notrace(const char *fmt, ...)
|
|
{
|
|
va_list args;
|
|
va_start(args, fmt);
|
|
|
|
disable_intr();
|
|
|
|
kprintf("Kernel panic: ");
|
|
if (fmt == nil)
|
|
kprintf("(nil)\n");
|
|
else
|
|
kvprintf(fmt, args);
|
|
|
|
kprintf("\nKernel version: %s\nSystem halted", GAY_VERSION_STR);
|
|
|
|
/* no need for va_end() here i guess */
|
|
while (1) {
|
|
halt();
|
|
disable_intr();
|
|
}
|
|
}
|