2015-07-16 10:40:48 -06:00
|
|
|
/* Copyright (C) 2010 - 2015 UNISYS CORPORATION
|
2014-03-04 06:58:07 -07:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
2015-07-16 10:40:48 -06:00
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
2014-03-04 06:58:07 -07:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
|
|
|
|
* NON INFRINGEMENT. See the GNU General Public License for more
|
|
|
|
* details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Linux GCC Version (32-bit and 64-bit) */
|
|
|
|
static inline unsigned long
|
|
|
|
__unisys_vmcall_gnuc(unsigned long tuple, unsigned long reg_ebx,
|
|
|
|
unsigned long reg_ecx)
|
|
|
|
{
|
|
|
|
unsigned long result = 0;
|
|
|
|
unsigned int cpuid_eax, cpuid_ebx, cpuid_ecx, cpuid_edx;
|
2014-08-05 12:57:52 -06:00
|
|
|
|
2014-03-04 06:58:07 -07:00
|
|
|
cpuid(0x00000001, &cpuid_eax, &cpuid_ebx, &cpuid_ecx, &cpuid_edx);
|
2014-08-05 12:57:53 -06:00
|
|
|
if (!(cpuid_ecx & 0x80000000))
|
2016-05-13 21:17:21 -06:00
|
|
|
return -EPERM;
|
2014-08-05 12:57:53 -06:00
|
|
|
|
|
|
|
__asm__ __volatile__(".byte 0x00f, 0x001, 0x0c1" : "=a"(result) :
|
|
|
|
"a"(tuple), "b"(reg_ebx), "c"(reg_ecx));
|
2014-03-04 06:58:07 -07:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned long
|
|
|
|
__unisys_extended_vmcall_gnuc(unsigned long long tuple,
|
|
|
|
unsigned long long reg_ebx,
|
|
|
|
unsigned long long reg_ecx,
|
|
|
|
unsigned long long reg_edx)
|
|
|
|
{
|
|
|
|
unsigned long result = 0;
|
|
|
|
unsigned int cpuid_eax, cpuid_ebx, cpuid_ecx, cpuid_edx;
|
2014-08-05 12:57:52 -06:00
|
|
|
|
2014-03-04 06:58:07 -07:00
|
|
|
cpuid(0x00000001, &cpuid_eax, &cpuid_ebx, &cpuid_ecx, &cpuid_edx);
|
2014-08-05 12:57:53 -06:00
|
|
|
if (!(cpuid_ecx & 0x80000000))
|
2016-05-13 21:17:21 -06:00
|
|
|
return -EPERM;
|
2014-08-05 12:57:53 -06:00
|
|
|
|
|
|
|
__asm__ __volatile__(".byte 0x00f, 0x001, 0x0c1" : "=a"(result) :
|
|
|
|
"a"(tuple), "b"(reg_ebx), "c"(reg_ecx), "d"(reg_edx));
|
2014-03-04 06:58:07 -07:00
|
|
|
return result;
|
2014-08-05 12:57:53 -06:00
|
|
|
}
|