It works, at least in my conditions. May fail in other ones, I don't disagree there.
Originally Posted by phantomotap
In this specific case, I'm just getting the vendor name, but the assembly code is supposed to be reused, to get other features of the CPU. Feel free to explain how I can do this in other ways.
You can't do what you seem to want to do with the tools you are trying to do it with.
It looks to me as if you are trying to get the vendor ID string into a `std::string' variable in a very round about or illegal fashion. (This can be done, for x86, far simpler.) Is this what you are trying to do? If not, maybe you should describe in words what you are trying to do.
That's GCC/GAS inline assembler? Wow. There is a couple of features there I haven't seen before.
Also, you don't need to explicitly store the value of `EAX' after `CPUID' returns if you are only going to throw it away.
Yes I know. But I included it just to show how to make a string from a vector where it's included.
I noticed the "cpuidOperation" variable in the OPs post so I'm assuming he wants to keep eax for the other cpuid calls besides vendor name.
What is punning? English is not my native language.
That should work, but I still wonder why you would want to pay for the "ACDD Dance" of `std::vector<???>' when you wind up by punning the data at the relevant address anyway?!