1 | ; $Id: ASMCpuId_Idx_ECX.asm 62477 2016-07-22 18:27:37Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; IPRT - ASMCpuId_Idx_ECX().
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2012-2016 Oracle Corporation
|
---|
8 | ;
|
---|
9 | ; This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | ; available from http://www.virtualbox.org. This file is free software;
|
---|
11 | ; you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | ; General Public License (GPL) as published by the Free Software
|
---|
13 | ; Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | ; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | ; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | ;
|
---|
17 | ; The contents of this file may alternatively be used under the terms
|
---|
18 | ; of the Common Development and Distribution License Version 1.0
|
---|
19 | ; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | ; VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | ; CDDL are applicable instead of those of the GPL.
|
---|
22 | ;
|
---|
23 | ; You may elect to license modified versions of this file under the
|
---|
24 | ; terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | ;
|
---|
26 |
|
---|
27 | ;*******************************************************************************
|
---|
28 | ;* Header Files *
|
---|
29 | ;*******************************************************************************
|
---|
30 | %include "iprt/asmdefs.mac"
|
---|
31 |
|
---|
32 | BEGINCODE
|
---|
33 |
|
---|
34 | ;;
|
---|
35 | ; CPUID with EAX and ECX inputs, returning ALL output registers.
|
---|
36 | ;
|
---|
37 | ; @param uOperator x86:ebp+8 gcc:rdi msc:rcx
|
---|
38 | ; @param uIdxECX x86:ebp+c gcc:rsi msc:rdx
|
---|
39 | ; @param pvEAX x86:ebp+10 gcc:rdx msc:r8
|
---|
40 | ; @param pvEBX x86:ebp+14 gcc:rcx msc:r9
|
---|
41 | ; @param pvECX x86:ebp+18 gcc:r8 msc:rsp+28h
|
---|
42 | ; @param pvEDX x86:ebp+1c gcc:r9 msc:rsp+30h
|
---|
43 | ;
|
---|
44 | ; @returns void
|
---|
45 | ;
|
---|
46 | BEGINPROC_EXPORTED ASMCpuId_Idx_ECX
|
---|
47 | %ifdef RT_ARCH_AMD64
|
---|
48 | mov r10, rbx
|
---|
49 |
|
---|
50 | %ifdef ASM_CALL64_MSC
|
---|
51 |
|
---|
52 | mov eax, ecx
|
---|
53 | mov ecx, edx
|
---|
54 | xor ebx, ebx
|
---|
55 | xor edx, edx
|
---|
56 |
|
---|
57 | cpuid
|
---|
58 |
|
---|
59 | mov [r8], eax
|
---|
60 | mov [r9], ebx
|
---|
61 | mov rax, [rsp + 28h]
|
---|
62 | mov rbx, [rsp + 30h]
|
---|
63 | mov [rax], ecx
|
---|
64 | mov [rbx], edx
|
---|
65 |
|
---|
66 | %else
|
---|
67 | mov rsi, rdx
|
---|
68 | mov r11, rcx
|
---|
69 | mov eax, edi
|
---|
70 | mov ecx, esi
|
---|
71 | xor ebx, ebx
|
---|
72 | xor edx, edx
|
---|
73 |
|
---|
74 | cpuid
|
---|
75 |
|
---|
76 | mov [rsi], eax
|
---|
77 | mov [r11], ebx
|
---|
78 | mov [r8], ecx
|
---|
79 | mov [r9], edx
|
---|
80 |
|
---|
81 | %endif
|
---|
82 |
|
---|
83 | mov rbx, r10
|
---|
84 | ret
|
---|
85 |
|
---|
86 | %elifdef RT_ARCH_X86
|
---|
87 | push ebp
|
---|
88 | mov ebp, esp
|
---|
89 | push ebx
|
---|
90 | push edi
|
---|
91 |
|
---|
92 | xor edx, edx
|
---|
93 | xor ebx, ebx
|
---|
94 | mov eax, [ebp + 08h]
|
---|
95 | mov ecx, [ebp + 0ch]
|
---|
96 |
|
---|
97 | cpuid
|
---|
98 |
|
---|
99 | mov edi, [ebp + 10h]
|
---|
100 | mov [edi], eax
|
---|
101 | mov edi, [ebp + 14h]
|
---|
102 | mov [edi], ebx
|
---|
103 | mov edi, [ebp + 18h]
|
---|
104 | mov [edi], ecx
|
---|
105 | mov edi, [ebp + 1ch]
|
---|
106 | mov [edi], edx
|
---|
107 |
|
---|
108 | pop edi
|
---|
109 | pop ebx
|
---|
110 | leave
|
---|
111 | ret
|
---|
112 | %else
|
---|
113 | %error unsupported arch
|
---|
114 | %endif
|
---|
115 | ENDPROC ASMCpuId_Idx_ECX
|
---|
116 |
|
---|