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"); } |