1 | ; $Id: ASMCpuId.asm 76553 2019-01-01 01:45:53Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; IPRT - ASMCpuIdExSlow().
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2012-2019 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 input, returning ALL output registers (no NULL checking).
|
---|
36 | ;
|
---|
37 | ; @param uOperator 8086:bp+4 x86:ebp+8 gcc:rdi msc:rcx
|
---|
38 | ; @param pvEAX 8086:bp+8 x86:ebp+0c gcc:rsi msc:rdx
|
---|
39 | ; @param pvEBX 8086:bp+0c x86:ebp+10 gcc:rdx msc:r8
|
---|
40 | ; @param pvECX 8086:bp+10 x86:ebp+14 gcc:rcx msc:r9
|
---|
41 | ; @param pvEDX 8086:bp+14 x86:ebp+18 gcc:r8 msc:rbp+30h
|
---|
42 | ;
|
---|
43 | ; DECLASM(void) ASMCpuId(uint32_t uOperator, void *pvEAX, void *pvEBX, void *pvECX, void *pvEDX);
|
---|
44 | ;
|
---|
45 | BEGINPROC_EXPORTED ASMCpuId
|
---|
46 | push xBP
|
---|
47 | mov xBP, xSP
|
---|
48 | push xBX
|
---|
49 |
|
---|
50 | %ifdef ASM_CALL64_MSC
|
---|
51 | %if ARCH_BITS != 64
|
---|
52 | %error ARCH_BITS mismatch?
|
---|
53 | %endif
|
---|
54 | mov eax, ecx
|
---|
55 | mov r10, rdx
|
---|
56 | cpuid
|
---|
57 | mov [r10], eax
|
---|
58 | mov [r8], ebx
|
---|
59 | mov [r9], ecx
|
---|
60 | mov r10, [rbp+30h]
|
---|
61 | mov [r10], edx
|
---|
62 |
|
---|
63 | %elifdef ASM_CALL64_GCC
|
---|
64 | mov eax, edi
|
---|
65 | mov r10, rdx
|
---|
66 | mov r11, rcx
|
---|
67 | cpuid
|
---|
68 | mov [rsi], eax
|
---|
69 | mov [r10], ebx
|
---|
70 | mov [r11], ecx
|
---|
71 | mov [r8], edx
|
---|
72 |
|
---|
73 | %elif ARCH_BITS == 32
|
---|
74 | mov eax, [xBP + 08h]
|
---|
75 | cpuid
|
---|
76 | push edx
|
---|
77 | mov edx, [xBP + 0ch]
|
---|
78 | mov [edx], eax
|
---|
79 | mov edx, [xBP + 10h]
|
---|
80 | mov [edx], ebx
|
---|
81 | mov edx, [xBP + 14h]
|
---|
82 | mov [edx], ecx
|
---|
83 | mov edx, [xBP + 18h]
|
---|
84 | pop dword [edx]
|
---|
85 |
|
---|
86 | %elif ARCH_BITS == 16
|
---|
87 | push es
|
---|
88 | push di
|
---|
89 |
|
---|
90 | mov eax, [xBP + 04h]
|
---|
91 | cpuid
|
---|
92 | les di, [xBP + 08h]
|
---|
93 | mov [di], eax
|
---|
94 | les di, [xBP + 0ch]
|
---|
95 | mov [di], ebx
|
---|
96 | les di, [xBP + 10h]
|
---|
97 | mov [di], ecx
|
---|
98 | les di, [xBP + 14h]
|
---|
99 | mov [di], edx
|
---|
100 |
|
---|
101 | pop di
|
---|
102 | pop es
|
---|
103 | %else
|
---|
104 | %error unsupported arch
|
---|
105 | %endif
|
---|
106 |
|
---|
107 | pop xBX
|
---|
108 | leave
|
---|
109 | ret
|
---|
110 | ENDPROC ASMCpuId
|
---|
111 |
|
---|