mirror of
https://git.wownero.com/wownero/RandomWOW.git
synced 2024-12-23 00:08:52 +00:00
fix missing ___clear_cache when targetting iOS
This commit is contained in:
parent
27b099b6dd
commit
34c2646e63
@ -56,6 +56,17 @@ src/virtual_machine.cpp
|
|||||||
src/vm_compiled_light.cpp
|
src/vm_compiled_light.cpp
|
||||||
src/blake2/blake2b.c)
|
src/blake2/blake2b.c)
|
||||||
|
|
||||||
|
if (NOT WIN32)
|
||||||
|
check_symbol_exists("__builtin___clear_cache" "stdlib.h" HAVE_BUILTIN_CLEAR_CACHE)
|
||||||
|
if (HAVE_BUILTIN_CLEAR_CACHE)
|
||||||
|
add_definitions(-DHAVE_BUILTIN_CLEAR_CACHE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||||
|
add_definitions(-D_GNU_SOURCE -DHAVE_BUILTIN_CLEAR_CACHE)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT ARCH_ID)
|
if(NOT ARCH_ID)
|
||||||
# allow cross compiling
|
# allow cross compiling
|
||||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "")
|
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "")
|
||||||
|
@ -32,6 +32,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "program.hpp"
|
#include "program.hpp"
|
||||||
#include "reciprocal.h"
|
#include "reciprocal.h"
|
||||||
#include "virtual_memory.h"
|
#include "virtual_memory.h"
|
||||||
|
#if !defined(HAVE_BUILTIN_CLEAR_CACHE) && defined(__APPLE__)
|
||||||
|
#include <libkern/OSCacheControl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace ARMV8A {
|
namespace ARMV8A {
|
||||||
|
|
||||||
@ -98,8 +101,10 @@ JitCompilerA64::JitCompilerA64()
|
|||||||
memset(reg_changed_offset, 0, sizeof(reg_changed_offset));
|
memset(reg_changed_offset, 0, sizeof(reg_changed_offset));
|
||||||
memcpy(code, (void*) randomx_program_aarch64, CodeSize);
|
memcpy(code, (void*) randomx_program_aarch64, CodeSize);
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#if defined(HAVE_BUILTIN_CLEAR_CACHE) && !defined(__APPLE__)
|
||||||
__builtin___clear_cache(reinterpret_cast<char*>(code), reinterpret_cast<char*>(code + CodeSize));
|
__builtin___clear_cache(reinterpret_cast<char*>(code), reinterpret_cast<char*>(code + CodeSize));
|
||||||
|
#else
|
||||||
|
sys_icache_invalidate(code, CodeSize);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,8 +174,10 @@ void JitCompilerA64::generateProgram(Program& program, ProgramConfiguration& con
|
|||||||
codePos = ((uint8_t*)randomx_program_aarch64_update_spMix1) - ((uint8_t*)randomx_program_aarch64);
|
codePos = ((uint8_t*)randomx_program_aarch64_update_spMix1) - ((uint8_t*)randomx_program_aarch64);
|
||||||
emit32(ARMV8A::EOR | 10 | (IntRegMap[config.readReg0] << 5) | (IntRegMap[config.readReg1] << 16), code, codePos);
|
emit32(ARMV8A::EOR | 10 | (IntRegMap[config.readReg0] << 5) | (IntRegMap[config.readReg1] << 16), code, codePos);
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#if defined(HAVE_BUILTIN_CLEAR_CACHE) && !defined(__APPLE__)
|
||||||
__builtin___clear_cache(reinterpret_cast<char*>(code + MainLoopBegin), reinterpret_cast<char*>(code + codePos));
|
__builtin___clear_cache(reinterpret_cast<char*>(code), reinterpret_cast<char*>(code + CodeSize));
|
||||||
|
#else
|
||||||
|
sys_icache_invalidate(code, CodeSize);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,8 +233,10 @@ void JitCompilerA64::generateProgramLight(Program& program, ProgramConfiguration
|
|||||||
emit32(ARMV8A::ADD_IMM_LO | 2 | (2 << 5) | (imm_lo << 10), code, codePos);
|
emit32(ARMV8A::ADD_IMM_LO | 2 | (2 << 5) | (imm_lo << 10), code, codePos);
|
||||||
emit32(ARMV8A::ADD_IMM_HI | 2 | (2 << 5) | (imm_hi << 10), code, codePos);
|
emit32(ARMV8A::ADD_IMM_HI | 2 | (2 << 5) | (imm_hi << 10), code, codePos);
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#if defined(HAVE_BUILTIN_CLEAR_CACHE) && !defined(__APPLE__)
|
||||||
__builtin___clear_cache(reinterpret_cast<char*>(code + MainLoopBegin), reinterpret_cast<char*>(code + codePos));
|
__builtin___clear_cache(reinterpret_cast<char*>(code), reinterpret_cast<char*>(code + CodeSize));
|
||||||
|
#else
|
||||||
|
sys_icache_invalidate(code, CodeSize);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,8 +353,10 @@ void JitCompilerA64::generateSuperscalarHash(SuperscalarProgram(&programs)[N], s
|
|||||||
memcpy(code + codePos, p1, p2 - p1);
|
memcpy(code + codePos, p1, p2 - p1);
|
||||||
codePos += p2 - p1;
|
codePos += p2 - p1;
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#if defined(HAVE_BUILTIN_CLEAR_CACHE) && !defined(__APPLE__)
|
||||||
__builtin___clear_cache(reinterpret_cast<char*>(code + CodeSize), reinterpret_cast<char*>(code + codePos));
|
__builtin___clear_cache(reinterpret_cast<char*>(code), reinterpret_cast<char*>(code + CodeSize));
|
||||||
|
#else
|
||||||
|
sys_icache_invalidate(code, CodeSize);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user