github.com/neonyo/sys@v0.0.0-20230720094341-b1ee14be3ce8/cpu/cpu_x86.s (about)

     1  // Copyright 2018 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build (386 || amd64 || amd64p32) && gc
     6  // +build 386 amd64 amd64p32
     7  // +build gc
     8  
     9  #include "textflag.h"
    10  
    11  // func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32)
    12  TEXT ·cpuid(SB), NOSPLIT, $0-24
    13  	MOVL eaxArg+0(FP), AX
    14  	MOVL ecxArg+4(FP), CX
    15  	CPUID
    16  	MOVL AX, eax+8(FP)
    17  	MOVL BX, ebx+12(FP)
    18  	MOVL CX, ecx+16(FP)
    19  	MOVL DX, edx+20(FP)
    20  	RET
    21  
    22  // func xgetbv() (eax, edx uint32)
    23  TEXT ·xgetbv(SB),NOSPLIT,$0-8
    24  	MOVL $0, CX
    25  	XGETBV
    26  	MOVL AX, eax+0(FP)
    27  	MOVL DX, edx+4(FP)
    28  	RET