summaryrefslogtreecommitdiff
path: root/lib/xray/xray_interface_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xray/xray_interface_internal.h')
-rw-r--r--lib/xray/xray_interface_internal.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/xray/xray_interface_internal.h b/lib/xray/xray_interface_internal.h
index 6208c110e..3465b67d5 100644
--- a/lib/xray/xray_interface_internal.h
+++ b/lib/xray/xray_interface_internal.h
@@ -16,18 +16,30 @@
#define XRAY_INTERFACE_INTERNAL_H
#include "xray/xray_interface.h"
+#include "sanitizer_common/sanitizer_platform.h"
#include <cstddef>
#include <cstdint>
extern "C" {
struct XRaySledEntry {
+#if SANITIZER_WORDSIZE == 64
uint64_t Address;
uint64_t Function;
unsigned char Kind;
unsigned char AlwaysInstrument;
unsigned char Padding[14]; // Need 32 bytes
+#elif SANITIZER_WORDSIZE == 32
+ uint32_t Address;
+ uint32_t Function;
+ unsigned char Kind;
+ unsigned char AlwaysInstrument;
+ unsigned char Padding[6]; // Need 16 bytes
+#else
+ #error "Unsupported word size."
+#endif
};
+
}
namespace __xray {
@@ -37,6 +49,16 @@ struct XRaySledMap {
size_t Entries;
};
+bool patchFunctionEntry(const bool Enable, const uint32_t FuncId, const XRaySledEntry& Sled);
+bool patchFunctionExit(const bool Enable, const uint32_t FuncId, const XRaySledEntry& Sled);
+
} // namespace __xray
+extern "C" {
+// The following functions have to be defined in assembler, on a per-platform
+// basis. See xray_trampoline_*.S files for implementations.
+extern void __xray_FunctionEntry();
+extern void __xray_FunctionExit();
+}
+
#endif