]> 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, 24 Jun 2025 16:26:22 +0000 (09:26 -0700)
committerKruti Pendharkar <kp025370@broadcom.com>
Tue, 24 Jun 2025 16:26:22 +0000 (09:26 -0700)
open-vm-tools/lib/include/vm_basic_asm.h
open-vm-tools/lib/include/vm_basic_asm_arm64.h

index 24d7006b2d8561221262f53d4e61ee2572a1d760..c455117056fbf8028c6ec5ae7763dd0dfafbf6ca 100644 (file)
@@ -805,7 +805,7 @@ RDTSC(void)
 #ifdef VM_ARM_32
 #define DEBUGBREAK() __asm__("bkpt")
 #elif defined(VM_ARM_64)
-#define DEBUGBREAK() __asm__("brk #0")
+#define DEBUGBREAK() BRK(0)
 #elif defined(_MSC_VER)
 #define DEBUGBREAK() __debugbreak()
 #else
index e08bfc2cde8c6361116d273c687b89d591a35a83..1a28d6d896f77b72141de3cf8db948740aadf54c 100644 (file)
@@ -376,6 +376,38 @@ GET_CURRENT_PC(void)
 #endif // ifdef __GNUC__
 
 
+/*
+ *----------------------------------------------------------------------
+ *
+ * BRK --
+ *
+ *      BRK instruction.
+ *
+ *      Use a compiler memory barrier to prevent the compiler from re-ordering
+ *      memory accesses across the BRK instruction: this is less surprising /
+ *      more convenient when the breakpoint hits and one attaches a debugger to
+ *      inspect and/or modify state.
+ *
+ * Results:
+ *      None.
+ *
+ * Side effects:
+ *      Raises an exception, so side-effects depend on the exception handler.
+ *
+ *----------------------------------------------------------------------
+ */
+
+#if defined _MSC_VER
+#define BRK(imm16) do {                                                       \
+   _ReadWriteBarrier();                                                       \
+   __break(imm16);                                                            \
+   _ReadWriteBarrier();                                                       \
+} while (0)
+#elif defined __GNUC__
+#define BRK(imm16) asm volatile ("brk %0" :: "i" (imm16) : "memory")
+#endif
+
+
 /*
  *----------------------------------------------------------------------
  *