免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2007 | 回复: 0
打印 上一主题 下一主题

kernel panic,原因不明 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-06-18 21:54 |只看该作者 |倒序浏览
我仿照一个日志.写了一个2.4内核的键盘中断,编译通过,但是一加载就会死机,请高手帮忙看一下.急!~~!谢谢了
#include<linux/config.h>
#include<linux/module.h>
#include<linux/kernel.h>
#include<linux/init.h>
#include<linux/modversions.h>
#include<linux/version.h>
#include<linux/fs.h>
#include<linux/sched.h>
#include<linux/errno.h>
#include <linux/irq.h>
#include<linux/interrupt.h>
#include<asm/io.h>
#include<linux/tqueue.h>
#include<linux/list.h>
MODULE_LICENSE("GPL");
static void got_char(void *scancode)
{
        printk("sth happened ,oh yes!\n");
        printk("scan code %x %s.",(int)*((char*)scancode)&0x7f);
        }
void  key_sever(int irq, void *dev_id, struct pt_regs *regs)
{
printk("mouse key down\n");
static unsigned char scancode;
static struct tq_struct task;
LIST_HEAD(key_sever);
INIT_LIST_HEAD(&key_sever);
task.sync=0;
task.routine=got_char;
task.data=&scancode;
unsigned char status;
scancode=inb(0x60);
printk("inb started\n");
queue_task(&task,&tq_immediate);
mark_bh(IMMEDIATE_BH);
printk("mission started\n");
printk("register device ok\n");
}
int __init mou_init(void)
{
  free_irq(1,NULL);
  int keytesta=1;
  int result;
        result=request_irq(1,key_sever,SA_SHIRQ,"keytest",&keytesta);
if (result==0)
                                {
                                printk("request ok\n");
                                }
else
                                {
                                printk("failed\n");
                                }
                                return 0;
}
void __exit mou_exit(void)
{
        free_irq(1,NULL);
        printk("<1>goodbye\n");
        }
module_init(mou_init);
module_exit(mou_exit);
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP