VirtualBox

source: vbox/trunk/src/VBox/Runtime/common/asm/ASMCpuId.asm

Last change on this file was 98103, checked in by vboxsync, 16 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1; $Id: ASMCpuId.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 input, returning ALL output registers (no NULL checking).
46;
47; @param uOperator 8086:bp+4 x86:ebp+8 gcc:rdi msc:rcx
48; @param pvEAX 8086:bp+8 x86:ebp+0c gcc:rsi msc:rdx
49; @param pvEBX 8086:bp+0c x86:ebp+10 gcc:rdx msc:r8
50; @param pvECX 8086:bp+10 x86:ebp+14 gcc:rcx msc:r9
51; @param pvEDX 8086:bp+14 x86:ebp+18 gcc:r8 msc:rbp+30h
52;
53; DECLASM(void) ASMCpuId(uint32_t uOperator, void *pvEAX, void *pvEBX, void *pvECX, void *pvEDX);
54;
55RT_BEGINPROC ASMCpuId
56 push xBP
57 mov xBP, xSP
58 push xBX
59
60%ifdef ASM_CALL64_MSC
61 %if ARCH_BITS != 64
62 %error ARCH_BITS mismatch?
63 %endif
64 mov eax, ecx
65 mov r10, rdx
66 cpuid
67 mov [r10], eax
68 mov [r8], ebx
69 mov [r9], ecx
70 mov r10, [rbp+30h]
71 mov [r10], edx
72
73%elifdef ASM_CALL64_GCC
74 mov eax, edi
75 mov r10, rdx
76 mov r11, rcx
77 cpuid
78 mov [rsi], eax
79 mov [r10], ebx
80 mov [r11], ecx
81 mov [r8], edx
82
83%elif ARCH_BITS == 32
84 mov eax, [xBP + 08h]
85 cpuid
86 push edx
87 mov edx, [xBP + 0ch]
88 mov [edx], eax
89 mov edx, [xBP + 10h]
90 mov [edx], ebx
91 mov edx, [xBP + 14h]
92 mov [edx], ecx
93 mov edx, [xBP + 18h]
94 pop dword [edx]
95
96%elif ARCH_BITS == 16
97 push es
98 push di
99
100 mov eax, [xBP + 04h]
101 cpuid
102 les di, [xBP + 08h]
103 mov [di], eax
104 les di, [xBP + 0ch]
105 mov [di], ebx
106 les di, [xBP + 10h]
107 mov [di], ecx
108 les di, [xBP + 14h]
109 mov [di], edx
110
111 pop di
112 pop es
113%else
114 %error unsupported arch
115%endif
116
117 pop xBX
118 leave
119 ret
120ENDPROC ASMCpuId
121
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use