From: Kruti Pendharkar Date: Tue, 22 Jul 2025 07:06:54 +0000 (-0700) Subject: Change to common header files not applicable to open-vm-tools. X-Git-Tag: stable-13.1.0~114 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=748039a895d2cf97ded81f5841d8bc1ff7eb0e57;p=thirdparty%2Fopen-vm-tools.git Change to common header files not applicable to open-vm-tools. --- diff --git a/open-vm-tools/lib/include/includeCheck.h b/open-vm-tools/lib/include/includeCheck.h index f7a1885c4..1a7884647 100644 --- a/open-vm-tools/lib/include/includeCheck.h +++ b/open-vm-tools/lib/include/includeCheck.h @@ -1,5 +1,6 @@ /********************************************************* - * Copyright (c) 1998-2019, 2021-2022 VMware, Inc. All rights reserved. + * Copyright (c) 1998-2025 Broadcom. All Rights Reserved. + * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -79,8 +80,10 @@ * that this is acceptable. */ -#if defined VMM && defined ULM -#error "VMM and ULM cannot be defined at the same time." +#if (defined VMM && defined ULM) || \ + (defined VMM && defined GLM) || \ + (defined GLM && defined ULM) +#error "Only one of { VMM, ULM, GLM } can be defined during build." #endif #if defined ULM && !defined USERLEVEL diff --git a/open-vm-tools/lib/include/vm_assert.h b/open-vm-tools/lib/include/vm_assert.h index dd89a094c..bd418aa28 100644 --- a/open-vm-tools/lib/include/vm_assert.h +++ b/open-vm-tools/lib/include/vm_assert.h @@ -106,7 +106,7 @@ extern "C" { * so it uses generic functions. */ -#if !defined VMM || \ +#if (!defined VMM && !defined GLM) || \ defined BINARY_CHECKER || defined COREQUERY || defined DECODER || \ defined DIS16 || defined FROBOS || defined TRAPAPI_APP || \ defined VMM_LINKER || defined VMSS2CORE @@ -284,13 +284,13 @@ void WarningThrottled(uint32 *count, const char *fmt, ...) PRINTF_DECL(2, 3); #define ASSERT_NOT_IMPLEMENTED(cond) \ ASSERT_IFNOT(cond, NOT_IMPLEMENTED()) -#if defined VMKPANIC || defined VMM +#if defined VMKPANIC || defined VMM || defined GLM # define NOT_IMPLEMENTED() _ASSERT_PANIC_NORETURN(AssertNotImplemented, "") #else # define NOT_IMPLEMENTED() _ASSERT_PANIC(AssertNotImplemented, "") #endif -#if defined VMM +#if defined VMM || defined GLM # define NOT_IMPLEMENTED_BUG(bug) \ _ASSERT_PANIC_BUG_NORETURN(bug, AssertNotImplemented, "") #else @@ -306,7 +306,7 @@ void WarningThrottled(uint32 *count, const char *fmt, ...) PRINTF_DECL(2, 3); * * On debug builds, NOT_REACHED is a Panic with a fixed string. */ -#if defined VMKPANIC || defined VMM +#if defined VMKPANIC || defined VMM || defined GLM # define NOT_REACHED() _ASSERT_PANIC_NORETURN(AssertNotReached, "") #else # define NOT_REACHED() _ASSERT_PANIC(AssertNotReached, "") @@ -406,7 +406,7 @@ void WarningThrottled(uint32 *count, const char *fmt, ...) PRINTF_DECL(2, 3); * compiler is known to support it. */ -# if defined VMKPANIC || defined VMM || defined ULM_ESX +# if defined VMKPANIC || defined VMM || defined GLM || defined ULM_ESX # undef NOT_REACHED # define NOT_REACHED() __builtin_unreachable() # elif defined ULM_WIN diff --git a/open-vm-tools/lib/include/vm_atomic.h b/open-vm-tools/lib/include/vm_atomic.h index 2586a1d04..7fcbcbe41 100644 --- a/open-vm-tools/lib/include/vm_atomic.h +++ b/open-vm-tools/lib/include/vm_atomic.h @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (c) 1998-2024 Broadcom. All Rights Reserved. + * Copyright (c) 1998-2025 Broadcom. All Rights Reserved. * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or modify it @@ -886,7 +886,8 @@ Atomic_Read32(Atomic_uint32 const *var) // IN { uint32 value; -#if defined VMM || defined VM_ARM_64 || defined VMKERNEL || defined VMKERNEL_MODULE +#if defined VMM || defined GLM || \ + defined VM_ARM_64 || defined VMKERNEL || defined VMKERNEL_MODULE ASSERT(((uintptr_t)var % 4) == 0); #endif @@ -1016,7 +1017,8 @@ static INLINE void Atomic_Write32(Atomic_uint32 *var, // OUT uint32 val) // IN { -#if defined VMM || defined VM_ARM_64 || defined VMKERNEL || defined VMKERNEL_MODULE +#if defined VMM || defined GLM || \ + defined VM_ARM_64 || defined VMKERNEL || defined VMKERNEL_MODULE ASSERT(((uintptr_t)var % 4) == 0); #endif @@ -2178,7 +2180,8 @@ Atomic_Read64(Atomic_uint64 const *var) // IN uint64 value; #endif -#if defined VMM || defined VM_ARM_64 || defined VMKERNEL || defined VMKERNEL_MODULE +#if defined VMM || defined GLM || \ + defined VM_ARM_64 || defined VMKERNEL || defined VMKERNEL_MODULE ASSERT((uintptr_t)var % 8 == 0); #endif @@ -2664,7 +2667,8 @@ static INLINE void Atomic_Write64(Atomic_uint64 *var, // OUT uint64 val) // IN { -#if defined VMM || defined VM_ARM_64 || defined VMKERNEL || defined VMKERNEL_MODULE +#if defined VMM || defined GLM || \ + defined VM_ARM_64 || defined VMKERNEL || defined VMKERNEL_MODULE ASSERT((uintptr_t)var % 8 == 0); #endif @@ -2978,8 +2982,8 @@ Atomic_Read16(Atomic_uint16 const *var) // IN { uint16 value; -#if defined VMM || defined VM_ARM_64 || defined VMKERNEL || \ - defined VMKERNEL_MODULE +#if defined VMM || defined GLM || \ + defined VM_ARM_64 || defined VMKERNEL || defined VMKERNEL_MODULE ASSERT((uintptr_t)var % 2 == 0); #endif @@ -3089,8 +3093,8 @@ static INLINE void Atomic_Write16(Atomic_uint16 *var, // OUT: uint16 val) // IN: { -#if defined VMM || defined VM_ARM_64 || defined VMKERNEL || \ - defined VMKERNEL_MODULE +#if defined VMM || defined GLM || \ + defined VM_ARM_64 || defined VMKERNEL || defined VMKERNEL_MODULE ASSERT((uintptr_t)var % 2 == 0); #endif diff --git a/open-vm-tools/lib/include/vm_basic_asm_x86.h b/open-vm-tools/lib/include/vm_basic_asm_x86.h index 50897381f..a79613d0b 100644 --- a/open-vm-tools/lib/include/vm_basic_asm_x86.h +++ b/open-vm-tools/lib/include/vm_basic_asm_x86.h @@ -1,5 +1,6 @@ /********************************************************* - * Copyright (C) 1998-2023 VMware, Inc. All rights reserved. + * Copyright (c) 1998-2025 Broadcom. All Rights Reserved. + * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -71,7 +72,8 @@ extern "C" { * constraints. * */ -#if (defined(VMM) || defined(VMKERNEL) || defined(FROBOS) || defined(ULM)) +#if defined(VMM) || defined(GLM) || \ + defined(VMKERNEL) || defined(FROBOS) || defined(ULM) static INLINE Bool xtest(void) { @@ -116,25 +118,25 @@ xtest(void) * fxrstor, on both AMD Opteron and Intel Core CPUs. */ #if defined(__GNUC__) -static INLINE void +static INLINE void FXSAVE_ES1(void *save) { __asm__ __volatile__ ("fxsave %0\n" : "=m" (*(uint8 *)save) : : "memory"); } -static INLINE void +static INLINE void FXRSTOR_ES1(const void *load) { __asm__ __volatile__ ("fxrstor %0\n" : : "m" (*(const uint8 *)load) : "memory"); } -static INLINE void +static INLINE void FXRSTOR_AMD_ES0(const void *load) { uint64 dummy = 0; - __asm__ __volatile__ + __asm__ __volatile__ ("fnstsw %%ax \n" // Grab x87 ES bit "bt $7,%%ax \n" // Test ES bit "jnc 1f \n" // Jump if ES=0 @@ -144,7 +146,7 @@ FXRSTOR_AMD_ES0(const void *load) "fildl %0 \n" // Dummy Load from "safe address" changes all // x87 exception pointers. "fxrstor %1 \n" - : + : : "m" (dummy), "m" (*(const uint8 *)load) : "ax", "memory"); } @@ -157,9 +159,10 @@ FXRSTOR_AMD_ES0(const void *load) * The pointer passed in must be 64-byte aligned. * See above comment for more information. */ -#if defined(__GNUC__) && (defined(VMM) || defined(VMKERNEL) || defined(FROBOS)) +#if defined(__GNUC__) && (defined(VMM) || defined(GLM) || \ + defined(VMKERNEL) || defined(FROBOS)) -static INLINE void +static INLINE void XSAVE_ES1(void *save, uint64 mask) { __asm__ __volatile__ ( @@ -169,7 +172,7 @@ XSAVE_ES1(void *save, uint64 mask) : "memory"); } -static INLINE void +static INLINE void XSAVEOPT_ES1(void *save, uint64 mask) { __asm__ __volatile__ ( @@ -179,7 +182,7 @@ XSAVEOPT_ES1(void *save, uint64 mask) : "memory"); } -static INLINE void +static INLINE void XRSTOR_ES1(const void *load, uint64 mask) { __asm__ __volatile__ ( @@ -190,12 +193,12 @@ XRSTOR_ES1(const void *load, uint64 mask) : "memory"); } -static INLINE void +static INLINE void XRSTOR_AMD_ES0(const void *load, uint64 mask) { uint64 dummy = 0; - __asm__ __volatile__ + __asm__ __volatile__ ("fnstsw %%ax \n" // Grab x87 ES bit "bt $7,%%ax \n" // Test ES bit "jnc 1f \n" // Jump if ES=0 @@ -335,7 +338,7 @@ Div643264(uint64 dividend, // IN * * Unsigned integer by fixed point multiplication, with rounding: * result = floor(multiplicand * multiplier * 2**(-shift) + 0.5) - * + * * Unsigned 64-bit integer multiplicand. * Unsigned 32-bit fixed point multiplier, represented as * (multiplier, shift), where shift < 64. @@ -354,7 +357,7 @@ Mul64x3264(uint64 multiplicand, uint32 multiplier, uint32 shift) uint64 result; uint32 tmp1, tmp2; // ASSERT(shift >= 0 && shift < 64); - + __asm__("mov %%eax, %2\n\t" // Save lo(multiplicand) "mov %%edx, %%eax\n\t" // Get hi(multiplicand) "mull %4\n\t" // p2 = hi(multiplicand) * multiplier @@ -440,7 +443,7 @@ Mul64x3264(uint64 multiplicand, uint32 multiplier, uint32 shift) * * Signed integer by fixed point multiplication, with rounding: * result = floor(multiplicand * multiplier * 2**(-shift) + 0.5) - * + * * Signed 64-bit integer multiplicand. * Unsigned 32-bit fixed point multiplier, represented as * (multiplier, shift), where shift < 64. @@ -506,7 +509,7 @@ static INLINE int64 Muls64x32s64(int64 multiplicand, uint32 multiplier, uint32 shift) { //ASSERT(shift >= 0 && shift < 64); - + __asm { mov eax, DWORD PTR [multiplicand+4] // Get hi(multiplicand) test eax, eax // Check sign of multiplicand diff --git a/open-vm-tools/lib/include/vm_basic_asm_x86_64.h b/open-vm-tools/lib/include/vm_basic_asm_x86_64.h index 5b90840fc..beb22b106 100644 --- a/open-vm-tools/lib/include/vm_basic_asm_x86_64.h +++ b/open-vm-tools/lib/include/vm_basic_asm_x86_64.h @@ -1,5 +1,6 @@ /********************************************************* - * Copyright (C) 1998-2023 VMware, Inc. All rights reserved. + * Copyright (c) 1998-2025 Broadcom. All Rights Reserved. + * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -119,7 +120,8 @@ GET_CURRENT_PC(void) * fxrstor, on both AMD Opteron and Intel Core CPUs. */ -#if defined(VMM) || defined(VMKERNEL) || defined(FROBOS) || defined(ULM) +#if defined(VMM) || defined(GLM) || defined(VMKERNEL) || \ + defined(FROBOS) || defined(ULM) static INLINE void FXSAVE_ES1(void *save) { @@ -345,7 +347,8 @@ XRSTORS(const void *load, uint64 mask) * constraints. * */ -#if (defined(VMM) || defined(VMKERNEL) || defined(FROBOS) || defined(ULM)) +#if (defined(VMM) || defined(GLM) || defined(VMKERNEL) || \ + defined(FROBOS) || defined(ULM)) static INLINE Bool xtest(void) { diff --git a/open-vm-tools/lib/include/vm_basic_defs.h b/open-vm-tools/lib/include/vm_basic_defs.h index f2bb725fb..ed4b5dd89 100644 --- a/open-vm-tools/lib/include/vm_basic_defs.h +++ b/open-vm-tools/lib/include/vm_basic_defs.h @@ -630,7 +630,7 @@ typedef int pid_t; #define VMK_HAS_VMM_ONLY(...) #endif -#if defined VMM || defined VMK_HAS_VMM +#if defined VMM || defined GLM || defined VMK_HAS_VMM /* Structure field only used to support the VMM (as opposed to the ULM). */ #define VMM_ONLY_FIELD(name) name #else @@ -888,13 +888,13 @@ typedef int pid_t; #define ULM_ONLY(x) #endif -#if defined(VMM) || defined(ULM) +#if defined(VMM) || defined(GLM) || defined(ULM) #define MONITOR_ONLY(x) x #else #define MONITOR_ONLY(x) #endif -#if defined(VMM) || defined(VMKERNEL) +#if defined(VMM) || defined(GLM) || defined(VMKERNEL) #define USER_ONLY(x) #else #define USER_ONLY(x) x diff --git a/open-vm-tools/lib/include/vm_basic_types.h b/open-vm-tools/lib/include/vm_basic_types.h index c133773bc..d8c44345b 100644 --- a/open-vm-tools/lib/include/vm_basic_types.h +++ b/open-vm-tools/lib/include/vm_basic_types.h @@ -245,7 +245,7 @@ * - VMM does not have POSIX headers * - Windows does not define ssize_t */ -#if defined(VMKERNEL) || defined(VMM) +#if defined(VMKERNEL) || defined(VMM) || defined(GLM) /* Guard against FreeBSD collison. */ # if !defined(_SIZE_T_DEFINED) && !defined(_SIZE_T) # define _SIZE_T_DEFINED @@ -556,9 +556,9 @@ typedef int128 Reg128; typedef uint128 UReg128; #endif -#if (defined(VMM) || defined(COREQUERY) || defined(EXTDECODER) || \ - defined (VMKERNEL) || defined (VMKBOOT) || defined (ULM)) && \ - !defined (FROBOS) || defined (VSAN_USERLEVEL) +#if (defined(VMM) || defined(GLM) || defined(COREQUERY) || \ + defined(EXTDECODER) || defined(VMKERNEL) || defined(VMKBOOT) || \ + defined(ULM)) && !defined(FROBOS) || defined(VSAN_USERLEVEL) typedef Reg64 Reg; typedef UReg64 UReg; #endif @@ -679,7 +679,8 @@ typedef void * UserVA; * Use them like this: Log("%#" FMTLA "x\n", laddr) */ -#if defined(VMM) || defined(FROBOS64) || vm_x86_64 || vm_arm_64 || defined __APPLE__ +#if defined(VMM) || defined(GLM) || defined(FROBOS64) || \ + vm_x86_64 || vm_arm_64 || defined __APPLE__ # define FMTLA "l" # define FMTVA "l" # define FMTVPN "l" @@ -825,7 +826,7 @@ typedef void * UserVA; * and loop optimization just as an arithmetic operator would be. */ -#if defined(__GNUC__) && (defined(VMM) || defined (VMKERNEL)) +#if defined(__GNUC__) && (defined(VMM) || defined(GLM) || defined(VMKERNEL)) #define SIDE_EFFECT_FREE __attribute__((__pure__)) #else #define SIDE_EFFECT_FREE @@ -838,7 +839,7 @@ typedef void * UserVA; * memory. */ -#if defined(__GNUC__) && (defined(VMM) || defined (VMKERNEL)) +#if defined(__GNUC__) && (defined(VMM) || defined(GLM) || defined(VMKERNEL)) #define CONST_FUNCTION __attribute__((__const__)) #else #define CONST_FUNCTION