From: Kruti Pendharkar Date: Tue, 24 Jun 2025 16:26:22 +0000 (-0700) Subject: Change to common header files not applicable to open-vm-tools. X-Git-Tag: stable-13.1.0~160 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7baaae353cc8d7960da3660486c4de237729f430;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/vm_basic_asm.h b/open-vm-tools/lib/include/vm_basic_asm.h index 24d7006b2..c45511705 100644 --- a/open-vm-tools/lib/include/vm_basic_asm.h +++ b/open-vm-tools/lib/include/vm_basic_asm.h @@ -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 diff --git a/open-vm-tools/lib/include/vm_basic_asm_arm64.h b/open-vm-tools/lib/include/vm_basic_asm_arm64.h index e08bfc2cd..1a28d6d89 100644 --- a/open-vm-tools/lib/include/vm_basic_asm_arm64.h +++ b/open-vm-tools/lib/include/vm_basic_asm_arm64.h @@ -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 + + /* *---------------------------------------------------------------------- *