dd86k / ddcpuid

🔬 dd's x86 CPU Identification tool
MIT License
36 stars 1 forks source link

Add GDC support #19

Closed dd86k closed 5 years ago

dd86k commented 5 years ago

It's possible to support GDC, with its GAS syntax, with version (GNU).

I just need to learn GAS syntax and I should be fine.

dd86k commented 5 years ago

Getting some good progress so far, this works nicely:

version (GNU) asm { // at&t
    "mov %4, %%eax\n"~
    "mov $0, %%ecx\n"~
    "cpuid\n"~
    "mov %%eax, %0\n"~
    "mov %%ebx, %1\n"~
    "mov %%ecx, %2\n"~
    "mov %%edx, %3"
    : "=a" a, "=b" b, "=c" c, "=d" d
    : "r" leaf;
} else asm {
    mov EAX, leaf;
    mov ECX, 0;
    cpuid;
    mov a, EAX;
    mov b, EBX;
    mov c, ECX;
    mov d, EDX;
}

I'm rather new to GAS, so don't mind my poor writing

dd86k commented 5 years ago

Added with note in README