I have following code which runs perfectly in x86/linux. I want to convert this code into ALPHA using gcc cross compiler. It is generating errors like the following:
unknown register name 'eax' in 'asm'
I couldnt find proper sources to do on my own.
inline uint64_t timestamp(void)
{
unsigned long a;
unsigned long d;
asm volatile("xorl %%eax,%%eax\n cpuid \n" ::: "%eax", "%ebx", "%ecx", "%edx"); // flush pipeline
asm volatile("rdtsc\n" : "=a" (a), "=d" (d) ); // read rdtsc
asm volatile("xorl %%eax,%%eax\n cpuid \n" ::: "%eax", "%ebx", "%ecx", "%edx"); // flush pipeline again
return a | ((uint64_t)d << 32);
}
I hardly found that rpcc is equivalent instruction for rdts. cpuid and xorl are the same i guess. But eax, ebx are the registers which are specific to x86, not in ALPHA. Alpha ISA registers are numbered from 0 to 31 like here
Can some one please do convert the above code into ALPHA or can suggest me how to do it, by providing some links with reasonable information?
It will be good enough if I know how to convert following line at least into ALPHA inline:
asm volatile ("rdtsc" : "=a" (a), "=d" (d) : : "ebx", "ecx");
Thank you