//------------------------------------------------------------------- // init_mm.c // // This module creates a pseudo-file named '/proc/init_mm' that // lets an application find the location in physical memory for // the page-directory that belongs to the kernel's 'init' task. // // NOTE: Developed and tested with Linux kernel version 2.6.10. // // programmer: ALLAN CRUSE // written on: 07 FEB 2005 //------------------------------------------------------------------- #include // for init_module() #include // for create_proc_info_entry() static char modname[] = "init_mm"; unsigned long physaddr; static int my_get_info( char *buf, char **start, off_t off, int count ) { int len; len = 0; len += sprintf( buf+len, "%08lX = __pa( init_mm.pgd ) ", physaddr ); len += sprintf( buf+len, "\n" ); return len; } int init_module( void ) { printk( "<1>\nInstalling \'%s\' module\n", modname ); // physical addrress of page-directory for 'init' task physaddr = __pa( init_mm.pgd ); create_proc_info_entry( modname, 0, NULL, my_get_info ); return 0; //SUCCESS } void cleanup_module( void ) { remove_proc_entry( modname, NULL ); printk( "<1>Removing \'%s\' module\n", modname ); } MODULE_LICENSE("GPL");