1 /* Copyright (C) 2010 - 2015 UNISYS CORPORATION
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
11 * NON INFRINGEMENT. See the GNU General Public License for more
15 /* Linux GCC Version (32-bit and 64-bit) */
16 static inline unsigned long
17 __unisys_vmcall_gnuc(unsigned long tuple, unsigned long reg_ebx,
18 unsigned long reg_ecx)
20 unsigned long result = 0;
21 unsigned int cpuid_eax, cpuid_ebx, cpuid_ecx, cpuid_edx;
23 cpuid(0x00000001, &cpuid_eax, &cpuid_ebx, &cpuid_ecx, &cpuid_edx);
24 if (!(cpuid_ecx & 0x80000000))
27 __asm__ __volatile__(".byte 0x00f, 0x001, 0x0c1" : "=a"(result) :
28 "a"(tuple), "b"(reg_ebx), "c"(reg_ecx));
32 static inline unsigned long
33 __unisys_extended_vmcall_gnuc(unsigned long long tuple,
34 unsigned long long reg_ebx,
35 unsigned long long reg_ecx,
36 unsigned long long reg_edx)
38 unsigned long result = 0;
39 unsigned int cpuid_eax, cpuid_ebx, cpuid_ecx, cpuid_edx;
41 cpuid(0x00000001, &cpuid_eax, &cpuid_ebx, &cpuid_ecx, &cpuid_edx);
42 if (!(cpuid_ecx & 0x80000000))
45 __asm__ __volatile__(".byte 0x00f, 0x001, 0x0c1" : "=a"(result) :
46 "a"(tuple), "b"(reg_ebx), "c"(reg_ecx), "d"(reg_edx));