Subversion Repositories freemyipod

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 theseven 1
//
2
//
3
//    Copyright 2010 TheSeven
4
//
5
//
6
//    This file is part of emBIOS.
7
//
8
//    emBIOS is free software: you can redistribute it and/or
9
//    modify it under the terms of the GNU General Public License as
10
//    published by the Free Software Foundation, either version 2 of the
11
//    License, or (at your option) any later version.
12
//
13
//    emBIOS is distributed in the hope that it will be useful,
14
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
//    See the GNU General Public License for more details.
17
//
18
//    You should have received a copy of the GNU General Public License along
19
//    with emBIOS.  If not, see <http://www.gnu.org/licenses/>.
20
//
21
//
22
 
23
 
24
#include "global.h"
14 theseven 25
#include "panic.h"
2 theseven 26
#include "console.h"
27
 
28
 
14 theseven 29
void handle_panic(enum panic_severity severity)
2 theseven 30
{
31
  while(1);
32
}
33
 
14 theseven 34
void panic(enum panic_severity severity, const char* string)
2 theseven 35
{
36
  cputs(1, "\n*PANIC*\n");
37
  cputs(1, string);
38
  cputc(1, '\n');
14 theseven 39
  handle_panic(severity);
2 theseven 40
}
41
 
14 theseven 42
void panicf(enum panic_severity severity, const char* string, ...)
2 theseven 43
{
44
  va_list ap;
45
  cputs(1, "\n*PANIC*\n");
46
  va_start(ap, string);
47
  cvprintf(1, string, ap);
48
  va_end(ap);
49
  cputc(1, '\n');
14 theseven 50
  handle_panic(severity);
2 theseven 51
}
52
 
53
void __div0()
54
{
14 theseven 55
  panic(PANIC_KILLTHREAD, "Division by zero!");
2 theseven 56
}