1 /*
2 * linux/kernel/panic.c
3 *
4 * (C) 1991 Linus Torvalds
5 */
6
7 /*
8 * This function is used through-out the kernel (includeinh mm and fs)
9 * to indicate a major problem.
10 */
/*
* �ú����������ں���ʹ�ã������� ͷ�ļ�*.h, �ڴ��������mm���ļ�ϵͳfs�У���
* ����ָ����Ҫ�ij������⡣
*/
11 #include <linux/kernel.h> // �ں�ͷ�ļ�������һЩ�ں˳��ú�����ԭ�ζ��塣
12 #include <linux/sched.h> // ���ȳ���ͷ�ļ�������������ṹtask_struct����ʼ����0�����ݣ�
// ����һЩ�й��������������úͻ�ȡ��Ƕ��ʽ��ຯ������䡣
13
14 void sys_sync(void); /* it's really int */ /* ʵ����������int (fs/buffer.c,44) */
15
// �ú���������ʾ�ں��г��ֵ��ش������Ϣ���������ļ�ϵͳͬ��������Ȼ�������ѭ��--������
// �����ǰ����������0�Ļ�����˵���ǽ���������������һ�û�������ļ�ϵͳͬ��������
// ������ǰ�Ĺؼ���volatile���ڸ��߱�����gcc�ú������᷵�ء���������gcc��������һЩ��
// ���룬����Ҫ����ʹ������ؼ��ֿ��Ա������ijЩ��δ��ʼ�������ģ��پ�����Ϣ��
// ��ͬ������gcc�ĺ�������˵����void panic(const char *s) __attribute__ ((noreturn));
16 volatile void panic(const char * s)
17 {
18 printk("Kernel panic: %s\n\r",s);
19 if (current == task[0])
20 printk("In swapper task - not syncing\n\r");
21 else
22 sys_sync();
23 for(;;);
24 }
25