//------------------------------------------------------------------- // nocache.c // // The processor's cache mechanism is disabled when this module // is installed and it is reenabled when the module is removed. // // NOTE: This module was written for a single-processor system. // // programmer: ALLAN CRUSE // written on: 12 SEP 2004 //------------------------------------------------------------------- #include // for init_module() static char modname[] = "nocache"; int init_module( void ) { printk( "<1>\nInstalling \'%s\' module\n", modname ); asm(" wbinvd "); asm(" movl %cr0, %eax "); asm(" orl $0x60000000, %eax "); asm(" movl %eax, %cr0 "); printk( " cache has been disabled \n" ); return 0; // SUCCESS } void cleanup_module( void ) { printk( " cache is being reenabled \n" ); asm(" movl %cr0, %eax "); asm(" andl $0x9FFFFFFF, %eax "); asm(" movl %eax, %cr0 "); printk( "<1>Removing \'%s\' module\n", modname ); } MODULE_LICENSE("GPL");