1 | ; $Id: ASMCpuIdExSlow.asm 62477 2016-07-22 18:27:37Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; IPRT - ASMCpuIdExSlow().
|
---|
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 uInitEBX x86:ebp+c gcc:rsi msc:rdx
|
---|
39 | ; @param uInitECX x86:ebp+10 gcc:rdx msc:r8
|
---|
40 | ; @param uInitEDX x86:ebp+14 gcc:rcx msc:r9
|
---|
41 | ; @param pvEAX x86:ebp+18 gcc:r8 msc:rbp+30h
|
---|
42 | ; @param pvEBX x86:ebp+1c gcc:r9 msc:rbp+38h
|
---|
43 | ; @param pvECX x86:ebp+20 gcc:rbp+10h msc:rbp+40h
|
---|
44 | ; @param pvEDX x86:ebp+24 gcc:rbp+18h msc:rbp+48h
|
---|
45 | ;
|
---|
46 | ; @returns EAX
|
---|
47 | ;
|
---|
48 | BEGINPROC_EXPORTED ASMCpuIdExSlow
|
---|
49 | push xBP
|
---|
50 | mov xBP, xSP
|
---|
51 | push xBX
|
---|
52 | %ifdef RT_ARCH_X86
|
---|
53 | push edi
|
---|
54 | %endif
|
---|
55 |
|
---|
56 | %ifdef ASM_CALL64_MSC
|
---|
57 | mov eax, ecx
|
---|
58 | mov ebx, edx
|
---|
59 | mov ecx, r8d
|
---|
60 | mov edx, r9d
|
---|
61 | mov r8, [rbp + 30h]
|
---|
62 | mov r9, [rbp + 38h]
|
---|
63 | mov r10, [rbp + 40h]
|
---|
64 | mov r11, [rbp + 48h]
|
---|
65 | %elifdef ASM_CALL64_GCC
|
---|
66 | mov eax, edi
|
---|
67 | mov ebx, esi
|
---|
68 | xchg ecx, edx
|
---|
69 | mov r10, [rbp + 10h]
|
---|
70 | mov r11, [rbp + 18h]
|
---|
71 | %elifdef RT_ARCH_X86
|
---|
72 | mov eax, [ebp + 08h]
|
---|
73 | mov ebx, [ebp + 0ch]
|
---|
74 | mov ecx, [ebp + 10h]
|
---|
75 | mov edx, [ebp + 14h]
|
---|
76 | mov edi, [ebp + 18h]
|
---|
77 | %else
|
---|
78 | %error unsupported arch
|
---|
79 | %endif
|
---|
80 |
|
---|
81 | cpuid
|
---|
82 |
|
---|
83 | %ifdef RT_ARCH_AMD64
|
---|
84 | test r8, r8
|
---|
85 | jz .store_ebx
|
---|
86 | mov [r8], eax
|
---|
87 | %else
|
---|
88 | test edi, edi
|
---|
89 | jz .store_ebx
|
---|
90 | mov [edi], eax
|
---|
91 | %endif
|
---|
92 | .store_ebx:
|
---|
93 |
|
---|
94 | %ifdef RT_ARCH_AMD64
|
---|
95 | test r9, r9
|
---|
96 | jz .store_ecx
|
---|
97 | mov [r9], ebx
|
---|
98 | %else
|
---|
99 | mov edi, [ebp + 1ch]
|
---|
100 | test edi, edi
|
---|
101 | jz .store_ecx
|
---|
102 | mov [edi], ebx
|
---|
103 | %endif
|
---|
104 | .store_ecx:
|
---|
105 |
|
---|
106 | %ifdef RT_ARCH_AMD64
|
---|
107 | test r10, r10
|
---|
108 | jz .store_edx
|
---|
109 | mov [r10], ecx
|
---|
110 | %else
|
---|
111 | mov edi, [ebp + 20h]
|
---|
112 | test edi, edi
|
---|
113 | jz .store_edx
|
---|
114 | mov [edi], ecx
|
---|
115 | %endif
|
---|
116 | .store_edx:
|
---|
117 |
|
---|
118 | %ifdef RT_ARCH_AMD64
|
---|
119 | test r11, r11
|
---|
120 | jz .done
|
---|
121 | mov [r11], edx
|
---|
122 | %else
|
---|
123 | mov edi, [ebp + 24h]
|
---|
124 | test edi, edi
|
---|
125 | jz .done
|
---|
126 | mov [edi], edx
|
---|
127 | %endif
|
---|
128 | .done:
|
---|
129 |
|
---|
130 | %ifdef RT_ARCH_X86
|
---|
131 | pop edi
|
---|
132 | %endif
|
---|
133 | pop xBX
|
---|
134 | leave
|
---|
135 | ret
|
---|
136 | ENDPROC ASMCpuIdExSlow
|
---|
137 |
|
---|