From: VMware, Inc <> Date: Wed, 20 Jan 2010 21:31:08 +0000 (-0800) Subject: Changes in shared code that don't affect open-vm-tools functionality. X-Git-Tag: 2010.01.19-226760~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e1ce0979b7e6722fadb6b4fc4cc9b9739e943036;p=thirdparty%2Fopen-vm-tools.git Changes in shared code that don't affect open-vm-tools functionality. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/lib/include/loglevel_user.h b/open-vm-tools/lib/include/loglevel_user.h index c5d93f1cf..d8c791e0d 100644 --- a/open-vm-tools/lib/include/loglevel_user.h +++ b/open-vm-tools/lib/include/loglevel_user.h @@ -229,6 +229,7 @@ LOGLEVEL_VAR(largepage), \ LOGLEVEL_VAR(guestAppMonitor), \ LOGLEVEL_VAR(syncWaitQ), \ + LOGLEVEL_VAR(sg), /* lib/sg */ \ LOGLEVEL_EXTENSION_DECLARE(LOGLEVEL_USER); diff --git a/open-vm-tools/lib/include/vm_basic_asm.h b/open-vm-tools/lib/include/vm_basic_asm.h index c8c026ea0..9e1984344 100644 --- a/open-vm-tools/lib/include/vm_basic_asm.h +++ b/open-vm-tools/lib/include/vm_basic_asm.h @@ -110,8 +110,9 @@ void __stosd(unsigned long*, unsigned long, size_t); * compilers (13.01.2035 for _BitScanForward). */ unsigned char _BitScanForward(unsigned long*, unsigned long); +unsigned char _BitScanReverse(unsigned long*, unsigned long); void _mm_pause(void); -#pragma intrinsic(_BitScanForward, _mm_pause) +#pragma intrinsic(_BitScanForward, _BitScanReverse, _mm_pause) #endif /* VM_X86_64 */ #ifdef __cplusplus @@ -247,7 +248,23 @@ ffs(uint32 bitVector) #endif return idx+1; } -#endif // _MSC_VER + +static INLINE int +fls(uint32 bitVector) +{ + int idx; + if (!bitVector) { + return 0; + } +#ifdef VM_X86_64 + _BitScanReverse((unsigned long*)&idx, (unsigned long)bitVector); +#else + __asm bsr eax, bitVector + __asm mov idx, eax +#endif + return idx+1; +} +#endif #ifdef __GNUC__ #if defined(__i386__) || defined(__x86_64__)