These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / staging / unisys / visorbus / iovmcall_gnuc.h
1 /* Copyright (C) 2010 - 2015 UNISYS CORPORATION
2  * All rights reserved.
3  *
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.
7  *
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
12  * details.
13  */
14
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)
19 {
20         unsigned long result = 0;
21         unsigned int cpuid_eax, cpuid_ebx, cpuid_ecx, cpuid_edx;
22
23         cpuid(0x00000001, &cpuid_eax, &cpuid_ebx, &cpuid_ecx, &cpuid_edx);
24         if (!(cpuid_ecx & 0x80000000))
25                 return -1;
26
27         __asm__ __volatile__(".byte 0x00f, 0x001, 0x0c1" : "=a"(result) :
28                 "a"(tuple), "b"(reg_ebx), "c"(reg_ecx));
29         return result;
30 }
31
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)
37 {
38         unsigned long result = 0;
39         unsigned int cpuid_eax, cpuid_ebx, cpuid_ecx, cpuid_edx;
40
41         cpuid(0x00000001, &cpuid_eax, &cpuid_ebx, &cpuid_ecx, &cpuid_edx);
42         if (!(cpuid_ecx & 0x80000000))
43                 return -1;
44
45         __asm__ __volatile__(".byte 0x00f, 0x001, 0x0c1" : "=a"(result) :
46                 "a"(tuple), "b"(reg_ebx), "c"(reg_ecx), "d"(reg_edx));
47         return result;
48 }