github.com/primecitizens/pcz/std@v0.2.1/core/cpu/cpu_x86.s (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  //
     4  // Copyright 2017 The Go Authors. All rights reserved.
     5  // Use of this source code is governed by a BSD-style
     6  // license that can be found in the LICENSE file.
     7  
     8  //go:build 386 || amd64
     9  
    10  #include "textflag.h"
    11  
    12  // func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32)
    13  TEXT ·cpuid(SB), NOSPLIT, $0-24
    14  	MOVL eaxArg+0(FP), AX
    15  	MOVL ecxArg+4(FP), CX
    16  	CPUID
    17  	MOVL AX, eax+8(FP)
    18  	MOVL BX, ebx+12(FP)
    19  	MOVL CX, ecx+16(FP)
    20  	MOVL DX, edx+20(FP)
    21  	RET
    22  
    23  // func xgetbv() (eax, edx uint32)
    24  TEXT ·xgetbv(SB),NOSPLIT,$0-8
    25  	MOVL $0, CX
    26  	XGETBV
    27  	MOVL AX, eax+0(FP)
    28  	MOVL DX, edx+4(FP)
    29  	RET
    30  
    31  // func getGOAMD64level() int32
    32  TEXT ·getGOAMD64level(SB),NOSPLIT,$0-4
    33  #ifdef GOAMD64_v4
    34  	MOVL $4, ret+0(FP)
    35  #else
    36  #ifdef GOAMD64_v3
    37  	MOVL $3, ret+0(FP)
    38  #else
    39  #ifdef GOAMD64_v2
    40  	MOVL $2, ret+0(FP)
    41  #else
    42  	MOVL $1, ret+0(FP)
    43  #endif
    44  #endif
    45  #endif
    46  	RET