Subversion Repositories freemyipod

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 14
Line 20... Line 20...
20
//
20
//
21
//
21
//
22
 
22
 
23
 
23
 
24
#include "global.h"
24
#include "global.h"
-
 
25
#include "panic.h"
25
#include "console.h"
26
#include "console.h"
26
 
27
 
27
 
28
 
28
void handle_panic()
29
void handle_panic(enum panic_severity severity)
29
{
30
{
30
  while(1);
31
  while(1);
31
}
32
}
32
 
33
 
33
void panic(const char* string)
34
void panic(enum panic_severity severity, const char* string)
34
{
35
{
35
  cputs(1, "\n*PANIC*\n");
36
  cputs(1, "\n*PANIC*\n");
36
  cputs(1, string);
37
  cputs(1, string);
37
  cputc(1, '\n');
38
  cputc(1, '\n');
38
  handle_panic();
39
  handle_panic(severity);
39
}
40
}
40
 
41
 
41
void panicf(const char* string, ...)
42
void panicf(enum panic_severity severity, const char* string, ...)
42
{
43
{
43
  va_list ap;
44
  va_list ap;
44
  cputs(1, "\n*PANIC*\n");
45
  cputs(1, "\n*PANIC*\n");
45
  va_start(ap, string);
46
  va_start(ap, string);
46
  cvprintf(1, string, ap);
47
  cvprintf(1, string, ap);
47
  va_end(ap);
48
  va_end(ap);
48
  cputc(1, '\n');
49
  cputc(1, '\n');
49
  handle_panic();
50
  handle_panic(severity);
50
}
51
}
51
 
52
 
52
void __div0()
53
void __div0()
53
{
54
{
54
  panic("Division by zero!");
55
  panic(PANIC_KILLTHREAD, "Division by zero!");
55
}
56
}