Subversion Repositories HelenOS

Rev

Rev 3343 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3343 Rev 3742
Line 53... Line 53...
53
void halt()
53
void halt()
54
{
54
{
55
#ifdef CONFIG_DEBUG
55
#ifdef CONFIG_DEBUG
56
    bool rundebugger = false;
56
    bool rundebugger = false;
57
 
57
 
58
//      TODO test_and_set not defined on all arches
-
 
59
//  if (!test_and_set(&haltstate))
-
 
60
    if (!atomic_get(&haltstate)) {
58
    if (!atomic_get(&haltstate)) {
61
        atomic_set(&haltstate, 1);
59
        atomic_set(&haltstate, 1);
62
        rundebugger = true;
60
        rundebugger = true;
63
    }
61
    }
64
#else
62
#else
65
    atomic_set(&haltstate, 1);
63
    atomic_set(&haltstate, 1);
66
#endif
64
#endif
67
 
65
 
68
    interrupts_disable();
66
    interrupts_disable();
-
 
67
   
69
#ifdef CONFIG_DEBUG
68
#if (defined(CONFIG_DEBUG)) && (defined(CONFIG_KCONSOLE))
70
    if (rundebugger) {
69
    if (rundebugger)
71
        printf("\n");
-
 
72
        kconsole("panic"); /* Run kconsole as a last resort to user */
70
        kconsole("panic", "\nLast resort kernel console ready\n", false);
-
 
71
#endif
73
    }
72
   
74
#endif      
-
 
75
    if (CPU)
73
    if (CPU)
76
        printf("cpu%u: halted\n", CPU->id);
74
        printf("cpu%u: halted\n", CPU->id);
77
    else
75
    else
78
        printf("cpu: halted\n");
76
        printf("cpu: halted\n");
79
    cpu_halt();
77
    cpu_halt();