github.com/m3db/m3@v1.5.0/src/x/sync/cpu_linux_amd64.s (about)

     1  #include "textflag.h"
     2  #include "go_asm.h"
     3  
     4  #define	get_tls(r)	MOVQ TLS, r
     5  
     6  // func getCore() int
     7  TEXT ·getCore(SB), NOSPLIT, $0
     8  	// RDTSCP
     9  	BYTE $0x0f; BYTE $0x01; BYTE $0xf9
    10  
    11  	// Linux puts core ID in the bottom byte.
    12  	ANDQ $0xff, CX
    13  	MOVQ CX, ret+0(FP)
    14  	RET