1
0

cpu_x86.s 716 B

1234567891011121314151617181920212223242526272829303132
  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. // +build 386 amd64 amd64p32
  5. #include "textflag.h"
  6. // func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32)
  7. TEXT ·cpuid(SB), NOSPLIT, $0-24
  8. MOVL eaxArg+0(FP), AX
  9. MOVL ecxArg+4(FP), CX
  10. CPUID
  11. MOVL AX, eax+8(FP)
  12. MOVL BX, ebx+12(FP)
  13. MOVL CX, ecx+16(FP)
  14. MOVL DX, edx+20(FP)
  15. RET
  16. // func xgetbv() (eax, edx uint32)
  17. TEXT ·xgetbv(SB),NOSPLIT,$0-8
  18. #ifdef GOOS_nacl
  19. // nacl does not support XGETBV.
  20. MOVL $0, eax+0(FP)
  21. MOVL $0, edx+4(FP)
  22. #else
  23. MOVL $0, CX
  24. WORD $0x010f; BYTE $0xd0 //XGETBV
  25. MOVL AX, eax+0(FP)
  26. MOVL DX, edx+4(FP)
  27. #endif
  28. RET