藏书阁 史将 特技
背景 三国演义 PC版
首页 -> 精彩文章 -> 文章
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