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