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