]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Change to common header files not applicable to open-vm-tools.
authorKruti Pendharkar <kp025370@broadcom.com>
Tue, 22 Jul 2025 07:06:54 +0000 (00:06 -0700)
committerKruti Pendharkar <kp025370@broadcom.com>
Tue, 22 Jul 2025 07:06:54 +0000 (00:06 -0700)
open-vm-tools/lib/include/includeCheck.h
open-vm-tools/lib/include/vm_assert.h
open-vm-tools/lib/include/vm_atomic.h
open-vm-tools/lib/include/vm_basic_asm_x86.h
open-vm-tools/lib/include/vm_basic_asm_x86_64.h
open-vm-tools/lib/include/vm_basic_defs.h
open-vm-tools/lib/include/vm_basic_types.h

index f7a1885c49b800aa38e774e93ae34f877a25c519..1a78846477aa4ba68bad2a0cb02faa2391f80bcc 100644 (file)
@@ -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
  * 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
index dd89a094c55ba029322f2d98a004fe8838e5bd1f..bd418aa28d6a9a8ccd43af7b411436e94c7bd0ca 100644 (file)
@@ -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
index 2586a1d04d7f9495770695ede379077c20a43bad..7fcbcbe41329d99d83e65ddd260433b9813ffa1d 100644 (file)
@@ -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
 
index 50897381fa6574c000c8272b392bf1a5215ad309..a79613d0b87f9f83c58f122e93854f2d4bb0b12e 100644 (file)
@@ -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
index 5b90840fce4b0b46345b5468f0bcb3aa50aa11fb..beb22b1066500c2b5e5f055434ae737f21e5f65f 100644 (file)
@@ -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)
 {
index f2bb725fb77b4e99e1e289238a2e5a63fe47f46b..ed4b5dd89f309db7d20f9f7aa8c87fbabaa96962 100644 (file)
@@ -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
index c133773bc89807e9c911dcfa92df53a155ecf2cb..d8c44345baaa105927c009599408cbf7cbd9c6ab 100644 (file)
  * - VMM does not have POSIX headers
  * - Windows <sys/types.h> does not define ssize_t
  */
-#if defined(VMKERNEL) || defined(VMM)
+#if defined(VMKERNEL) || defined(VMM) || defined(GLM)
    /* Guard against FreeBSD <sys/types.h> 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