Changeset 639 in vbox for trunk/include
- Timestamp:
- Feb 5, 2007 2:25:02 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/asm.h
r434 r639 522 522 { 523 523 # if RT_INLINE_ASM_GNU_STYLE 524 # ifdef __AMD64__ 525 RTCCUINTREG uRAX, uRBX, uRCX, uRDX; 526 __asm__ ("cpuid\n\t" 527 : "=a" (uRAX), 528 "=b" (uRBX), 529 "=c" (uRCX), 530 "=d" (uRDX) 531 : "0" (uOperator)); 532 *(uint32_t *)pvEAX = (uint32_t)uRAX; 533 *(uint32_t *)pvEBX = (uint32_t)uRBX; 534 *(uint32_t *)pvECX = (uint32_t)uRCX; 535 *(uint32_t *)pvEDX = (uint32_t)uRDX; 536 # else 524 537 __asm__ ("xchgl %%ebx, %1\n\t" 525 538 "cpuid\n\t" … … 530 543 "=d" (*(uint32_t *)pvEDX) 531 544 : "0" (uOperator)); 545 # endif 532 546 533 547 # elif RT_INLINE_ASM_USES_INTRIN … … 594 608 DECLINLINE(uint32_t) ASMCpuId_EDX(uint32_t uOperator) 595 609 { 596 uint32_t u32EDX; 597 # if RT_INLINE_ASM_GNU_STYLE 598 # if (defined(PIC) || defined(__DARWIN__)) && defined(__i386__) /* darwin: 4.0.1 compiler option / bug? */ 610 RTCCUINTREG xDX; 611 # if RT_INLINE_ASM_GNU_STYLE 612 # ifdef __AMD64__ 613 RTCCUINTREG uSpill; 614 __asm__ ("cpuid" 615 : "=a" (uSpill), 616 "=d" (xDX) 617 : "0" (uOperator) 618 : "rbx", "rcx"); 619 # elif (defined(PIC) || defined(__DARWIN__)) && defined(__i386__) /* darwin: PIC by default. */ 599 620 __asm__ ("push %%ebx\n\t" 600 621 "cpuid\n\t" 601 622 "pop %%ebx\n\t" 602 623 : "=a" (uOperator), 603 "=d" ( u32EDX)624 "=d" (xDX) 604 625 : "0" (uOperator) 605 626 : "ecx"); … … 607 628 __asm__ ("cpuid" 608 629 : "=a" (uOperator), 609 "=d" ( u32EDX)630 "=d" (xDX) 610 631 : "0" (uOperator) 611 632 : "ebx", "ecx"); … … 623 644 mov eax, [uOperator] 624 645 cpuid 625 mov [ u32EDX], edx646 mov [xDX], edx 626 647 pop ebx 627 648 } 628 649 # endif 629 return u32EDX;650 return (uint32_t)xDX; 630 651 } 631 652 #endif … … 643 664 DECLINLINE(uint32_t) ASMCpuId_ECX(uint32_t uOperator) 644 665 { 645 uint32_t u32ECX; 646 # if RT_INLINE_ASM_GNU_STYLE 647 # if (defined(PIC) || defined(__DARWIN__)) && defined(__i386__) /* darwin: 4.0.1 compiler option / bug? */ 666 RTCCUINTREG xCX; 667 # if RT_INLINE_ASM_GNU_STYLE 668 # ifdef __AMD64__ 669 RTCCUINTREG uSpill; 670 __asm__ ("cpuid" 671 : "=a" (uSpill), 672 "=c" (xCX) 673 : "0" (uOperator) 674 : "rbx", "rdx"); 675 # elif (defined(PIC) || defined(__DARWIN__)) && defined(__i386__) /* darwin: 4.0.1 compiler option / bug? */ 648 676 __asm__ ("push %%ebx\n\t" 649 677 "cpuid\n\t" 650 678 "pop %%ebx\n\t" 651 679 : "=a" (uOperator), 652 "=c" ( u32ECX)680 "=c" (xCX) 653 681 : "0" (uOperator) 654 682 : "edx"); … … 656 684 __asm__ ("cpuid" 657 685 : "=a" (uOperator), 658 "=c" ( u32ECX)686 "=c" (xCX) 659 687 : "0" (uOperator) 660 688 : "ebx", "edx"); … … 665 693 int aInfo[4]; 666 694 __cpuid(aInfo, uOperator); 667 u32ECX = aInfo[2];695 xCX = aInfo[2]; 668 696 669 697 # else … … 673 701 mov eax, [uOperator] 674 702 cpuid 675 mov [ u32ECX], ecx703 mov [xCX], ecx 676 704 pop ebx 677 705 } 678 706 # endif 679 return u32ECX;707 return (uint32_t)xCX; 680 708 } 681 709 #endif
Note:
See TracChangeset
for help on using the changeset viewer.