linux/drivers/staging/unisys/common-spar/include/iovmcall_gnuc.h
<<
>>
Prefs
   1/* Copyright (C) 2010 - 2013 UNISYS CORPORATION
   2 * All rights reserved.
   3 *
   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.
   8 *
   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
  13 * details.
  14 */
  15
  16/* Linux GCC Version (32-bit and 64-bit) */
  17static inline unsigned long
  18__unisys_vmcall_gnuc(unsigned long tuple, unsigned long reg_ebx,
  19                     unsigned long reg_ecx)
  20{
  21        unsigned long result = 0;
  22
  23        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) {
  26              __asm__ __volatile__(".byte 0x00f, 0x001, 0x0c1" : "=a"(result) :
  27                                   "a"(tuple), "b"(reg_ebx), "c"(reg_ecx)
  28                                      );
  29        } else {
  30                result = -1;
  31        }
  32        return result;
  33}
  34
  35static inline unsigned long
  36__unisys_extended_vmcall_gnuc(unsigned long long tuple,
  37                              unsigned long long reg_ebx,
  38                              unsigned long long reg_ecx,
  39                              unsigned long long reg_edx)
  40{
  41        unsigned long result = 0;
  42
  43        unsigned int cpuid_eax, cpuid_ebx, cpuid_ecx, cpuid_edx;
  44        cpuid(0x00000001, &cpuid_eax, &cpuid_ebx, &cpuid_ecx, &cpuid_edx);
  45        if (cpuid_ecx & 0x80000000) {
  46              __asm__ __volatile__(".byte 0x00f, 0x001, 0x0c1" : "=a"(result) :
  47                                   "a"(tuple), "b"(reg_ebx), "c"(reg_ecx),
  48                                   "d"(reg_edx));
  49        } else {
  50                result = -1;
  51        }
  52        return result;
  53        }
  54