Lines 2488-2515
Link Here
|
2488 |
vendor[0] = 0; |
2488 |
vendor[0] = 0; |
2489 |
vendor[12] = 0; |
2489 |
vendor[12] = 0; |
2490 |
/* see p. 118 of amd64 instruction set manual Vol3 */ |
2490 |
/* see p. 118 of amd64 instruction set manual Vol3 */ |
2491 |
__asm__ ("push %%ebx\n" |
2491 |
/* We need to be careful about the handling of %ebx and |
2492 |
"pushf\n" |
2492 |
* %esp here. We can't declare either one as clobbered |
|
|
2493 |
* since they are special registers (%ebx is the "PIC |
2494 |
* register" holding an offset to global data, %esp the |
2495 |
* stack pointer), so we need to make sure they have their |
2496 |
* original values when we access the output operands. |
2497 |
*/ |
2498 |
__asm__ ("pushf\n" |
2493 |
"pop %%eax\n" |
2499 |
"pop %%eax\n" |
2494 |
"mov %%eax, %%ebx\n" |
2500 |
"mov %%eax, %%ecx\n" |
2495 |
"xor $0x00200000, %%eax\n" |
2501 |
"xor $0x00200000, %%eax\n" |
2496 |
"push %%eax\n" |
2502 |
"push %%eax\n" |
2497 |
"popf\n" |
2503 |
"popf\n" |
2498 |
"pushf\n" |
2504 |
"pushf\n" |
2499 |
"pop %%eax\n" |
2505 |
"pop %%eax\n" |
2500 |
"mov $0x0, %%edx\n" |
2506 |
"mov $0x0, %%edx\n" |
2501 |
"xor %%ebx, %%eax\n" |
2507 |
"xor %%ecx, %%eax\n" |
2502 |
"jz skip\n" |
2508 |
"jz skip\n" |
2503 |
|
2509 |
|
2504 |
"mov $0x00000000, %%eax\n" |
2510 |
"mov $0x00000000, %%eax\n" |
|
|
2511 |
"push %%ebx\n" |
2505 |
"cpuid\n" |
2512 |
"cpuid\n" |
2506 |
"mov %%ebx, %1\n" |
2513 |
"mov %%ebx, %%eax\n" |
|
|
2514 |
"pop %%ebx\n" |
2515 |
"mov %%eax, %1\n" |
2507 |
"mov %%edx, %2\n" |
2516 |
"mov %%edx, %2\n" |
2508 |
"mov %%ecx, %3\n" |
2517 |
"mov %%ecx, %3\n" |
2509 |
"mov $0x00000001, %%eax\n" |
2518 |
"mov $0x00000001, %%eax\n" |
|
|
2519 |
"push %%ebx\n" |
2510 |
"cpuid\n" |
2520 |
"cpuid\n" |
|
|
2521 |
"pop %%ebx\n" |
2511 |
"skip:\n" |
2522 |
"skip:\n" |
2512 |
"pop %%ebx\n" |
|
|
2513 |
"mov %%edx, %0\n" |
2523 |
"mov %%edx, %0\n" |
2514 |
: "=r" (result), |
2524 |
: "=r" (result), |
2515 |
"=m" (vendor[0]), |
2525 |
"=m" (vendor[0]), |
Lines 2543-2550
Link Here
|
2543 |
"mov $0x80000001, %%eax\n" |
2553 |
"mov $0x80000001, %%eax\n" |
2544 |
"cpuid\n" |
2554 |
"cpuid\n" |
2545 |
"skip2:\n" |
2555 |
"skip2:\n" |
2546 |
"mov %%edx, %0\n" |
|
|
2547 |
"pop %%ebx\n" |
2556 |
"pop %%ebx\n" |
|
|
2557 |
"mov %%edx, %0\n" |
2548 |
: "=r" (result) |
2558 |
: "=r" (result) |
2549 |
: |
2559 |
: |
2550 |
: "%eax", "%ecx", "%edx" |
2560 |
: "%eax", "%ecx", "%edx" |