- 論壇徽章:
- 1
|
看過很多資料,說Arm Kernel在panic或者oops錯誤時,由于流水線的關(guān)系,實際運行指令是打印出來的PC指針減去8。
但我自己做個簡單的模塊試試,看上去,PC指針指向的就是代碼錯誤的地方,不需要減去8呀。
請高手指教,謝謝!
我的Kernel是3.4,ARM A5架構(gòu)。- int msm_hello_init(void)
- {
- char *testptr = 0x98;
-
- printk("111Hello Cruel World wewewe!\n");
-
- *testptr = 0x1234;
-
- return 0;
- }
復(fù)制代碼 Kernel反匯編的相關(guān)代碼為:- c001f114 <msm_hello_init>:
- c001f114: e1a0c00d mov ip, sp
- c001f118: e92dd800 push {fp, ip, lr, pc}
- c001f11c: e24cb004 sub fp, ip, #4
- c001f120: e52de004 push {lr} ; (str lr, [sp, #-4]!)
- c001f124: ebffbd9f bl c000e7a8 <__gnu_mcount_nc>
- c001f128: e59f0010 ldr r0, [pc, #16] ; c001f140 <msm_hello_init+0x2c>
- c001f12c: eb188804 bl c0641144 <printk>
- c001f130: e3a00000 mov r0, #0
- c001f134: e3a03034 mov r3, #52 ; 0x34
- c001f138: e5c03098 strb r3, [r0, #152] ; 0x98
- c001f13c: e89da800 ldm sp, {fp, sp, pc}
- c001f140: c077f0b0 .word 0xc077f0b0
復(fù)制代碼 打印出來的panic是:
[ 2.861010] Internal error: Oops: 805 [#1] PREEMPT ARM
[ 2.866107] Modules linked in:
[ 2.869159] CPU: 0 Not tainted (3.4.91-a91ac065df_d3ff0ee36f #1)
[ 2.875507] PC is at msm_hello_init+0x24/0x30
[ 2.879841] LR is at console_unlock+0x25c/0x274
[ 2.884358] pc : [<c001f138>] lr : [<c005d644>] psr: 60000013
[ 2.884358] sp : cf033f28 ip : cf033e40 fp : cf033f34
[ 2.895803] r10: c001f114 r9 : 00000000 r8 : 00000119
[ 2.900991] r7 : c09e5000 r6 : c09480c0 r5 : c0927a38 r4 : 00000007
[ 2.907523] r3 : 00000034 r2 : c096dc80 r1 : 00000000 r0 : 00000000
[ 2.914024] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel
[ 2.921318] Control: 10c5387d Table: 40804059 DAC: 00000015
[ 2.927056] Process swapper (pid: 1, stack limit = 0xcf0322e
[ 2.932855] Stack: (0xcf033f28 to 0xcf034000)
[ 2.937219] 3f20: cf033f74 cf033f38 c00085f0 c001f120 00000007 00000007
[ 2.945368] 3f40: 00000119 c08720d4 cf033f74 00000007 c0927a38 c09480c0 c09e5000 00000119
[ 2.953547] 3f60: 00000000 c0927a40 cf033ff4 cf033f78 c08f99b0 c0008558 00000007 00000007
[ 2.961696] 3f80: c08f9268 00000000 cf033fac cf033f98 c00891e0 c0088dac 00000000 00000000
[ 2.969845] 3fa0: 00000000 cf033fb0 c000e734 c00891d4 00000000 00000000 00000000 00000000
[ 2.978025] 3fc0: 00000000 c08f986c c000f770 00000013 00000000 c08f986c c000f770 00000013
[ 2.986174] 3fe0: 00000000 00000000 00000000 cf033ff8 c000f770 c08f9878 9dcfdd76 de7fffb4
[ 2.994353] [<c001f138>] (msm_hello_init+0x24/0x30) from [<c00085f0>] (do_one_initcall+0xa4/0x174)
[ 3.003296] [<c00085f0>] (do_one_initcall+0xa4/0x174) from [<c08f99b0>] (kernel_init+0x144/0x234)
[ 3.012147] [<c08f99b0>] (kernel_init+0x144/0x234) from [<c000f770>] (kernel_thread_exit+0x0/0x
[ 3.020967] Code: e59f0010 eb188804 e3a00000 e3a03034 (e5c0309
[ 3.027132] ---[ end trace 44db375dc1d37124 ]---
[ 3.031710] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
|
|