在移植linux3.3.3到6410开发板时遇到的问题

在移植触摸屏驱动时,只要一点触屏就会打印如下信息,然后系统死掉,从网上找到原因

/ # Unable to handle kernel paging request at virtual address d081c00c
pgd = c0004000
[d081c00c] *pgd=5f825811, *pte=00000000, *ppte=00000000
Internal error: Oops: 7 [#1]
Modules linked in:
CPU: 0    Not tainted  (3.3.3-gf1d3a78-dirty #48)
PC is at stylus_updown+0x10/0x78
LR is at handle_irq_event_percpu+0x50/0x1a0
pc : [<c02215dc>]    lr : [<c0054d08>]    psr: 60000193
sp : c0423ed0  ip : 00000000  fp : 00000001
r10: c0432d24  r9 : c04784cc  r8 : 0000005e
r7 : 00000000  r6 : 00000000  r5 : cf94cf00  r4 : c0489454
r3 : d081c000  r2 : ffffffff  r1 : 00000000  r0 : 0000005e
Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 00c5387d  Table: 5fb98008  DAC: 00000017
Process swapper (pid: 0, stack limit = 0xc0422268)
Stack: (0xc0423ed0 to 0xc0424000)
3ec0:                                     cf94cf00 cf94cf00 00000000 c0054d08
3ee0: 00000001 00000001 00000100 c0432d24 cf94cf00 c0432d74 c0454328 c0454348
3f00: c0423f78 00000001 00000001 c0054e94 c0432d24 c0432d74 00000000 c005742c
3f20: 0000005e c043dd20 00000000 c00548c4 0000005e c000ef3c 40000000 00000000
3f40: bfffffff c0008550 cf82d630 00000000 00000000 c000f064 60000013 ffffffff
3f60: c0423fac c0424040 410fb766 50418120 00000000 c000dd00 00000000 c0438458
3f80: c0423fc0 00000000 c0422000 c0454108 c04272a8 c0418748 c0424040 410fb766
3fa0: 50418120 00000000 c0438458 c0423fc0 c000f67c c000f064 60000013 ffffffff
3fc0: c0424158 c04540c0 c0454040 c03fa7a8 c03fa2d4 00000000 00000000 c0419574
3fe0: 00c5387d c0424084 c0419570 c042729c 50004008 50008040 00000000 00000000
[<c02215dc>] (stylus_updown+0x10/0x78) from [<c0054d08>] (handle_irq_event_percp
u+0x50/0x1a0)
[<c0054d08>] (handle_irq_event_percpu+0x50/0x1a0) from [<c0054e94>] (handle_irq_
event+0x3c/0x5c)
[<c0054e94>] (handle_irq_event+0x3c/0x5c) from [<c005742c>] (handle_level_irq+0x
8c/0x108)
[<c005742c>] (handle_level_irq+0x8c/0x108) from [<c00548c4>] (generic_handle_irq
+0x38/0x44)
[<c00548c4>] (generic_handle_irq+0x38/0x44) from [<c000ef3c>] (handle_IRQ+0x30/0
x84)
[<c000ef3c>] (handle_IRQ+0x30/0x84) from [<c0008550>] (vic_handle_irq+0x5c/0x118
)
[<c0008550>] (vic_handle_irq+0x5c/0x118) from [<c000dd00>] (__irq_svc+0x40/0x60)


Exception stack(0xc0423f78 to 0xc0423fc0)
3f60:                                                       00000000 c0438458
3f80: c0423fc0 00000000 c0422000 c0454108 c04272a8 c0418748 c0424040 410fb766
3fa0: 50418120 00000000 c0438458 c0423fc0 c000f67c c000f064 60000013 ffffffff
[<c000dd00>] (__irq_svc+0x40/0x60) from [<c000f064>] (default_idle+0x14/0x18)
[<c000f064>] (default_idle+0x14/0x18) from [<c000f67c>] (cpu_idle+0x60/0x94)
[<c000f67c>] (cpu_idle+0x60/0x94) from [<c03fa7a8>] (start_kernel+0x24c/0x2dc)
Code: e92d4070 e3a01000 e59f4060 e5943004 (e593000c)
---[ end trace 731005be52624b76 ]---
Kernel panic - not syncing: Fatal exception in interrupt

原因如下:


A common cause of this type of error is to have a module left out of the link. That leaves a zero pointer to the missing module. If the kernel attempts to branch to the missing module it branches to location 0 which is what it seems to have done. Whether a missing module is the cause or not is easily checked. Look in your kernel link for an undefined reference.


  可能是内核没能处理好用户通过系统调用所传递的非法指针,除了内核本身的问题外,GCC BUG也常常造成这种故障,可以尝试这样来定位故障的精确位置:
    记录下屏幕上打印的故障地址EIP和故障指令序别,用EIP的值在System.map文件中定位出它所在的函数名,然后定位出该函数所在的源文件,反汇 编该文件的目标文件,从该函数的指令序别中定位出故障指令所在的位置,然后你就可以结合源码,分析故障产生的原因了。

    最后提一下,由于新版本的内核使用的GCC扩展语法越来越多,旧版的GCC在处理扩展语法时可能有缺陷,最好用内核文档所指定的编绎器版本编绎内核,


解决办法待续

Logo

更多推荐