Subversion Repositories freemyipod

Rev

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

Rev 15 Rev 50
Line 29... Line 29...
29
#include "format.h"
29
#include "format.h"
30
#include "thread.h"
30
#include "thread.h"
31
#include "contextswitch.h"
31
#include "contextswitch.h"
32
 
32
 
33
 
33
 
-
 
34
extern struct scheduler_thread* scheduler_threads;
-
 
35
extern struct scheduler_thread* current_thread;
34
void hang();
36
void hang();
35
 
37
 
36
 
38
 
37
void handle_panic(enum panic_severity severity)
39
void handle_panic(enum panic_severity severity)
38
{
40
{
-
 
41
    int i;
-
 
42
    if (severity == PANIC_KILLTHREAD) thread_exit();
-
 
43
    else
-
 
44
    {
-
 
45
        uint32_t mode = enter_critical_section();
-
 
46
        for (i = 0; i < MAX_THREADS; i++)
-
 
47
            if (scheduler_threads[i].type == USER_THREAD)
-
 
48
                scheduler_threads[i].state = THREAD_SUSPENDED;
-
 
49
        current_thread->state = THREAD_DEFUNCT_ACK;
-
 
50
        current_thread->block_type = THREAD_DEFUNCT_PANIC;
-
 
51
        leave_critical_section(mode);
39
    thread_exit();
52
        context_switch();
-
 
53
    }
40
}
54
}
41
 
55
 
42
void panic(enum panic_severity severity, const char* string)
56
void panic(enum panic_severity severity, const char* string)
43
{
57
{
44
    if (severity == PANIC_FATAL)
58
    if (severity == PANIC_FATAL)