Originally Posted by
matsp
I just had a couple of thoughts:
First of all, the register you choose must be one that is "preserved" by the compiler - otherwise, it won't work. EBX, EDI, ESI are your only choice (but 64-bit machine also has R8-R15 for you to use), as EAX, ECX, EDX, EBP and ESP are used by the compiler either as scratch-pad registers (presumed lost when calling functions) or as very specific use (ESP -> stack pointer, EBP -> frame pointer).
Second, I doubt this is a commonly used feature in gcc - there may well have bugs in the compiler that make things "go wrong" if you use it in a sufficiently complex piece of code - it may for example "forget" that the register is a global variable, and use it for temporary use.
--
Mats