1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4
5#include "common.h"
6
7extern "C"
8{
9 void RedirectForThrowControl()
10 {
11 PORTABILITY_ASSERT("Implement for PAL");
12 }
13
14 DWORD getcpuid(DWORD arg, unsigned char result[16])
15 {
16 DWORD eax;
17 __asm(" xor %%ecx, %%ecx\n" \
18 " cpuid\n" \
19 " mov %%eax, 0(%[result])\n" \
20 " mov %%ebx, 4(%[result])\n" \
21 " mov %%ecx, 8(%[result])\n" \
22 " mov %%edx, 12(%[result])\n" \
23 : "=a"(eax) /*output in eax*/\
24 : "a"(arg), [result]"r"(result) /*inputs - arg in eax, result in any register*/\
25 : "rbx", "ecx", "edx", "memory" /* registers that are clobbered, *result is clobbered */
26 );
27 return eax;
28 }
29
30 DWORD getextcpuid(DWORD arg1, DWORD arg2, unsigned char result[16])
31 {
32 DWORD eax;
33 __asm(" cpuid\n" \
34 " mov %%eax, 0(%[result])\n" \
35 " mov %%ebx, 4(%[result])\n" \
36 " mov %%ecx, 8(%[result])\n" \
37 " mov %%edx, 12(%[result])\n" \
38 : "=a"(eax) /*output in eax*/\
39 : "c"(arg1), "a"(arg2), [result]"r"(result) /*inputs - arg1 in ecx, arg2 in eax, result in any register*/\
40 : "rbx", "edx", "memory" /* registers that are clobbered, *result is clobbered */
41 );
42 return eax;
43 }
44
45 DWORD xmmYmmStateSupport()
46 {
47 DWORD eax;
48 __asm(" xgetbv\n" \
49 : "=a"(eax) /*output in eax*/\
50 : "c"(0) /*inputs - 0 in ecx*/\
51 : "edx" /* registers that are clobbered*/
52 );
53 // check OS has enabled both XMM and YMM state support
54 return ((eax & 0x06) == 0x06) ? 1 : 0;
55 }
56
57 void STDMETHODCALLTYPE JIT_ProfilerEnterLeaveTailcallStub(UINT_PTR ProfilerHandle)
58 {
59 }
60};
61