merge fastmem

This commit is contained in:
BreadFish64 2019-10-17 13:50:31 -05:00
parent b8bac24fd4
commit 892c7904ca
6 changed files with 52 additions and 7 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.8)
project(dynarmic CXX)
project(dynarmic C CXX)
# Determine if we're built as a subproject (using add_subdirectory)
# or if this is the master project.

View File

@ -101,6 +101,12 @@ struct UserConfig {
/// This can be avoided by carefully allocating the memory region.
bool absolute_offset_page_table = false;
// Fastmem Pointer
// This should point to the beginning of a 4GB address space which is in arranged just like
// what you wish for emulated memory to be. If the host page faults on an address, the JIT
// will fallback to calling the MemoryRead*/MemoryWrite* callbacks.
void* fastmem_pointer = nullptr;
// Coprocessors
std::array<std::shared_ptr<Coprocessor>, 16> coprocessors{};

View File

@ -261,6 +261,36 @@ if (ARCHITECTURE_x86_64)
if (WIN32)
target_sources(dynarmic PRIVATE backend/x64/exception_handler_windows.cpp)
elseif (APPLE)
find_path(MACH_EXC_DEFS_DIR "mach/mach_exc.defs")
if (NOT MACH_EXC_DEFS_DIR)
message(WARNING "macOS fastmem disabled: unable to find mach/mach_exc.defs")
target_sources(dynarmic PRIVATE backend/x64/exception_handler_generic.cpp)
else()
message(STATUS "mach/mach_exc.defs location: ${MACH_EXC_DEFS_DIR}")
execute_process(
COMMAND
mkdir -p "${CMAKE_CURRENT_SOURCE_DIR}/backend/x64/mig"
COMMAND
mig
-arch x86_64
-user "${CMAKE_CURRENT_SOURCE_DIR}/backend/x64/mig/mach_exc_user.c"
-header "${CMAKE_CURRENT_SOURCE_DIR}/backend/x64/mig/mach_exc_user.h"
-server "${CMAKE_CURRENT_SOURCE_DIR}/backend/x64/mig/mach_exc_server.c"
-sheader "${CMAKE_CURRENT_SOURCE_DIR}/backend/x64/mig/mach_exc_server.h"
"${MACH_EXC_DEFS_DIR}/mach/mach_exc.defs"
)
target_sources(dynarmic PRIVATE
backend/x64/exception_handler_macos.cpp
backend/x64/mig/mach_exc_server.c
backend/x64/mig/mach_exc_server.h
)
endif()
elseif (UNIX)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_libraries(dynarmic PUBLIC rt)
endif()
target_sources(dynarmic PRIVATE backend/x64/exception_handler_posix.cpp)
else()
target_sources(dynarmic PRIVATE backend/x64/exception_handler_generic.cpp)
endif()
@ -352,3 +382,5 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
endif()
# Disable this as it relies on a non-standard feature
target_compile_definitions(dynarmic PRIVATE FMT_USE_USER_DEFINED_LITERALS=0)
#export(TARGETS dynarmic boost fmt xbyak FILE "dynarmic-config.cmake")

View File

@ -25,6 +25,10 @@ public:
return !operator==(o);
}
bool operator < (const LocationDescriptor& o) const {
return value < o.Value();
}
u64 Value() const { return value; }
private:
@ -37,12 +41,6 @@ std::ostream& operator<<(std::ostream& o, const LocationDescriptor& descriptor);
namespace std {
template <>
struct less<Dynarmic::IR::LocationDescriptor> {
bool operator()(const Dynarmic::IR::LocationDescriptor& x, const Dynarmic::IR::LocationDescriptor& y) const noexcept {
return x.Value() < y.Value();
}
};
template <>
struct hash<Dynarmic::IR::LocationDescriptor> {
size_t operator()(const Dynarmic::IR::LocationDescriptor& x) const noexcept {
return std::hash<u64>()(x.Value());

View File

@ -34,6 +34,14 @@
#include <fmt/format.h>
#include <fmt/ostream.h>
static Dynarmic::A32::UserConfig GetUserConfig(ArmTestEnv* testenv) {
Dynarmic::A32::UserConfig user_config;
user_config.enable_fast_dispatch = false;
user_config.callbacks = testenv;
user_config.fastmem_pointer = reinterpret_cast<void*>(0xFFFFFDDE00000000);
return user_config;
}
namespace {
using namespace Dynarmic;

View File

@ -63,6 +63,7 @@ endif()
target_include_directories(dynarmic_tests PRIVATE . ../src)
target_compile_options(dynarmic_tests PRIVATE ${DYNARMIC_CXX_FLAGS})
target_compile_definitions(dynarmic_tests PRIVATE FMT_USE_USER_DEFINED_LITERALS=0)
target_compile_options(dynarmic_tests PRIVATE -DCATCH_CONFIG_NO_WINDOWS_SEH -DCATCH_CONFIG_NO_POSIX_SIGNALS)
target_link_libraries(dynarmic_print_info PRIVATE dynarmic boost catch fmt mp)
target_include_directories(dynarmic_print_info PRIVATE . ../src)