मैं एक ही त्रुटि के बारे में पोस्ट को देखा है लेकिन मैं अभी भी त्रुटि मिल रही है:एएसएम
too many memory references for `mov'
junk `hCPUIDmov buffer' after expression
... यहाँ कोड (MinGW संकलक है/सी :: बी):
#include iostream
using namespace std;
union aregister
{
int theint;
unsigned bits[32];
};
union tonibbles
{
int integer;
short parts[2];
};
void GetSerial()
{
int part1,part2,part3;
aregister issupported;
int buffer;
__asm(
"mov %eax, 01h"
"CPUID"
"mov buffer, edx"
);//do the cpuid, move the edx (feature set register) to "buffer"
issupported.theint = buffer;
if(issupported.bits[18])//it is supported
{
__asm(
"mov part1, eax"
"mov %eax, 03h"
"CPUID"
);//move the first part into "part1" and call cpuid with the next subfunction to get
//the next 64 bits
__asm(
"mov part2, edx"
"mov part3, ecx"
);//now we have all the 96 bits of the serial number
tonibbles serial[3];//to split it up into two nibbles
serial[0].integer = part1;//first part
serial[1].integer = part2;//second
serial[2].integer = part3;//third
}
}
आप '%' सभी अपने रजिस्टर तक पहुँचता है के लिए उपयोग नहीं करना चाहिए:
निम्नलिखित स्निपेट अपने उपयोग-मामले (मैं जीसीसी इनलाइन विधानसभा या CPUID साथ जटिलता परिचित नहीं कर रहा हूँ) को कवर कर सकते हैं? –
मुझे लगता है कि आप रजिस्टर नाम से पहले कुछ% संकेत भूल गए हैं। – fuz
प्रश्न के अंत में उन 3 पंक्तियां क्या हैं जो मुझे बता रही हैं कि मेरी पोस्ट अधिकतर कोड है? –