github.com/JimmyHuang454/JLS-go@v0.0.0-20230831150107-90d536585ba0/cpu/cpu_x86.s (about) 1 // Copyright 2017 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 6 7 #include "textflag.h" 8 9 // func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) 10 TEXT ·cpuid(SB), NOSPLIT, $0-24 11 MOVL eaxArg+0(FP), AX 12 MOVL ecxArg+4(FP), CX 13 CPUID 14 MOVL AX, eax+8(FP) 15 MOVL BX, ebx+12(FP) 16 MOVL CX, ecx+16(FP) 17 MOVL DX, edx+20(FP) 18 RET 19 20 // func xgetbv() (eax, edx uint32) 21 TEXT ·xgetbv(SB),NOSPLIT,$0-8 22 MOVL $0, CX 23 XGETBV 24 MOVL AX, eax+0(FP) 25 MOVL DX, edx+4(FP) 26 RET 27 28 // func getGOAMD64level() int32 29 TEXT ·getGOAMD64level(SB),NOSPLIT,$0-4 30 #ifdef GOAMD64_v4 31 MOVL $4, ret+0(FP) 32 #else 33 #ifdef GOAMD64_v3 34 MOVL $3, ret+0(FP) 35 #else 36 #ifdef GOAMD64_v2 37 MOVL $2, ret+0(FP) 38 #else 39 MOVL $1, ret+0(FP) 40 #endif 41 #endif 42 #endif 43 RET