github.com/epfl-dcsl/gotee@v0.0.0-20200909122901-014b35f5e5e9/src/internal/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 // +build 386 amd64 amd64p32 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 // try to check if it is enclave. 12 MOVB runtime·isEnclave(SB), R8 13 CMPB R8, $1 14 JNE normal 15 RET 16 17 normal: 18 MOVL eaxArg+0(FP), AX 19 MOVL ecxArg+4(FP), CX 20 CPUID 21 MOVL AX, eax+8(FP) 22 MOVL BX, ebx+12(FP) 23 MOVL CX, ecx+16(FP) 24 MOVL DX, edx+20(FP) 25 RET 26 27 // func xgetbv() (eax, edx uint32) 28 TEXT ·xgetbv(SB),NOSPLIT,$0-8 29 #ifdef GOOS_nacl 30 // nacl does not support XGETBV. 31 MOVL $0, eax+0(FP) 32 MOVL $0, edx+4(FP) 33 #else 34 MOVL $0, CX 35 XGETBV 36 MOVL AX, eax+0(FP) 37 MOVL DX, edx+4(FP) 38 #endif 39 RET