Listing 6. Modified Simple Module to Include Further Remote
Control
#if defined(CONFIG_MODVERSIONS)
#define MODVERSIONS
#include <linux/modversions.h>
#endif
#include <linux/version.h>
#include <linux/wrapper.h>
#include <linux/fs.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#define MOD "simple"
#define SUCCESS 0
#define FAILURE -1
/* Here is our user defined breakpoint to */
/* initiate communication with remote gdb */
#define BREAKPOINT() asm(" int $3");
int init_module(void) {
BREAKPOINT();
printk(KERN_ALERT"\nThe kernel module %s",MOD);
printk(KERN_ALERT"has been loaded.\n");
return SUCCESS;
} // end function init_module
void cleanup_module (void) {
BREAKPOINT();
printk(KERN_ALERT"\nThe kernel module %s",MOD);
printk(KERN_ALERT"has been removed.\n");
} // end function cleanup_module