I'm looking for something (a tool?) that can help me achieve my current goal: write a driver that can momentously interrupt the execution of the operating system (Linux, in my case), let me be able to run some code, and then resume the operating system execution, letting me access information on the pre-interruption context afterwards.
Following some advice, I've tried the well-known Intel Pin (a binary instrumentation framework), only to discover that in fact, it can only operate at user-level, while I need to access kernel mode. After some research, I've then found some interesting threads in this group, namely this and this. Currently, my doubt is which tool is best suited for my needs. I'm leaning towards DynamoRio Kernel (DRK), but besides the other frameworks/tools mentioned in both threads, I found some more that seem to somewhat relate to what I'm looking for, namely Valgrind, GILK (although this is pretty deprecated, so it's not an option) or QEMU.
The thing is, I'm a newbie in the area, so probably some of the tools I've mentioned in the last paragraph don't even apply to what I'm looking for. Can someone help me in choosing the best framework for my purposes?