VirtualBox

source: vbox/trunk/src/VBox/Runtime/common/asm/ASMCpuIdExSlow.asm@ 103795

Last change on this file since 103795 was 98103, checked in by vboxsync, 2 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 KB
Line 
1; $Id: ASMCpuIdExSlow.asm 98103 2023-01-17 14:15:46Z vboxsync $
2;; @file
3; IPRT - ASMCpuIdExSlow().
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
42BEGINCODE
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 uInitEBX x86:ebp+c gcc:rsi msc:rdx
49; @param uInitECX x86:ebp+10 gcc:rdx msc:r8
50; @param uInitEDX x86:ebp+14 gcc:rcx msc:r9
51; @param pvEAX x86:ebp+18 gcc:r8 msc:rbp+30h
52; @param pvEBX x86:ebp+1c gcc:r9 msc:rbp+38h
53; @param pvECX x86:ebp+20 gcc:rbp+10h msc:rbp+40h
54; @param pvEDX x86:ebp+24 gcc:rbp+18h msc:rbp+48h
55;
56; @returns EAX
57;
58RT_BEGINPROC ASMCpuIdExSlow
59 push xBP
60 mov xBP, xSP
61 push xBX
62%if ARCH_BITS == 32
63 push edi
64%elif ARCH_BITS == 16
65 push di
66 push es
67%endif
68
69%ifdef ASM_CALL64_MSC
70 %if ARCH_BITS != 64
71 %error ARCH_BITS mismatch?
72 %endif
73 mov eax, ecx
74 mov ebx, edx
75 mov ecx, r8d
76 mov edx, r9d
77 mov r8, [rbp + 30h]
78 mov r9, [rbp + 38h]
79 mov r10, [rbp + 40h]
80 mov r11, [rbp + 48h]
81%elifdef ASM_CALL64_GCC
82 mov eax, edi
83 mov ebx, esi
84 xchg ecx, edx
85 mov r10, [rbp + 10h]
86 mov r11, [rbp + 18h]
87%elif ARCH_BITS == 32
88 mov eax, [xBP + 08h]
89 mov ebx, [xBP + 0ch]
90 mov ecx, [xBP + 10h]
91 mov edx, [xBP + 14h]
92 mov edi, [xBP + 18h]
93%elif ARCH_BITS == 16
94 mov eax, [xBP + 08h - 4]
95 mov ebx, [xBP + 0ch - 4]
96 mov ecx, [xBP + 10h - 4]
97 mov edx, [xBP + 14h - 4]
98%else
99 %error unsupported arch
100%endif
101
102 cpuid
103
104%ifdef RT_ARCH_AMD64
105 test r8, r8
106 jz .store_ebx
107 mov [r8], eax
108%elif ARCH_BITS == 32
109 test edi, edi
110 jz .store_ebx
111 mov [edi], eax
112%else
113 cmp dword [bp + 18h - 4], 0
114 je .store_ebx
115 les di, [bp + 18h - 4]
116 mov [es:di], eax
117%endif
118.store_ebx:
119
120%ifdef RT_ARCH_AMD64
121 test r9, r9
122 jz .store_ecx
123 mov [r9], ebx
124%elif ARCH_BITS == 32
125 mov edi, [ebp + 1ch]
126 test edi, edi
127 jz .store_ecx
128 mov [edi], ebx
129%else
130 cmp dword [bp + 1ch - 4], 0
131 je .store_ecx
132 les di, [bp + 1ch - 4]
133 mov [es:di], ebx
134%endif
135.store_ecx:
136
137%ifdef RT_ARCH_AMD64
138 test r10, r10
139 jz .store_edx
140 mov [r10], ecx
141%elif ARCH_BITS == 32
142 mov edi, [ebp + 20h]
143 test edi, edi
144 jz .store_edx
145 mov [edi], ecx
146%else
147 cmp dword [bp + 20h - 4], 0
148 je .store_edx
149 les di, [bp + 20h - 4]
150 mov [es:di], ecx
151%endif
152.store_edx:
153
154%ifdef RT_ARCH_AMD64
155 test r11, r11
156 jz .done
157 mov [r11], edx
158%elif ARCH_BITS == 32
159 mov edi, [ebp + 24h]
160 test edi, edi
161 jz .done
162 mov [edi], edx
163%else
164 cmp dword [bp + 24h - 4], 0
165 je .done
166 les di, [bp + 24h - 4]
167 mov [es:di], edx
168%endif
169.done:
170
171%if ARCH_BITS == 32
172 pop edi
173%elif ARCH_BITS == 16
174 pop es
175 pop di
176%endif
177 pop xBX
178 leave
179 ret
180ENDPROC ASMCpuIdExSlow
181
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette