当前位置: 技术问答>linux和unix
关于简单S3C6410led驱动程序问题
来源: 互联网 发布时间:2016-09-25
本文导语: 我写的一个简单的驱动程序,可以程序加载和卸载,但是我写的测试程序却出现现在的提示信息: Unable to handle kernel NULL pointer dereference at virtual address 00000008 pgd = ce094000 [00000008] *pgd=5e091031, *pte=00000000, *ppte=0...
我写的一个简单的驱动程序,可以程序加载和卸载,但是我写的测试程序却出现现在的提示信息:
Unable to handle kernel NULL pointer dereference at virtual address 00000008
pgd = ce094000
[00000008] *pgd=5e091031, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#5] PREEMPT
Modules linked in: s3c6410_leds [last unloaded: s3c6410_leds]
CPU: 0 Tainted: G D (2.6.28.6 #410)
PC is at do_sys_open+0x84/0xf0
LR is at mntput_no_expire+0x2c/0x15c
pc : [] lr : [] psr: 80000013
sp : ce07ff68 ip : 00000000 fp : ce07ff94
r10: 00000000 r9 : ce07e000 r8 : cf6e7000
r7 : 00000003 r6 : d0bd0830 r5 : beb28cfc r4 : 00000002
r3 : 00000000 r2 : 00000000 r1 : 00000000 r0 : 00000000
Flags: Nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
Control: 00c5387d Table: 5e094008 DAC: 00000015
Process led-test.o (pid: 1354, stack limit = 0xce07e260)
Stack: (0xce07ff68 to 0xce080000)
ff60: 00000000 40025000 ce07ff9c 00008504 00000000 000083b4
ff80: 00000005 c002cf88 ce07ffa4 ce07ff98 c00a64a8 c00a638c 00000000 ce07ffa8
ffa0: c002cde0 c00a6490 00008504 00000000 0000857c 00000002 beb28cfc 00000000
ffc0: 00008504 00000000 000083b4 00000005 00000000 00000000 40025000 beb28ba4
ffe0: 00000000 beb28b98 0000847c 400dd35c 60000010 0000857c 00000000 00000000
Backtrace:
[] (do_sys_open+0x0/0xf0) from [] (sys_open+0x24/0x28)
r8:c002cf88 r7:00000005 r6:000083b4 r5:00000000 r4:00008504
[] (sys_open+0x0/0x28) from [] (ret_fast_syscall+0x0/0x2c)
Code: ea000015 e590300c e3a02000 e1a00003 (e5935008)
---[ end trace c715cc35e78309ed ]---
Segmentation fault
请问一下 这个是什么错误了?
Unable to handle kernel NULL pointer dereference at virtual address 00000008
pgd = ce094000
[00000008] *pgd=5e091031, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#5] PREEMPT
Modules linked in: s3c6410_leds [last unloaded: s3c6410_leds]
CPU: 0 Tainted: G D (2.6.28.6 #410)
PC is at do_sys_open+0x84/0xf0
LR is at mntput_no_expire+0x2c/0x15c
pc : [] lr : [] psr: 80000013
sp : ce07ff68 ip : 00000000 fp : ce07ff94
r10: 00000000 r9 : ce07e000 r8 : cf6e7000
r7 : 00000003 r6 : d0bd0830 r5 : beb28cfc r4 : 00000002
r3 : 00000000 r2 : 00000000 r1 : 00000000 r0 : 00000000
Flags: Nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
Control: 00c5387d Table: 5e094008 DAC: 00000015
Process led-test.o (pid: 1354, stack limit = 0xce07e260)
Stack: (0xce07ff68 to 0xce080000)
ff60: 00000000 40025000 ce07ff9c 00008504 00000000 000083b4
ff80: 00000005 c002cf88 ce07ffa4 ce07ff98 c00a64a8 c00a638c 00000000 ce07ffa8
ffa0: c002cde0 c00a6490 00008504 00000000 0000857c 00000002 beb28cfc 00000000
ffc0: 00008504 00000000 000083b4 00000005 00000000 00000000 40025000 beb28ba4
ffe0: 00000000 beb28b98 0000847c 400dd35c 60000010 0000857c 00000000 00000000
Backtrace:
[] (do_sys_open+0x0/0xf0) from [] (sys_open+0x24/0x28)
r8:c002cf88 r7:00000005 r6:000083b4 r5:00000000 r4:00008504
[] (sys_open+0x0/0x28) from [] (ret_fast_syscall+0x0/0x2c)
Code: ea000015 e590300c e3a02000 e1a00003 (e5935008)
---[ end trace c715cc35e78309ed ]---
Segmentation fault
请问一下 这个是什么错误了?
|
我对驱动不熟,也只是瞎猜。
楼主可以自己调一下,从测试程序入手,首先定位问题是出在open, ioctl, 还是close。
然后再研究对应的驱动代码。
我怀疑是s3c6410_leds_open的问题,是因为说do_sys_open出错
楼主可以自己调一下,从测试程序入手,首先定位问题是出在open, ioctl, 还是close。
然后再研究对应的驱动代码。
我怀疑是s3c6410_leds_open的问题,是因为说do_sys_open出错
|
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define MY_LED_MAJOR 240
#define MY_LED_MINOR 0
#define MY_LED_NAME "my_led_test"
MODULE_AUTHOR("shuwen");
MODULE_LICENSE("Dual BSD/GPL");
void *R_GPBCON;
void *R_GPBDAT;
static u32 open_count;
static u32 resave_gpbcon;
static u32 resave_gpbdat;
struct my_led_struct{
struct cdev cdev;
};
static struct my_led_struct *my_led_device;
static void iomap_gpb(void)
{
R_GPBCON = ioremap(0x56000010,0x4);
R_GPBDAT = ioremap(0x56000014,0x4);
}
static void unmap_gpb(void)
{
iounmap(R_GPBCON);
iounmap(R_GPBDAT);
}
static void init_led_reg(void)
{
u32 temp;
resave_gpbcon = __raw_readl(R_GPBCON);
resave_gpbdat = __raw_readl(R_GPBDAT);
temp = resave_gpbcon & (~(0xff