aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/CryptonightR_JIT.c
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-03-05 12:40:06 +0200
committerRiccardo Spagni <ric@spagni.net>2019-03-05 12:40:06 +0200
commit39d7d3113bfe3655e721fa08b132d3b7fbcfb9b3 (patch)
tree01313a7ac6efed723a88e4063478539323fd556b /src/crypto/CryptonightR_JIT.c
parentMerge pull request #5101 (diff)
parentCryptonightR: define out i386/x86_64 specific code on other archs (diff)
downloadmonero-39d7d3113bfe3655e721fa08b132d3b7fbcfb9b3.tar.xz
Merge pull request #5231
108c625b CryptonightR: define out i386/x86_64 specific code on other archs (moneromooo-monero) 1b8757dd slow-hash: fix build on arm (moneromooo-monero) 5057eb11 cmake: ARCH_ID fixes for cross compilation (TheCharlatan)
Diffstat (limited to 'src/crypto/CryptonightR_JIT.c')
-rw-r--r--src/crypto/CryptonightR_JIT.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/crypto/CryptonightR_JIT.c b/src/crypto/CryptonightR_JIT.c
index 9add65296..68258a959 100644
--- a/src/crypto/CryptonightR_JIT.c
+++ b/src/crypto/CryptonightR_JIT.c
@@ -12,6 +12,7 @@
#include "CryptonightR_template.h"
static const uint8_t prologue[] = {
+#if defined __i386 || defined __x86_64__
0x4C, 0x8B, 0xD7, // mov r10, rdi
0x53, // push rbx
0x55, // push rbp
@@ -26,9 +27,11 @@ static const uint8_t prologue[] = {
0x41, 0x8B, 0x42, 0x18, // mov eax, DWORD PTR [r10+24]
0x41, 0x8B, 0x52, 0x1C, // mov edx, DWORD PTR [r10+28]
0x45, 0x8B, 0x4A, 0x20, // mov r9d, DWORD PTR [r10+32]
+#endif
};
static const uint8_t epilogue[] = {
+#if defined __i386 || defined __x86_64__
0x49, 0x8B, 0xE3, // mov rsp, r11
0x41, 0x89, 0x1A, // mov DWORD PTR [r10], ebx
0x41, 0x89, 0x72, 0x04, // mov DWORD PTR [r10+4], esi
@@ -38,6 +41,7 @@ static const uint8_t epilogue[] = {
0x5D, // pop rbp
0x5B, // pop rbx
0xC3, // ret
+#endif
};
#define APPEND_CODE(src, size) \
@@ -50,6 +54,7 @@ static const uint8_t epilogue[] = {
int v4_generate_JIT_code(const struct V4_Instruction* code, v4_random_math_JIT_func buf, const size_t buf_size)
{
+#if defined __i386 || defined __x86_64__
uint8_t* JIT_code = (uint8_t*) buf;
const uint8_t* JIT_code_end = JIT_code + buf_size;
@@ -99,4 +104,7 @@ int v4_generate_JIT_code(const struct V4_Instruction* code, v4_random_math_JIT_f
__builtin___clear_cache((char*)buf, (char*)JIT_code);
return 0;
+#else
+ return 1;
+#endif
}