]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Changes to common header files not applicable to open-vm-tools.
authorKaty Feng <fkaty@vmware.com>
Thu, 6 Apr 2023 18:27:41 +0000 (11:27 -0700)
committerKaty Feng <fkaty@vmware.com>
Thu, 6 Apr 2023 18:27:41 +0000 (11:27 -0700)
open-vm-tools/lib/include/guest_os.h
open-vm-tools/lib/include/vm_basic_asm.h
open-vm-tools/lib/include/vm_basic_asm_arm64.h
open-vm-tools/lib/include/vm_basic_types.h

index 5825cfa856c5a027c0e4b545a2f4dd0e3b0802db..979f8162407a98b2c9b88588c9f9f1e7e1e51fbf 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 1998-2021 VMware, Inc. All rights reserved.
+ * Copyright (C) 1998-2021, 2023 VMware, Inc. All rights reserved.
  *
  * 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
@@ -551,6 +551,9 @@ Bool Gos_InSetArray(uint32 gos, const uint32 *set);
  * Window on Arm support starts with Windows 10.
  */
 
+#define STR_OS_ARM_WIN       "arm-windows"
+
+
 /*
  * Windows 10
  *
index 639e08a4025333d0cc71d9254ce9c66b0b3c501e..cf2e677af35a06298ac35f7a075d8c8fe2896e6d 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (c) 2003-2022 VMware, Inc. All rights reserved.
+ * Copyright (c) 2003-2023 VMware, Inc. All rights reserved.
  *
  * 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
 #include "mul64.h"
 #endif
 
+#if defined _M_ARM64EC
+#include "vm_assert.h"
+#define MUL64_NO_ASM 1
+#include "mul64.h"
+#endif
+
 #if defined __cplusplus
 extern "C" {
 #endif
index f9711f8f45deb3f9af8d691722c850c3e5aa0833..2cd7c5dce49d0b6bf2dbbe26544b560e753b19c5 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2013-2022 VMware, Inc. All rights reserved.
+ * Copyright (C) 2013-2023 VMware, Inc. All rights reserved.
  *
  * 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
@@ -659,131 +659,6 @@ SetSPELx(VA va)
 }
 
 
-#ifndef MUL64_NO_ASM
-/*
- *-----------------------------------------------------------------------------
- *
- * Mul64x6464 --
- *
- *    Unsigned integer by fixed point multiplication, with rounding:
- *       result = floor(multiplicand * multiplier * 2**(-shift) + 0.5)
- *
- *       Unsigned 64-bit integer multiplicand.
- *       Unsigned 64-bit fixed point multiplier, represented as
- *         (multiplier, shift), where shift < 64.
- *
- * Result:
- *       Unsigned 64-bit integer product.
- *
- *-----------------------------------------------------------------------------
- */
-
-static INLINE uint64
-Mul64x6464(uint64 multiplicand,
-           uint64 multiplier,
-           uint32 shift)
-{
-   if (shift == 0) {
-      return multiplicand * multiplier;
-   } else {
-      uint64 lo, hi;
-
-      asm("mul   %0, %2, %3" "\n\t"
-          "umulh %1, %2, %3"
-          : "=&r" (lo), "=r" (hi)
-          : "r" (multiplicand), "r" (multiplier));
-      return (hi << (64 - shift) | lo >> shift) + (lo >> (shift - 1) & 1);
-   }
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * Muls64x64s64 --
- *
- *    Signed integer by fixed point multiplication, with rounding:
- *       result = floor(multiplicand * multiplier * 2**(-shift) + 0.5)
- *
- *       Signed 64-bit integer multiplicand.
- *       Unsigned 64-bit fixed point multiplier, represented as
- *         (multiplier, shift), where shift < 64.
- *
- * Result:
- *       Signed 64-bit integer product.
- *
- *-----------------------------------------------------------------------------
- */
-
-static INLINE int64
-Muls64x64s64(int64 multiplicand,
-             int64 multiplier,
-             uint32 shift)
-{
-   if (shift == 0) {
-      return multiplicand * multiplier;
-   } else {
-      uint64 lo, hi;
-
-      asm("mul   %0, %2, %3" "\n\t"
-          "smulh %1, %2, %3"
-          : "=&r" (lo), "=r" (hi)
-          : "r" (multiplicand), "r" (multiplier));
-      return (hi << (64 - shift) | lo >> shift) + (lo >> (shift - 1) & 1);
-   }
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * Mul64x3264 --
- *
- *    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.
- *
- * Result:
- *       Unsigned 64-bit integer product.
- *
- *-----------------------------------------------------------------------------
- */
-
-static INLINE uint64
-Mul64x3264(uint64 multiplicand, uint32 multiplier, uint32 shift)
-{
-   return Mul64x6464(multiplicand, multiplier, shift);
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * Muls64x32s64 --
- *
- *    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.
- *
- * Result:
- *       Signed 64-bit integer product.
- *
- *-----------------------------------------------------------------------------
- */
-
-static INLINE int64
-Muls64x32s64(int64 multiplicand, uint32 multiplier, uint32 shift)
-{
-   return Muls64x64s64(multiplicand, multiplier, shift);
-}
-#endif
-
 /*
  *-----------------------------------------------------------------------------
  *
@@ -1000,6 +875,139 @@ DCacheClean(VA va, uint64 len)
 
 #endif // ifndef _MSC_VER
 
+#if defined _MSC_VER
+/* Until we implement Mul64x6464() with Windows intrinsics... */
+#define MUL64_NO_ASM 1
+#endif
+
+#ifdef MUL64_NO_ASM
+#include "mul64.h"
+#else
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * Mul64x6464 --
+ *
+ *    Unsigned integer by fixed point multiplication, with rounding:
+ *       result = floor(multiplicand * multiplier * 2**(-shift) + 0.5)
+ *
+ *       Unsigned 64-bit integer multiplicand.
+ *       Unsigned 64-bit fixed point multiplier, represented as
+ *         (multiplier, shift), where shift < 64.
+ *
+ * Result:
+ *       Unsigned 64-bit integer product.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+static INLINE uint64
+Mul64x6464(uint64 multiplicand,
+           uint64 multiplier,
+           uint32 shift)
+{
+   if (shift == 0) {
+      return multiplicand * multiplier;
+   } else {
+      uint64 lo, hi;
+
+      asm("mul   %0, %2, %3" "\n\t"
+          "umulh %1, %2, %3"
+          : "=&r" (lo), "=r" (hi)
+          : "r" (multiplicand), "r" (multiplier));
+      return (hi << (64 - shift) | lo >> shift) + (lo >> (shift - 1) & 1);
+   }
+}
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * Muls64x64s64 --
+ *
+ *    Signed integer by fixed point multiplication, with rounding:
+ *       result = floor(multiplicand * multiplier * 2**(-shift) + 0.5)
+ *
+ *       Signed 64-bit integer multiplicand.
+ *       Unsigned 64-bit fixed point multiplier, represented as
+ *         (multiplier, shift), where shift < 64.
+ *
+ * Result:
+ *       Signed 64-bit integer product.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+static INLINE int64
+Muls64x64s64(int64 multiplicand,
+             int64 multiplier,
+             uint32 shift)
+{
+   if (shift == 0) {
+      return multiplicand * multiplier;
+   } else {
+      uint64 lo, hi;
+
+      asm("mul   %0, %2, %3" "\n\t"
+          "smulh %1, %2, %3"
+          : "=&r" (lo), "=r" (hi)
+          : "r" (multiplicand), "r" (multiplier));
+      return (hi << (64 - shift) | lo >> shift) + (lo >> (shift - 1) & 1);
+   }
+}
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * Mul64x3264 --
+ *
+ *    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.
+ *
+ * Result:
+ *       Unsigned 64-bit integer product.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+static INLINE uint64
+Mul64x3264(uint64 multiplicand, uint32 multiplier, uint32 shift)
+{
+   return Mul64x6464(multiplicand, multiplier, shift);
+}
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * Muls64x32s64 --
+ *
+ *    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.
+ *
+ * Result:
+ *       Signed 64-bit integer product.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+static INLINE int64
+Muls64x32s64(int64 multiplicand, uint32 multiplier, uint32 shift)
+{
+   return Muls64x64s64(multiplicand, multiplier, shift);
+}
+#endif
+
+
 #if defined __cplusplus
 } // extern "C"
 #endif
index 5cc3f700e4e63bff792414864965b0b0807958c9..1d952da86bf498e5b5f837869c1b3ae27b633150 100644 (file)
 /*
  * Standardize MSVC arch macros to GCC arch macros.
  */
-#if defined _MSC_VER && defined _M_X64
+#if defined _MSC_VER && defined _M_X64 && !defined _M_ARM64EC
 #  define __x86_64__ 1
 #elif defined _MSC_VER && defined _M_IX86
 #  define __i386__ 1
-#elif defined _MSC_VER && defined _M_ARM64
+#elif defined _MSC_VER && (defined _M_ARM64 || defined _M_ARM64EC)
 #  define __aarch64__ 1
 #elif defined _MSC_VER && defined _M_ARM
 #  define __arm__ 1