OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [before_ORP/] [uclinux/] [uClinux-2.0.x/] [kernel/] [panic.c] - Blame information for rev 199

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/*
2
 *  linux/kernel/panic.c
3
 *
4
 *  Copyright (C) 1991, 1992  Linus Torvalds
5
 *
6
 *  Revisions for CONFIG_CONSOLE by Kenneth Albanowski
7
 *  Copyright (c) 1997, 1998 The Silver Hammer Group, Ltd.
8
 *
9
 */
10
 
11
/*
12
 * This function is used through-out the kernel (including mm and fs)
13
 * to indicate a major problem.
14
 */
15
#include <stdarg.h>
16
 
17
#include <linux/config.h> /* CONFIG_SCSI_GDTH */
18
#include <linux/kernel.h>
19
#include <linux/sched.h>
20
#include <linux/delay.h>
21
 
22
#ifdef CONFIG_NETtel
23
#include <asm/coldfire.h>
24
#include <asm/mcfsim.h>
25
#include <asm/nettel.h>
26
#endif
27
 
28
asmlinkage void sys_sync(void); /* it's really int */
29
extern void hard_reset_now(void);
30
extern void do_unblank_screen(void);
31
extern void DAC960_Finalize(void);
32
extern void gdth_halt(void);
33
extern int C_A_D;
34
 
35
int panic_timeout = 0;
36
 
37
void panic_setup(char *str, int *ints)
38
{
39
        if (ints[0] == 1)
40
                panic_timeout = ints[1];
41
}
42
 
43
NORET_TYPE void panic(const char * fmt, ...)
44
{
45
        static char buf[1024];
46
        va_list args;
47
        int i;
48
 
49
        va_start(args, fmt);
50
        vsprintf(buf, fmt, args);
51
        va_end(args);
52
        printk(KERN_EMERG "Kernel panic: %s\n",buf);
53
        if (current == task[0])
54
                printk(KERN_EMERG "In swapper task - not syncing\n");
55
        else
56
                sys_sync();
57
 
58
#ifdef CONFIG_CONSOLE
59
        do_unblank_screen();
60
#endif /* CONFIG_CONSOLE */
61
 
62
        if (panic_timeout > 0)
63
        {
64
                /*
65
                 * Delay timeout seconds before rebooting the machine.
66
                 * We can't use the "normal" timers since we just panicked..
67
                 */
68
                printk(KERN_EMERG "Rebooting in %d seconds..",panic_timeout);
69
                for(i = 0; i < (panic_timeout*1000); i++)
70
                        udelay(1000);
71
#ifdef CONFIG_BLK_DEV_DAC960
72
                DAC960_Finalize();
73
#endif
74
#ifdef CONFIG_SCSI_GDTH
75
                gdth_halt();
76
#endif
77
                hard_reset_now();
78
        }
79
 
80
#ifdef CONFIG_NETtel
81
        nettel_panic();
82
#endif
83
        for(;;);
84
}
85
 
86
/*
87
 * GCC 2.5.8 doesn't always optimize correctly; see include/asm/segment.h
88
 */
89
 
90
int bad_user_access_length(void)
91
{
92
        panic("bad_user_access_length executed (not cool, dude)");
93
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.