I am looking for a neat way to trap and fiddle with the CPUID instruction of Linux processes. Played around with ptrace() and patching all cpuid opcodes in all executable mmap'ed regions that are created by a process, replacing them by int3's. Didn't work that well since the CPUID opcode bytes appears quite often as parts of other longer opcodes.
So basically I am looking for some way that allows me to set a breakpoint not on a specific memory address but instead on every invocation of an opcode. Anyone has a good idea how to do that?