cpu_x86.s raw

   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  // func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32)
   8  TEXT ·cpuid(SB), 4, $0-24
   9  	MOVL eaxArg+0(FP), AX
  10  	MOVL ecxArg+4(FP), CX
  11  	CPUID
  12  	MOVL AX, eax+8(FP)
  13  	MOVL BX, ebx+12(FP)
  14  	MOVL CX, ecx+16(FP)
  15  	MOVL DX, edx+20(FP)
  16  	RET
  17  
  18  // func xgetbv() (eax, edx uint32)
  19  TEXT ·xgetbv(SB),4,$0-8
  20  #ifdef GOOS_nacl
  21  	// nacl does not support XGETBV.
  22  	MOVL $0, eax+0(FP)
  23  	MOVL $0, edx+4(FP)
  24  #else
  25  	MOVL $0, CX
  26  	XGETBV
  27  	MOVL AX, eax+0(FP)
  28  	MOVL DX, edx+4(FP)
  29  #endif
  30  	RET
  31