X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fi386-io-windows.h;h=8089d19b3a28922bfe93d674b4a0a801dc3966cb;hb=2be154f7350826f3e08cc7425e761946ed039fab;hp=ac2a55dfb7ba337f41cf712de86c3dcfc69a167e;hpb=d0b3d60f84fff7ab9ce99691fcf0db65b416e9ae;p=pciutils.git diff --git a/lib/i386-io-windows.h b/lib/i386-io-windows.h index ac2a55d..8089d19 100644 --- a/lib/i386-io-windows.h +++ b/lib/i386-io-windows.h @@ -5,7 +5,9 @@ * Copyright (c) 2006 Martin Mares * Copyright (c) 2021 Pali Rohár * - * Can be freely distributed and used under the terms of the GNU GPL. + * Can be freely distributed and used under the terms of the GNU GPL v2+ + * + * SPDX-License-Identifier: GPL-2.0-or-later */ #include @@ -107,16 +109,13 @@ unsigned long _inpd(unsigned short port); * function conflicts with some MSVC intrinsic. * MSVC supports inline assembly via __asm keyword in 32-bit mode only. * GCC version 4.9.0 and higher provides __builtin_ia32_readeflags_uXX() - * builtin for XX-mode. + * builtin for XX-mode. This builtin is also available as __readeflags() + * function indirectly via header file. */ #if defined(_MSC_VER) && (_MSC_VER >= 1500 || (_MSC_VER >= 1400 && defined(__BUILDMACHINE__))) #pragma intrinsic(__readeflags) #elif defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 9) || (__GNUC__ > 4)) -#ifdef __x86_64__ -#define __readeflags() __builtin_ia32_readeflags_u64() -#else -#define __readeflags() __builtin_ia32_readeflags_u32() -#endif +#include #elif defined(_MSC_VER) && defined(_M_IX86) static inline unsigned int __readeflags(void) @@ -1144,7 +1143,7 @@ SetProcessUserModeIOPL(VOID) */ if (!LookupPrivilegeValue(NULL, SE_TCB_NAME, &luid_tcb_privilege)) - goto err_not_implemented; + goto err_privilege_not_held; /* * If the current thread has already Tcb privilege enabled then there @@ -1346,7 +1345,8 @@ intel_setup_io(struct pci_access *a) /* On NT-based systems issue ProcessUserModeIOPL syscall which changes IOPL to 3. */ if (!SetProcessUserModeIOPL()) { - a->warning("NT ProcessUserModeIOPL call failed with error: %lu.", (unsigned long int)GetLastError()); + DWORD error = GetLastError(); + a->debug("NT ProcessUserModeIOPL call failed: %s.", error == ERROR_INVALID_FUNCTION ? "Not Implemented" : error == ERROR_PRIVILEGE_NOT_HELD ? "Access Denied" : "Operation Failed"); return 0; }