µ«ÊÇmakeÊÇ¿ÉÒԳɹ¦µÄ ¼ÓÔØÄ£¿éʱÔٴγöÏÖ´íÎó ÈÔÈ»ÊÇopen_softirqΪ²»ÄÜʶ±ðµÄ·ûºÅ
¸Õ¿ªÊ¼ÎÒÒÔΪÊÇfc6×Ô´øµÄÔ´Âë°üÖ»ÓÐ.hÎļþ ûÓÐ.cÎļþ²Å»áÕâÑù ÓÚÊÇÏÂÔØÁË2.6.18.1Ô´Âë°ü ÔÚfc6ϱàÒë ÔÙmake ¼ÓÔØÄ£¿é ÈÔÈ»³öÏÖͬÑùµÄÎÊÌâ
µ«ÊÇÔÚ2.6.15.5Äں˻·¾³ÏÂÊÇ¿ÉÒÔͨ¹ý±àÒëµÄ Ò²¿ÉÒÔÕý³£¼ÓÔØ »¹¿ÉÒÔ¿´µ½´òÓ¡Êä³öhello,world!!
ÏëÇë½Ì´ó¼Ò¾¿¾¹ÊÇÔõô»ØÊÂÄØ
#include
#include
#include
#include
MODULE_DESCRIPTION("My kernel module");
MODULE_AUTHOR("root (root@localhost.localdomain)");
MODULE_LICENSE("$LICENSE$");
static void timer_func(struct softirq_action *h)
{
printk(KERN_ALERT "hello,world!!\n");
}
void fastcall raise_softirq(unsigned int nr)
{
unsigned long flags;
local_irq_save(flags);
raise_softirq_irqoff(nr);
local_irq_restore(flags);
}
static int test1_init_module(void)
{
printk( KERN_DEBUG "Module test1 init\n" );
open_softirq(TIMER_SOFTIRQ,timer_func,NULL);
raise_softirq(TIMER_SOFTIRQ);
return 0;
}
static void test1_exit_module(void)
{
printk( KERN_DEBUG "Module test1 exit\n" );
}
module_init(test1_init_module);
module_exit(test1_exit_module);
salvage ÓÚ 2008-08-01 02:30:20·¢±í:
³ýÁËÔÚÄÚºËÔ´´úÂëÖÐÐÞ¸Ä ¼ÓÈëEXPORT_SYMBOL Ö®Íâ »¹ÓÐÆäËûµÄ°ì·¨Âð
salvage ÓÚ 2008-08-01 02:07:34·¢±í:
¸Õ²ÅÓÖ¿´ÁËһϠÔÀ´ÊÇopen_softirqÔÚ15ÖÐÊÇͨ¹ýEXPORT_SYMBOLÔÚsoftirq.cÖÐÉùÃ÷µÄ ÔÚ18ÖÐÈ´²»ÊÇÕâÑù
µ«ÊÇ 18µÄinterrupt.hҲͨ¹ý
extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data);
ÉùÃ÷ÁËopen_softirq ÒýÓÃÁËinterrupt.hÖ®ºó ΪºÎ»¹ÊDz»ÄÜʹÓÃopen_softirqÄØ