catinello.eu/x/cpuid@v0.0.0-20231214173555-81a76c018636/cpuid_386.s (about)

     1  // Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file.
     2  
     3  //+build 386,!gccgo,!noasm,!appengine
     4  
     5  // func asmCpuid(op uint32) (eax, ebx, ecx, edx uint32)
     6  TEXT ·asmCpuid(SB), 7, $0
     7  	XORL CX, CX
     8  	MOVL op+0(FP), AX
     9  	CPUID
    10  	MOVL AX, eax+4(FP)
    11  	MOVL BX, ebx+8(FP)
    12  	MOVL CX, ecx+12(FP)
    13  	MOVL DX, edx+16(FP)
    14  	RET
    15  
    16  // func asmCpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32)
    17  TEXT ·asmCpuidex(SB), 7, $0
    18  	MOVL op+0(FP), AX
    19  	MOVL op2+4(FP), CX
    20  	CPUID
    21  	MOVL AX, eax+8(FP)
    22  	MOVL BX, ebx+12(FP)
    23  	MOVL CX, ecx+16(FP)
    24  	MOVL DX, edx+20(FP)
    25  	RET
    26  
    27  // func xgetbv(index uint32) (eax, edx uint32)
    28  TEXT ·asmXgetbv(SB), 7, $0
    29  	MOVL index+0(FP), CX
    30  	BYTE $0x0f; BYTE $0x01; BYTE $0xd0 // XGETBV
    31  	MOVL AX, eax+4(FP)
    32  	MOVL DX, edx+8(FP)
    33  	RET
    34  
    35  // func asmRdtscpAsm() (eax, ebx, ecx, edx uint32)
    36  TEXT ·asmRdtscpAsm(SB), 7, $0
    37  	BYTE $0x0F; BYTE $0x01; BYTE $0xF9 // RDTSCP
    38  	MOVL AX, eax+0(FP)
    39  	MOVL BX, ebx+4(FP)
    40  	MOVL CX, ecx+8(FP)
    41  	MOVL DX, edx+12(FP)
    42  	RET
    43  
    44  // func asmDarwinHasAVX512() bool
    45  TEXT ·asmDarwinHasAVX512(SB), 7, $0
    46  	MOVL $0, eax+0(FP)
    47  	RET