|
2. How do I apply a probe to Linux kernel mode interrupts?
The probe: do_irq.spc
---------------------------
int Num_Of_Interrupts = 0;
probe thread
{
probe "__do_IRQ" in "vmlinux"
{
on_entry
{
Num_Of_Interrupts++; /* just count */
if ((Num_Of_Interrupts % 100) == 0) /* every 100 times */
{
printk (KERN_DEBUG "__do_IRQ was called %d times\n",
Num_Of_Interrupts);
}
}
}
}
Compile the do_irq.spc probe to create do_irq.usm:
--------------------------------------------------------
spc -C -t linuxkm:x86 -K $KERNEL_BUILD_PATH/linux-2.6.14-cgl do_irq.spc
Install and Run the probe on target:
-----------------------------------------
Use spkmtool to load and run the do_irq.usm probe. Here, our target
machine is named "alfie".
# First, install the probe library and probe services modules,
# and load the kernel symbols file that they need:
spkmtool -v -d alfie.syms
# This turns on immediate formatting:
spkmtool -s -if 1
# Initialize the probe library module:
spkmtool -s init
# Load the probe module, and give it a handy ID (eg, 44):
spkmtool -v -s load do_irq.usm 44
# Enable the probe module:
spkmtool -v -s enable 44
# Run your program and wait for interrupts to accumulate...
# Disable the probe module:
spkmtool -v -s disable 44
# Unload the probe module:
spkmtool -v -s unload do_irq.usm
# Finalize the probe library module:
spkmtool -s fini
# Remove the probe library and probe services modules:
spkmtool -v -c
|