[PATCH] D35928: [XRay][X86] Use a valid instruction for the synthetic reference.

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 27 08:22:07 PDT 2017


dberris added a comment.

In https://reviews.llvm.org/D35928#822397, @craig.topper wrote:

> Does xray only work on 64-bit x86?


Yes, we don't have an implementation for 32-bit x86.

If we end up doing so, we will need to update the implementation to check and use the right instructions for 32-bit. Not today though. :)

> R10D isn't a valid register for MOV64ri. It should be R10. The D is the 32-bit size.

Whoops -- good catch, thanks!

> I can't think of a better instruction if you need all the bits. movabsq is the only instruciton that takes a 64-bit immediate. The only other option might be one of the loads into al/ax/eax/rax from a 64-bit absolute address.

I see. I think writing to the scratch register from outside of the function bodies might be more "benign" if it ever gets executed (compared to a read into one of the other registers). Although I'm not a security expert, so maybe the tradeoff here isn't as clear-cut. :/

Will the x86 pipelines be happier with a store to a register than a load of an address? Or put another way, is the cost of `movabsq <immediate>,%r10` higher if it gets speculatively executed compared to say a load instruction? Or should I not even worry about this because the odds of the instruction being decoded/executed is very small (since it's aligned to 16 byte boundaries away from the end of the function)?


https://reviews.llvm.org/D35928





More information about the llvm-commits mailing list