add_definitions(
+ -DDBI_COMPILE
-DFEATURE_METADATA_CUSTOM_DATA_SOURCE
-DFEATURE_METADATA_DEBUGGEE_DATA_SOURCE
-DFEATURE_NO_HOST
#ifndef PRIMITIVES_H_
#define PRIMITIVES_H_
+#if !defined(DBI_COMPILE) && !defined(DACCESS_COMPILE)
#include "executableallocator.h"
+#endif
#ifndef CORDB_ADDRESS_TYPE
typedef const BYTE CORDB_ADDRESS_TYPE;
{
LIMITED_METHOD_CONTRACT;
- ExecutableWriterHolder<void> breakpointWriterHolder((LPVOID)address, CORDbg_BREAK_INSTRUCTION_SIZE);
+#if !defined(DBI_COMPILE) && !defined(DACCESS_COMPILE)
+ ExecutableWriterHolder<CORDB_ADDRESS_TYPE> breakpointWriterHolder(address, CORDbg_BREAK_INSTRUCTION_SIZE);
+ UNALIGNED CORDB_ADDRESS_TYPE* addressRW = breakpointWriterHolder.GetRW();
+#else // !DBI_COMPILE && !DACCESS_COMPILE
+ UNALIGNED CORDB_ADDRESS_TYPE* addressRW = address;
+#endif // !DBI_COMPILE && !DACCESS_COMPILE
- *((unsigned char*)breakpointWriterHolder.GetRW()) = 0xCC; // int 3 (single byte patch)
+ *((unsigned char*)addressRW) = 0xCC; // int 3 (single byte patch)
FlushInstructionCache(GetCurrentProcess(), address, 1);
}
// In a DAC build, this function assumes the input is an host address.
LIMITED_METHOD_DAC_CONTRACT;
- ExecutableWriterHolder<void> instructionWriterHolder((LPVOID)address, sizeof(unsigned char));
+#if !defined(DBI_COMPILE) && !defined(DACCESS_COMPILE)
+ ExecutableWriterHolder<CORDB_ADDRESS_TYPE> instructionWriterHolder(address, sizeof(unsigned char));
+ UNALIGNED CORDB_ADDRESS_TYPE* addressRW = instructionWriterHolder.GetRW();
+#else // !DBI_COMPILE && !DACCESS_COMPILE
+ UNALIGNED CORDB_ADDRESS_TYPE* addressRW = address;
+#endif // !DBI_COMPILE && !DACCESS_COMPILE
- *((unsigned char*)instructionWriterHolder.GetRW()) =
+ *((unsigned char*)addressRW) =
(unsigned char) instruction; // setting one byte is important
FlushInstructionCache(GetCurrentProcess(), address, 1);
#ifndef PRIMITIVES_H_
#define PRIMITIVES_H_
+#if !defined(DBI_COMPILE) && !defined(DACCESS_COMPILE)
#include "executableallocator.h"
+#endif
#ifndef THUMB_CODE
#define THUMB_CODE 1
// In a DAC build, this function assumes the input is an host address.
LIMITED_METHOD_DAC_CONTRACT;
- ExecutableWriterHolder<void> instructionWriterHolder((LPVOID)address, sizeof(PRD_TYPE));
+#if !defined(DBI_COMPILE) && !defined(DACCESS_COMPILE)
+ ExecutableWriterHolder<CORDB_ADDRESS_TYPE> instructionWriterHolder(address, sizeof(PRD_TYPE));
+ CORDB_ADDRESS_TYPE* addressRW = instructionWriterHolder.GetRW();
+#else // !DBI_COMPILE && !DACCESS_COMPILE
+ CORDB_ADDRESS_TYPE* addressRW = address;
+#endif // !DBI_COMPILE && !DACCESS_COMPILE
- CORDB_ADDRESS ptraddr = (CORDB_ADDRESS)instructionWriterHolder.GetRW();
+ CORDB_ADDRESS ptraddr = (CORDB_ADDRESS)addressRW;
_ASSERTE(ptraddr & THUMB_CODE);
ptraddr &= ~THUMB_CODE;
#ifndef PRIMITIVES_H_
#define PRIMITIVES_H_
+#if !defined(DBI_COMPILE) && !defined(DACCESS_COMPILE)
#include "executableallocator.h"
+#endif
typedef NEON128 FPRegister64;
typedef const BYTE CORDB_ADDRESS_TYPE;
// In a DAC build, this function assumes the input is an host address.
LIMITED_METHOD_DAC_CONTRACT;
+#if !defined(DBI_COMPILE) && !defined(DACCESS_COMPILE)
ExecutableWriterHolder<void> instructionWriterHolder((LPVOID)address, sizeof(PRD_TYPE));
ULONGLONG ptraddr = dac_cast<ULONGLONG>(instructionWriterHolder.GetRW());
+#else // !DBI_COMPILE && !DACCESS_COMPILE
+ ULONGLONG ptraddr = dac_cast<ULONGLONG>(address);
+#endif // !DBI_COMPILE && !DACCESS_COMPILE
*(PRD_TYPE *)ptraddr = instruction;
FlushInstructionCache(GetCurrentProcess(),
address,
#ifndef PRIMITIVES_H_
#define PRIMITIVES_H_
+#if !defined(DBI_COMPILE) && !defined(DACCESS_COMPILE)
#include "executableallocator.h"
+#endif
typedef const BYTE CORDB_ADDRESS_TYPE;
typedef DPTR(CORDB_ADDRESS_TYPE) PTR_CORDB_ADDRESS_TYPE;
{
LIMITED_METHOD_CONTRACT;
- ExecutableWriterHolder<void> breakpointWriterHolder((LPVOID)address, CORDbg_BREAK_INSTRUCTION_SIZE);
+#if !defined(DBI_COMPILE) && !defined(DACCESS_COMPILE)
+ ExecutableWriterHolder<CORDB_ADDRESS_TYPE> breakpointWriterHolder(address, CORDbg_BREAK_INSTRUCTION_SIZE);
+ UNALIGNED CORDB_ADDRESS_TYPE* addressRW = breakpointWriterHolder.GetRW();
+#else // !DBI_COMPILE && !DACCESS_COMPILE
+ UNALIGNED CORDB_ADDRESS_TYPE* addressRW = address;
+#endif // !DBI_COMPILE && !DACCESS_COMPILE
- *((unsigned char*)breakpointWriterHolder.GetRW()) = 0xCC; // int 3 (single byte patch)
+ *((unsigned char*)addressRW) = 0xCC; // int 3 (single byte patch)
FlushInstructionCache(GetCurrentProcess(), address, 1);
}
#PAL__open
#PAL__pread
#PAL__close
-#PAL_JitWriteProtect
#_wcsicmp
#_stricmp
if (m_addressRX != NULL)
{
// TODO: mapping / unmapping for targets using double memory mapping will be added with the double mapped allocator addition
-#if defined(HOST_OSX) && defined(HOST_ARM64)
+#if defined(HOST_OSX) && defined(HOST_ARM64) && !defined(DACCESS_COMPILE)
PAL_JitWriteProtect(false);
#endif
}
{
m_addressRX = addressRX;
m_addressRW = addressRX;
-#if defined(HOST_OSX) && defined(HOST_ARM64)
+#if defined(HOST_OSX) && defined(HOST_ARM64) && !defined(DACCESS_COMPILE)
PAL_JitWriteProtect(true);
#endif
}
IN SIZE_T dwSize,
IN DWORD dwFreeType);
-#if defined(HOST_OSX)
+
+#if defined(HOST_OSX) && defined(HOST_ARM64)
PALIMPORT
VOID
PALAPI
PAL_JitWriteProtect(bool writeEnable);
-#endif // defined(HOST_OSX)
+#endif // defined(HOST_OSX) && defined(HOST_ARM64)
+
PALIMPORT
BOOL
return bRetVal;
}
-#if defined(HOST_OSX)
+#if defined(HOST_OSX) && defined(HOST_ARM64)
PALAPI VOID PAL_JitWriteProtect(bool writeEnable)
{
-#if defined(HOST_ARM64)
thread_local int enabledCount = 0;
if (writeEnable)
{
}
_ASSERTE(enabledCount >= 0);
}
-#endif // HOST_ARM64
}
-#endif // HOST_OSX
+#endif // HOST_OSX && HOST_ARM64
#if HAVE_VM_ALLOCATE
//---------------------------------------------------------------------------------------