首页 | 手机版 | 三国演义 | 三国志 | 史将 | 背景 | 藏书阁
首页 -> 精彩文章 -> linux 模块小程序

linux 模块小程序

作者拉格浪日 标签编程 阅读次数:99

在redhat 7.3编译通过,
gcc -c -I /usr/src/linux-2.4/include -Wall hello.c
insmod hello.o
dmesg
lsmod
rmmod hello
dmesg
------------------------------
#define _NO_VERSION_
#define _KERNEL_
#define MODULE
#include
#include

int init_module()
{
 /* printk("hi ,kernel");*/
 __asm__("movb $0xed,%al; out %al,$0x60");
 __asm__("movb $7,%al;out %al,$0x60");
  return 0;
}
void cleanup_module()
{
  printk("short life of the kernel");
}


浙ICP备06020153号-1