linux-panic.c

/*
*  linux/kernel/panic.c
*                                            //--用于显示内核错误信息并使系统进入死循环
*  (C) 1991  Linus Torvalds
*/
/*
* This function is used through-out the kernel (includeinh mm and fs)
* to indicate a major problem.
*/
#include <linux/kernel.h>
#include <linux/sched.h>
void sys_sync(void);    /* it's really int */
volatile void panic(const char * s)
{
    printk("Kernel panic: %s/n/r",s);
    if (current == task[0])
        printk("In swapper task - not syncing/n/r");
    else
        sys_sync();                            //--文件系统同步函数
    for(;;);
}
|xGv00|fcc8d4de8197f69fde70263fb4d52380
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
# # Install the bochs emulate system first! # Included is bochs version 2.1.1 packet.(Bochs-2.1.1.exe) #---------------------------------------------------------- # This is a root file system for linux 0.11 kernel. # Rebuild from materials gathered from Internet. # # Zhao Jiong ( [email protected] ) # http://oldlinux.org/ 2004.1.4 # Third release 2004.3.29 Now, this is a very basic root file system for linux 0.1x. I will add more things to this release soon. see the changelog bellow. This release is a basic system. you can test vi, ls, mkdir etc. Just for testing with kernel source code. Now I have added gcc 1.40 tools into the harddisk rootimage file. you can compile some c source file now. enjoy it :-) NOTE: By using the resources in this directory, you must first install the Bochs emulation software in your system. The included Bochs-2.1.1.exe is for win32. You can always download the newest version of it from http://sourceforge.net When testing floppy root (as running bochsrc-fd), when showing the message of " Insert root floppy and press ENTER", JUST press the Enter key. I have already attached the root floppy to the 'B:' diskette driver. The system will panic unpredicatablly. Use at your own risk! Changelog: ===================== 2004.3.29 Add gcc 1.40 & libs into the harddisk image. Now you can compile the orignal kernel sources without need any modification to it! But when running the system, please read another README file in /usr/root directory first. ------------------------------------------------ cd /usr/root gcc -s -o hello hello.c ./hello ------------------------------------------------ files included: README -- This file. Bochs-2.1.1.exe -- Bochs system for use in win32 environment. Must be installed on your windows system first. bootimage-0.11 -- kernel 0.11 bootimage request rootimage from floppy. bootimage-0.11-fd -- request rootimage in disk b: bootimage-0.11-hd -- boot harddisk root file system. bootimage-0.12-fd -- kernel 0.12 bootimage use with floppy root iamge. bootimage-0.12-hd -- kernel 0.12 bootimage use with harddisk root image. rootimage-0.11 -- kernel 0.11 rootimage. hdc-0.11 -- harddisk root filesystem image. diskb.img -- a dos format disk image. can be w/r with mtools. example: mdir b:, mcopy b:, mdel b:filename bochsrc-fd.bxrc -- bochs rc file configured for using disk root iamge. bochsrc-hd.bxrc -- bochs rc file configured for using hd root image. gcclib-1.40.taz -- tar files of the gcc bins & libs. You can change the line 'floppya' in bochsrc-xx.bxrc file to use the diferent bootimage file provided. In order to insert any programs into the hd image file, you can use winimage program or something like that to add/delete files in diskb.img and then read these files by using mtoos in the system. Play & enjoy the pleasure of it! 2004.3.4 This is truelly kernel 0.11 driving system!! In order to run bash 1.12.1, I inserted several system call stubs. To show the file date correctly, I added one line to the kernel/mktime.c at the top of file. For details, see the linux-0.11.dif file. Add Input/Output tools, such as mtools dealing with DOS diskettes, mount/umount command, compress, df, awk... ~ ~ ~ :wq #
好的,下面是一个简单的 Linux kernel panic 堆栈信息解析示例: ``` Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b [<c0102a9e>] (unwind_backtrace+0x0/0xe8) from [<c042f8f6>] (panic+0x64/0x13c) [<c042f8f6>] (panic+0x64/0x13c) from [<c042d7c2>] (do_exit+0x5fe/0x602) [<c042d7c2>] (do_exit+0x5fe/0x602) from [<c0101e80>] (die+0x20c/0x214) [<c0101e80>] (die+0x20c/0x214) from [<c0113a98>] (__do_kernel_fault.part.3+0x5c/0x84) [<c0113a98>] (__do_kernel_fault.part.3+0x5c/0x84) from [<c0113b88>] (do_page_fault+0x2a0/0x2b8) [<c0113b88>] (do_page_fault+0x2a0/0x2b8) from [<c0100e6e>] (do_DataAbort+0x34/0x98) [<c0100e6e>] (do_DataAbort+0x34/0x98) from [<c0102d24>] (__dabt_svc+0x44/0x60) ---[ end trace 5a7926b607e5b2d5 ]--- ``` 这个堆栈信息表示系统发生了一个 kernel panic,导致系统无法正常运行。下面是对每一行的解析: - 第一行是 kernel panic 的描述信息,告诉我们出现了什么问题。 - 第二行中的 `<c0102a9e>` 表示函数 `unwind_backtrace` 在代码中的位置,`0x0/0xe8` 表示函数内部的偏移量。这个函数是用来跟踪函数调用栈的,可以帮助我们定位问题发生的位置。 - 第三行中的 `<c042f8f6>` 表示函数 `panic` 在代码中的位置,`0x64/0x13c` 表示函数内部的偏移量。这个函数会导致系统进入 panic 模式,因此我们需要关注它。 - 第四行中的 `<c042d7c2>` 表示函数 `do_exit` 在代码中的位置,`0x5fe/0x602` 表示函数内部的偏移量。这个函数是用来退出进程的,可能与问题有关。 - 第五行中的 `<c0101e80>` 表示函数 `die` 在代码中的位置,`0x20c/0x214` 表示函数内部的偏移量。这个函数是用来输出错误信息和导致系统进入 panic 模式的,因此我们需要关注它。 - 第六行中的 `<c0113a98>` 表示函数 `__do_kernel_fault.part.3` 在代码中的位置,`0x5c/0x84` 表示函数内部的偏移量。这个函数是用来处理页面故障的,可能与问题有关。 - 第七行中的 `<c0113b88>` 表示函数 `do_page_fault` 在代码中的位置,`0x2a0/0x2b8` 表示函数内部的偏移量。这个函数也是用来处理页面故障的,可能与问题有关。 - 第八行中的 `<c0100e6e>` 表示函数 `do_DataAbort` 在代码中的位置,`0x34/0x98` 表示函数内部的偏移量。这个函数是用来处理数据异常的,也可能与问题有关。 - 最后一行表示跟踪结束的信息,可以忽略。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值