/* Copyright (C) 2008 Emmanuel Varoquaux This file is part of XOS. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include #include #include void __attribute__ ((noreturn)) die() { cli(); while (1) hlt(); } /* Cette fonction doit etre appelee lorsque l'etat du systeme devient * incoherent. Elle affiche un bref message decrivant la situation. * * Un kernel panic correspond a un bug de programmation, et ne devrait jamais * se produire. */ void __attribute__ ((noreturn)) panic(const char *msg) { printk("Kernel panic: %s", msg); die(); } void __attribute__ ((noreturn)) __assert_fail(const char *expr, const char *file, int line, const char *func) { char buf[256]; snprintf(buf, sizeof buf, "%s:%d: %s: Assertion `%s' failed.", file, line, func, expr); panic(buf); }