//------------------------------------------------------------------- // vmalloc.c // // This module uses 'vmalloc()' to allocate some memory from // the VMALLOC region of the kernel's address-space; it will // be released by 'vfree()' when the module is deinstralled. // // NOTE: Written and tested with Linux kernel version 2.4.20. // // programmer: ALLAN CRUSE // written on: 04 MAR 2003 //------------------------------------------------------------------- #define __KERNEL__ #define MODULE #include // for init_module() #include // for vmalloc(), vfree() #define SUCCESS 0 static char modname[] = "vmalloc"; static void *vaddr; void cleanup_module( void ) { vfree( vaddr ); printk( "<1>Removing \'%s\' module\n", modname ); } int init_module( void ) { printk( "<1>\nInstalling \'%s\' module\n", modname ); vaddr = vmalloc( 0x10 ); printk( "<1> vaddr=%08X \n", vaddr ); return SUCCESS; } MODULE_LICENSE("GPL");