> You can make a new instruction pattern with an UNSPEC_VOLATILE pattern. > For a quick prototype you could also use an assembler prologue, > although > if you need not experiment with different insn sequences, this will > likely > be more work in the long run if/when assembler prologues are eventually > discontinued. Thanks for the hint - I'll see what I can find. Do you have any hints for good examples in the existing code?
> > Now I need gcc to set this suffix, but here I am pretty lost. I > haven't > > found out yet how to add this to the gcc code. > > This becomes a non-issue when you define your own UNSPEC_VOLATILE > pattern > or assembler prologue. Ideally I'd like to set this suffix on all instructions in a function(gas ignores the suffix on instrs that don't support it). I'll probably survive if this is just set on the mov %edi, %edi and mov %esp, %ebp. But unfortunately not all functions apps try to hook have the mov %edi, %edi, but apps still try to hook them. This means that 2 bytes remain problematic, and on those there's often a xor %eax, %eax (which is either 31 c0 or 33 c0) or a sub modifying the stack pointer. So the problem potentially goes beyond the prologue.