github.com/loov/hrtime@v1.0.3/tsc_amd64.s (about)

     1  // +build amd64,!gccgo
     2  
     3  #include "textflag.h"
     4  
     5  // func rdtscpAsm() uint64
     6  TEXT ·rdtscpAsm(SB),NOSPLIT,$0-8
     7  	BYTE $0x0F; BYTE $0x01; BYTE $0xF9 // RDTSCP
     8  	SHLQ $32, DX
     9  	ADDQ DX, AX
    10  	MOVQ AX, ret+0(FP)
    11  	RET
    12  
    13  // func rdtscAsm() uint64
    14  TEXT ·rdtscAsm(SB),NOSPLIT,$0-8
    15  	RDTSC
    16  	SHLQ $32, DX
    17  	ADDQ DX, AX
    18  	MOVQ AX, ret+0(FP)
    19  	RET
    20  
    21  // func ·cpuidAsm(op, op2 uint32) (eax, ebx, ecx, edx uint32)
    22  TEXT ·cpuidAsm(SB),NOSPLIT,$8-24
    23  	MOVL  op1+0(FP), AX
    24  	MOVL  op2+4(FP), CX
    25  	CPUID
    26  	MOVL  AX, eax+8(FP)
    27  	MOVL  BX, ebx+12(FP)
    28  	MOVL  CX, ecx+16(FP)
    29  	MOVL  DX, edx+20(FP)
    30  	RET