1 | ; $Id: ASMCpuIdExSlow.asm 49194 2013-10-18 22:08:35Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; IPRT - ASMCpuIdExSlow().
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2012-2013 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:rcx msc:r8
|
---|
40 | ; @param uInitEDX x86:ebp+14 gcc:rdx 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 | mov r10, [rbp + 10h]
|
---|
69 | mov r11, [rbp + 18h]
|
---|
70 | %elifdef RT_ARCH_X86
|
---|
71 | mov eax, [ebp + 08h]
|
---|
72 | mov ebx, [ebp + 0ch]
|
---|
73 | mov ecx, [ebp + 10h]
|
---|
74 | mov edx, [ebp + 14h]
|
---|
75 | mov edi, [ebp + 18h]
|
---|
76 | %else
|
---|
77 | %error unsupported arch
|
---|
78 | %endif
|
---|
79 |
|
---|
80 | cpuid
|
---|
81 |
|
---|
82 | %ifdef RT_ARCH_AMD64
|
---|
83 | test r8, r8
|
---|
84 | jz .store_ebx
|
---|
85 | mov [r8], eax
|
---|
86 | %else
|
---|
87 | test edi, edi
|
---|
88 | jz .store_ebx
|
---|
89 | mov [edi], eax
|
---|
90 | %endif
|
---|
91 | .store_ebx:
|
---|
92 |
|
---|
93 | %ifdef RT_ARCH_AMD64
|
---|
94 | test r9, r9
|
---|
95 | jz .store_ecx
|
---|
96 | mov [r9], ebx
|
---|
97 | %else
|
---|
98 | mov edi, [ebp + 1ch]
|
---|
99 | test edi, edi
|
---|
100 | jz .store_ecx
|
---|
101 | mov [edi], ebx
|
---|
102 | %endif
|
---|
103 | .store_ecx:
|
---|
104 |
|
---|
105 | %ifdef RT_ARCH_AMD64
|
---|
106 | test r10, r10
|
---|
107 | jz .store_edx
|
---|
108 | mov [r10], ecx
|
---|
109 | %else
|
---|
110 | mov edi, [ebp + 20h]
|
---|
111 | test edi, edi
|
---|
112 | jz .store_edx
|
---|
113 | mov [edi], ecx
|
---|
114 | %endif
|
---|
115 | .store_edx:
|
---|
116 |
|
---|
117 | %ifdef RT_ARCH_AMD64
|
---|
118 | test r11, r11
|
---|
119 | jz .done
|
---|
120 | mov [r11], edx
|
---|
121 | %else
|
---|
122 | mov edi, [ebp + 24h]
|
---|
123 | test edi, edi
|
---|
124 | jz .done
|
---|
125 | mov [edi], edx
|
---|
126 | %endif
|
---|
127 | .done:
|
---|
128 |
|
---|
129 | %ifdef RT_ARCH_X86
|
---|
130 | pop edi
|
---|
131 | %endif
|
---|
132 | pop xBX
|
---|
133 | leave
|
---|
134 | ret
|
---|
135 | ENDPROC ASMCpuIdExSlow
|
---|
136 |
|
---|