mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-11-01 20:01:53 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fbfe0c95fa |
@@ -1,2 +0,0 @@
|
||||
liberapay: crueter
|
||||
custom: 'https://www.paypal.biz/edenemulator'
|
||||
@@ -1,8 +1,4 @@
|
||||
- [ ] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions).
|
||||
- [ ] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability.
|
||||
- [ ] I have read and followed the [website policy](https://git.eden-emu.dev/eden-emu/site-policy).
|
||||
- [ ] I affirm that the content of this pull request body was written and submitted entirely by me, in my own words, and not by an AI agent or LLM.
|
||||
- [ ] I affirm that I did not read any of this, and understand that my pull request will be closed if I check this box.
|
||||
- [ ] I affirm that, by submitting this pull request, I am responsible for all of the changes contained within these commits.
|
||||
|
||||
-------------------
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
diff --git a/cmake/ConfigureOpenSSL.cmake b/cmake/ConfigureOpenSSL.cmake
|
||||
index 3012e05..2ae23ff 100644
|
||||
--- a/cmake/ConfigureOpenSSL.cmake
|
||||
+++ b/cmake/ConfigureOpenSSL.cmake
|
||||
@@ -108,7 +108,8 @@ function(configure_openssl)
|
||||
)
|
||||
|
||||
if(NOT "${CONFIGURE_OPTIONS_OLD}" STREQUAL "")
|
||||
- if(CONFIGURE_OPTIONS STREQUAL CONFIGURE_OPTIONS_OLD)
|
||||
+ # TODO(lizzie): Emscripten has issues with rebuilding due to the wrapper it uses
|
||||
+ if(CMAKE_SYSTEM_NAME MATCHES "Emscripten" OR CONFIGURE_OPTIONS STREQUAL CONFIGURE_OPTIONS_OLD)
|
||||
message(STATUS "Found previous configure results. Don't perform configuration")
|
||||
return()
|
||||
endif()
|
||||
@@ -134,10 +135,24 @@ function(configure_openssl)
|
||||
set(VERBOSE_OPTION OUTPUT_QUIET)
|
||||
endif()
|
||||
|
||||
+ if (CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
||||
+ set(EMSCRIPTEN_CMAKE_WRAPPER "emcmake")
|
||||
+ find_program(EMCC emcc REQUIRED)
|
||||
+ set(EMSCRIPTEN_LINKER ${EMCC})
|
||||
+ list(APPEND CONFIGURE_COMMAND wasm64)
|
||||
+ else()
|
||||
+ set(EMSCRIPTEN_CMAKE_WRAPPER "")
|
||||
+ set(EMSCRIPTEN_LINKER ${CMAKE_LINKER})
|
||||
+ endif ()
|
||||
+
|
||||
execute_process(
|
||||
- COMMAND ${CMAKE_COMMAND} -E env
|
||||
+ COMMAND ${EMSCRIPTEN_CMAKE_WRAPPER} ${CMAKE_COMMAND} -E env
|
||||
"CFLAGS=${CMAKE_C_FLAGS}"
|
||||
"CXXFLAGS=${CMAKE_CXX_FLAGS}"
|
||||
+ "LDFLAGS=${CMAKE_CXX_LINK_FLAGS}"
|
||||
+ "CC=${CMAKE_C_COMPILER}"
|
||||
+ "CXX=${CMAKE_CXX_COMPILER}"
|
||||
+ "LD=${EMSCRIPTEN_LINKER}"
|
||||
${CONFIGURE_COMMAND}
|
||||
WORKING_DIRECTORY ${CONFIGURE_BUILD_DIR}
|
||||
${VERBOSE_OPTION}
|
||||
@@ -1,10 +1,7 @@
|
||||
# AGENTS
|
||||
|
||||
Read and follow the [contribution guidelines](./CONTRIBUTING.md) and our [site policy](https://git.eden-emu.dev/eden-emu/site-policy/src/branch/master)..
|
||||
Read and follow the AI policy found in `docs/policies/AI.md`, and the coding policies found in `docs/policies/Coding.md`.
|
||||
|
||||
Do not, under any circumstances, ever:
|
||||
|
||||
- Submit PRs, push commits, or request any API calls on behalf of the user.
|
||||
- Write commit messages, PR descriptions, or issues on behalf of the user.
|
||||
Do not, under any circumstances, ever submit PRs or push commits on behalf of the user.
|
||||
|
||||
Keep comments to a reasonable level. Do not overexplain or add/remove comments from unrelated parts of the codebase.
|
||||
|
||||
+2
-26
@@ -16,11 +16,8 @@ Eden is free, open-source, copyleft software, licensed under the terms of the [G
|
||||
|
||||
### Policies
|
||||
|
||||
- AI usage is allowed, but we reserve the right to close and rework your PR if you don't fully understand the changes you're making. Additionally:
|
||||
- AI usage is allowed, but we reserve the right to close and rework your PR if you don't fully understand the changes you're making.
|
||||
- As a common courtesy, please disclose your AI usage under the PR description, as `Assisted-by: <AI model> (<how it helped>)`.
|
||||
- All PR descriptions, issue bodies, and comments **must** be written by you, in your own words.
|
||||
- AI-written comments/descriptions/bodies are not only difficult for us to read, they also indicate to us that you did not put in the effort to actually understand your changes. These will be closed, deleted, or hidden without warning.
|
||||
- Spamming of low-effort AI-generated pull requests or issues is considered a [Human Effort Denial of Service](https://tiangolo.com/open-source/contributing/#human-effort-denial-of-service), and will result in the immediate suspension of your Forgejo account, or you getting blocked from the organization on other platforms.
|
||||
- Usage of any form of profanity or otherwise unsavory language is discouraged but not strictly disallowed.
|
||||
- New code must follow the same style as the surrounding codebase. Exceptions may be granted in certain cases.
|
||||
- Maintainers reserve the right to change your patches and pull requests at will. We will try to avoid this.
|
||||
@@ -29,25 +26,6 @@ Eden is free, open-source, copyleft software, licensed under the terms of the [G
|
||||
- While we do *not* adhere to the terms of a formal code of conduct, you are expected to treat other developers, contributors, and community members respectfully.
|
||||
- You **must** have basic knowledge of [Git](https://git-scm.com/learn). Knowing how to manage your branches and follow proper fork policies is a necessity.
|
||||
|
||||
### Pull Requests
|
||||
|
||||
Pull requests are only to be merged by core developers when properly tested and discussions conclude on Discord or other communication channels. Labels are recommended but not required. However, all PRs MUST be namespaced and optionally typed:
|
||||
|
||||
```txt
|
||||
[cmake] refactor: CPM over submodules
|
||||
[desktop] feat: implement firmware install from ZIP
|
||||
[hle] stub fw20 functions
|
||||
[core] test: raise maximum CPU cores to 6
|
||||
[cmake, core] Unbreak FreeBSD Building Process
|
||||
```
|
||||
|
||||
- The level of namespacing is generally left to the committer's choice.
|
||||
- However, we never recommend going more than two levels *except* in `hle`, in which case you may go as many as four levels depending on the specificity of your changes.
|
||||
- Ocassionally, up to two additional namespaces may be provided for more clarity.
|
||||
- Changes that affect the entire project (sans CMake changes) should be namespaced as `meta`.
|
||||
- Maintainers are permitted to change namespaces at will.
|
||||
- Commits within PRs are not required to be namespaced, but it is highly recommended.
|
||||
|
||||
### Where do I start?
|
||||
|
||||
Anywhere you like! If you are facing an issue and want to fix it, go ahead. For new features, you are heavily encouraged to open a feature request on GitHub, Codeberg, or Forgejo first, discussing the motivations, potential implementation, and user flow of your desired feature. Our UI/UX designers will work with you to refine your feature before you actually choose to implement it.
|
||||
@@ -61,8 +39,6 @@ There are five primary ways to contribute.
|
||||
- Submit pull requests directly to our source tree
|
||||
- You must first [create an account](https://git.eden-emu.dev/user/sign_up).
|
||||
- You may use an internal account, or you may use a GitHub/Codeberg account linked to our instance.
|
||||
- Please make sure to read our [site policy](https://git.eden-emu.dev/eden-emu/site-policy/src/branch/master).
|
||||
- Both your account and your associated fork must be public, *not* limited/private, otherwise our CI workflow will not work on your pull requests.
|
||||
- Submit pull requests to our [GitHub mirror](https://github.com/eden-emulator/Issue-Reports)
|
||||
- Note that this is subject to being removed by DMCA, so don't rely on this.
|
||||
- Submit pull requests to our [Codeberg mirror](https://codeberg.org/eden-emu/eden)
|
||||
@@ -72,7 +48,7 @@ There are five primary ways to contribute.
|
||||
- Alongside the contents of your email, please attach the patch/diff file itself for easy access and use.
|
||||
- Email our developers at [`developers@eden-emu.dev`](mailto:developers@eden-emu.dev) with any of your relevant findings or code changes.
|
||||
|
||||
To test your changes, ensure to read the [build documentation](./docs/Build.md) for your specific platform(s) to ensure everything compiles and works properly. You should also make sure that your branch is up-to-date with the upstream `master` branch before opening a pull request. **You** are responsible for ensuring that your contribution does what it says and doesn't break everything else horribly.
|
||||
To test your changes, ensure to read the [build documentation](./docs/Build.md) for your specific platform(s) to ensure everything compiles and works properly. You should also make sure that your branch is up-to-date with the upstream `master` branch before opening a pull request.
|
||||
|
||||
## Non-code Contributions
|
||||
|
||||
|
||||
+1
-2
@@ -202,8 +202,7 @@
|
||||
"0001-cpmutil-compat.patch",
|
||||
"0002-use-ccache.patch",
|
||||
"0003-use-cmake-compiler-flags.patch",
|
||||
"0004-use-shell-wrapper.patch",
|
||||
"0005-cross-compile.patch"
|
||||
"0004-use-shell-wrapper.patch"
|
||||
],
|
||||
"repo": "jimmy-park/openssl-cmake",
|
||||
"version": "3.6.2"
|
||||
|
||||
+4
-25
@@ -6,31 +6,10 @@ General guide for cross compiling.
|
||||
|
||||
A painless guide for cross compilation (or to test NCE) from a x86_64 system without polluting your main.
|
||||
|
||||
```sh
|
||||
#!/bin/sh
|
||||
ISO_FILE="debian-13.0.0-arm64-netinst.iso"
|
||||
DISK_FILE="debian-13-arm64-ci.qcow2"
|
||||
which -- qemu-system-aarch64 || sudo pkg install qemu
|
||||
[ -f "$ISO_FILE" ] || wget https://cdimage.debian.org/debian-cd/current/arm64/iso-cd/$ISO_FILE
|
||||
[ -f "$DISK_FILE" ] || qemu-img create -f qcow2 "$DISK_FILE" 30G
|
||||
QEMU_FLAGS=(
|
||||
-M virt
|
||||
-m 2G
|
||||
-cpu max
|
||||
-bios /usr/local/share/qemu/edk2-aarch64-code.fd
|
||||
-drive if=none,file=$ISO_FILE,format=raw,id=cdrom
|
||||
-drive if=none,file=$DISK_FILE,id=hd0,format=qcow2
|
||||
-device scsi-cd,drive=cdrom
|
||||
-device virtio-blk-device,drive=hd0
|
||||
-device virtio-gpu-pci
|
||||
-device usb-ehci
|
||||
-device usb-kbd
|
||||
-device intel-hda
|
||||
-device hda-output
|
||||
-nic user,model=virtio-net-pci
|
||||
)
|
||||
qemu-system-aarch64 "${QEMU_FLAGS[@]}"
|
||||
```
|
||||
- Install QEMU: `sudo pkg install qemu`
|
||||
- Download Debian 13: `wget https://cdimage.debian.org/debian-cd/current/arm64/iso-cd/debian-13.0.0-arm64-netinst.iso`
|
||||
- Create a system disk: `qemu-img create -f qcow2 debian-13-arm64-ci.qcow2 30G`
|
||||
- Run the VM: `qemu-system-aarch64 -M virt -m 2G -cpu max -bios /usr/local/share/qemu/edk2-aarch64-code.fd -drive if=none,file=debian-13.0.0-arm64-netinst.iso,format=raw,id=cdrom -device scsi-cd,drive=cdrom -drive if=none,file=debian-13-arm64-ci.qcow2,id=hd0,format=qcow2 -device virtio-blk-device,drive=hd0 -device virtio-gpu-pci -device usb-ehci -device usb-kbd -device intel-hda -device hda-output -nic user,model=virtio-net-pci`
|
||||
|
||||
## Gentoo
|
||||
|
||||
|
||||
@@ -24,6 +24,25 @@ If the work is licensed/vendored from other people or projects, you may omit the
|
||||
|
||||
For more information on the license header script, run `.ci/license-header.sh -h`.
|
||||
|
||||
## Pull Requests
|
||||
|
||||
Pull requests are only to be merged by core developers when properly tested and discussions conclude on Discord or other communication channels. Labels are recommended but not required. However, all PRs MUST be namespaced and optionally typed:
|
||||
|
||||
```txt
|
||||
[cmake] refactor: CPM over submodules
|
||||
[desktop] feat: implement firmware install from ZIP
|
||||
[hle] stub fw20 functions
|
||||
[core] test: raise maximum CPU cores to 6
|
||||
[cmake, core] Unbreak FreeBSD Building Process
|
||||
```
|
||||
|
||||
- The level of namespacing is generally left to the committer's choice.
|
||||
- However, we never recommend going more than two levels *except* in `hle`, in which case you may go as many as four levels depending on the specificity of your changes.
|
||||
- Ocassionally, up to two additional namespaces may be provided for more clarity.
|
||||
- Changes that affect the entire project (sans CMake changes) should be namespaced as `meta`.
|
||||
- Maintainers are permitted to change namespaces at will.
|
||||
- Commits within PRs are not required to be namespaced, but it is highly recommended.
|
||||
|
||||
## Adding new settings
|
||||
|
||||
When adding new settings, use `tr("Setting:")` if the setting is meant to be a field, otherwise use `tr("Setting")` if the setting is meant to be a Yes/No or checkmark type of setting, see [this short style guide](https://learn.microsoft.com/en-us/style-guide/punctuation/colons#in-ui).
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ This contains documentation created by developers, build instructions, guideline
|
||||
|
||||
Policies and information on development.
|
||||
|
||||
- **[AI and LLM Usage](./CONTRIBUTING.md#policies)**
|
||||
- **[AI and LLM Usage](./policies/AI.md)**
|
||||
- **[Coding guidelines](./policies/Coding.md)**
|
||||
- **[Contributing](../CONTRIBUTING.md)**
|
||||
|
||||
|
||||
+5
-5
@@ -101,11 +101,6 @@ endfunction()
|
||||
# ia64 exists
|
||||
# the rest exist, but are probably less popular than ia64
|
||||
|
||||
detect_architecture_symbols(
|
||||
ARCH wasm
|
||||
SYMBOLS
|
||||
"__EMSCRIPTEN__")
|
||||
|
||||
detect_architecture_symbols(
|
||||
ARCH arm64
|
||||
SYMBOLS
|
||||
@@ -208,6 +203,11 @@ detect_architecture_symbols(
|
||||
"__loongarch__"
|
||||
"__loongarch64")
|
||||
|
||||
detect_architecture_symbols(
|
||||
ARCH wasm
|
||||
SYMBOLS
|
||||
"__EMSCRIPTEN__")
|
||||
|
||||
# "generic" target
|
||||
# If you have reached this point, you're on some as-of-yet unsupported architecture.
|
||||
# See the docs up above for known unsupported architectures
|
||||
|
||||
@@ -60,20 +60,17 @@ NCA::NCA(VirtualFile file_, const NCA* base_nca, bool allow_missing_base)
|
||||
auto titlekey =
|
||||
keys.GetKey(Core::Crypto::S128KeyType::Titlekey, rights_id_u128[1], rights_id_u128[0]);
|
||||
if (titlekey == Core::Crypto::Key128{}) {
|
||||
status = Loader::ResultStatus::ErrorMissingTitlekey;
|
||||
return;
|
||||
// Fallback: use rights_id as TitleKey for direct dumps without tickets/keys.
|
||||
std::memcpy(titlekey.data(), rights_id.data(), rights_id.size());
|
||||
LOG_DEBUG(Loader, "TitleKey not found for {}, falling back to RightsId.",
|
||||
file->GetName());
|
||||
} else if (keys.HasKey(Core::Crypto::S128KeyType::Titlekek, master_key_id)) {
|
||||
auto titlekek = keys.GetKey(Core::Crypto::S128KeyType::Titlekek, master_key_id);
|
||||
Core::Crypto::AESCipher<Core::Crypto::Key128> cipher(titlekek, Core::Crypto::Mode::ECB);
|
||||
cipher.Transcode(titlekey.data(), titlekey.size(), titlekey.data(),
|
||||
Core::Crypto::Op::Decrypt);
|
||||
}
|
||||
|
||||
if (!keys.HasKey(Core::Crypto::S128KeyType::Titlekek, master_key_id)) {
|
||||
status = Loader::ResultStatus::ErrorMissingTitlekek;
|
||||
return;
|
||||
}
|
||||
|
||||
auto titlekek = keys.GetKey(Core::Crypto::S128KeyType::Titlekek, master_key_id);
|
||||
Core::Crypto::AESCipher<Core::Crypto::Key128> cipher(titlekek, Core::Crypto::Mode::ECB);
|
||||
cipher.Transcode(titlekey.data(), titlekey.size(), titlekey.data(),
|
||||
Core::Crypto::Op::Decrypt);
|
||||
|
||||
reader->SetExternalDecryptionKey(titlekey.data(), titlekey.size());
|
||||
}
|
||||
|
||||
|
||||
+69
-16
@@ -11,15 +11,34 @@ set(dynarmic_VERSION ${dynarmic_VERSION_MAJOR}.${dynarmic_VERSION_MINOR}.${dynar
|
||||
|
||||
project(dynarmic LANGUAGES C CXX ASM VERSION ${dynarmic_VERSION})
|
||||
|
||||
# Determine if we're built as a subproject (using add_subdirectory)
|
||||
# or if this is the master project.
|
||||
set(MASTER_PROJECT OFF)
|
||||
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
||||
set(MASTER_PROJECT ON)
|
||||
endif()
|
||||
|
||||
if (MASTER_PROJECT)
|
||||
include(CTest)
|
||||
endif()
|
||||
|
||||
# Dynarmic project options
|
||||
option(DYNARMIC_ENABLE_CPU_FEATURE_DETECTION "Turning this off causes dynarmic to assume the host CPU doesn't support anything later than SSE3" ON)
|
||||
|
||||
if (OPENBSD OR DRAGONFLY OR NETBSD)
|
||||
set(REQUIRE_WX ON)
|
||||
else()
|
||||
set(REQUIRE_WX OFF)
|
||||
endif()
|
||||
option(DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT "Enables support for systems that require W^X" ${REQUIRE_WX})
|
||||
|
||||
option(DYNARMIC_IGNORE_ASSERTS "Ignore asserts" ON)
|
||||
option(DYNARMIC_TESTS_USE_UNICORN "Enable fuzzing tests against unicorn" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DYNARMIC_USE_LLVM "Support disassembly of jitted x86_64 code using LLVM" OFF "NOT YUZU_DISABLE_LLVM" OFF)
|
||||
|
||||
option(DYNARMIC_INSTALL "Install dynarmic headers and CMake files" OFF)
|
||||
option(DYNARMIC_USE_BUNDLED_EXTERNALS "Use all bundled externals (useful when e.g. cross-compiling)" OFF)
|
||||
|
||||
# Set hard requirements for C++
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
@@ -69,7 +88,7 @@ if (MSVC)
|
||||
-Wno-missing-braces)
|
||||
endif()
|
||||
else()
|
||||
list(APPEND DYNARMIC_CXX_FLAGS
|
||||
set(DYNARMIC_CXX_FLAGS
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wcast-qual
|
||||
@@ -84,35 +103,37 @@ else()
|
||||
# to Address& after first checking isMEM(), and that code is inlined in a situation where
|
||||
# GCC knows that the variable is actually a Reg64. isMEM() will never return true for a
|
||||
# Reg64, but GCC doesn't know that.
|
||||
list(APPEND DYNARMIC_CXX_FLAGS
|
||||
-Wno-array-bounds
|
||||
-Wstack-usage=4096)
|
||||
list(APPEND DYNARMIC_CXX_FLAGS -Wno-array-bounds)
|
||||
list(APPEND DYNARMIC_CXX_FLAGS -Wstack-usage=4096)
|
||||
endif()
|
||||
if (CXX_CLANG)
|
||||
list(APPEND DYNARMIC_CXX_FLAGS
|
||||
# Bracket depth determines maximum size of a fold expression in Clang since 9c9974c3ccb6.
|
||||
# And this in turns limits the size of a std::array.
|
||||
-fbracket-depth=1024
|
||||
# Clang mistakenly blames CMake for using unused arguments during compilation
|
||||
-Wno-unused-command-line-argument)
|
||||
# Bracket depth determines maximum size of a fold expression in Clang since 9c9974c3ccb6.
|
||||
# And this in turns limits the size of a std::array.
|
||||
list(APPEND DYNARMIC_CXX_FLAGS -fbracket-depth=1024)
|
||||
# Clang mistakenly blames CMake for using unused arguments during compilation
|
||||
list(APPEND DYNARMIC_CXX_FLAGS -Wno-unused-command-line-argument)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT Boost_FOUND)
|
||||
find_package(Boost 1.57 REQUIRED)
|
||||
endif()
|
||||
|
||||
find_package(fmt 8 CONFIG)
|
||||
|
||||
if (ARCHITECTURE_arm64)
|
||||
if ("arm64" IN_LIST ARCHITECTURE OR DYNARMIC_TESTS)
|
||||
find_package(oaknut 2.0.1 CONFIG)
|
||||
endif()
|
||||
if (ARCHITECTURE_riscv64)
|
||||
|
||||
if ("riscv64" IN_LIST ARCHITECTURE)
|
||||
find_package(biscuit 0.9.1 REQUIRED)
|
||||
endif()
|
||||
if (ARCHITECTURE_loongarch64)
|
||||
|
||||
if ("loongarch64" IN_LIST ARCHITECTURE)
|
||||
find_package(lagoon REQUIRED)
|
||||
endif()
|
||||
if (ARCHITECTURE_x86_64)
|
||||
|
||||
if ("x86_64" IN_LIST ARCHITECTURE)
|
||||
find_package(xbyak 7 CONFIG)
|
||||
endif()
|
||||
|
||||
@@ -121,12 +142,44 @@ if (DYNARMIC_USE_LLVM)
|
||||
separate_arguments(LLVM_DEFINITIONS)
|
||||
endif()
|
||||
|
||||
# Dynarmic project files
|
||||
add_subdirectory(src/dynarmic)
|
||||
if (DYNARMIC_TESTS)
|
||||
find_package(Catch2 3 CONFIG)
|
||||
if (DYNARMIC_TESTS_USE_UNICORN)
|
||||
find_package(Unicorn REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Dynarmic project files
|
||||
add_subdirectory(src/dynarmic)
|
||||
if (DYNARMIC_TESTS)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Install
|
||||
#
|
||||
if (DYNARMIC_INSTALL)
|
||||
include(GNUInstallDirs)
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
install(TARGETS dynarmic EXPORT dynarmicTargets)
|
||||
install(EXPORT dynarmicTargets
|
||||
NAMESPACE dynarmic::
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/dynarmic"
|
||||
)
|
||||
|
||||
configure_package_config_file(CMakeModules/dynarmicConfig.cmake.in
|
||||
dynarmicConfig.cmake
|
||||
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/dynarmic"
|
||||
)
|
||||
write_basic_package_version_file(dynarmicConfigVersion.cmake
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
install(FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/dynarmicConfig.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/dynarmicConfigVersion.cmake"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/dynarmic"
|
||||
)
|
||||
|
||||
install(DIRECTORY src/dynarmic TYPE INCLUDE FILES_MATCHING PATTERN "*.h")
|
||||
endif()
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
function(target_architecture_specific_sources project arch)
|
||||
if (NOT MULTIARCH_BUILD)
|
||||
target_sources("${project}" PRIVATE ${ARGN})
|
||||
return()
|
||||
endif()
|
||||
|
||||
foreach(input_file IN LISTS ARGN)
|
||||
if(input_file MATCHES ".cpp$")
|
||||
if(NOT IS_ABSOLUTE ${input_file})
|
||||
set(input_file "${CMAKE_CURRENT_SOURCE_DIR}/${input_file}")
|
||||
endif()
|
||||
|
||||
set(output_file "${CMAKE_CURRENT_BINARY_DIR}/arch_gen/${input_file}")
|
||||
add_custom_command(
|
||||
OUTPUT "${output_file}"
|
||||
COMMAND ${CMAKE_COMMAND} "-Darch=${arch}"
|
||||
"-Dinput_file=${input_file}"
|
||||
"-Doutput_file=${output_file}"
|
||||
-P "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/impl/TargetArchitectureSpecificSourcesWrapFile.cmake"
|
||||
DEPENDS "${input_file}"
|
||||
VERBATIM
|
||||
)
|
||||
target_sources(${project} PRIVATE "${output_file}")
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
@@ -0,0 +1,31 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
set(ARCHITECTURE "@ARCHITECTURE@")
|
||||
|
||||
if (NOT @BUILD_SHARED_LIBS@)
|
||||
find_dependency(Boost 1.57)
|
||||
find_dependency(fmt 9)
|
||||
find_dependency(mcl 0.1.12 EXACT)
|
||||
|
||||
if ("arm64" IN_LIST ARCHITECTURE)
|
||||
find_dependency(oaknut 2.0.1)
|
||||
endif()
|
||||
|
||||
if ("riscv" IN_LIST ARCHITECTURE)
|
||||
find_dependency(biscuit 0.9.1)
|
||||
endif()
|
||||
|
||||
if ("x86_64" IN_LIST ARCHITECTURE)
|
||||
find_dependency(xbyak 7)
|
||||
endif()
|
||||
|
||||
if (@DYNARMIC_USE_LLVM@)
|
||||
find_dependency(LLVM)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
|
||||
|
||||
check_required_components(@PROJECT_NAME@)
|
||||
@@ -0,0 +1,6 @@
|
||||
# SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
string(TOUPPER "${arch}" arch)
|
||||
file(READ "${input_file}" f_contents)
|
||||
file(WRITE "${output_file}" "#if defined(ARCHITECTURE_${arch})\n${f_contents}\n#endif\n")
|
||||
@@ -1,5 +1,7 @@
|
||||
# SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
include(TargetArchitectureSpecificSources)
|
||||
|
||||
add_library(dynarmic STATIC
|
||||
mcl/bit.hpp
|
||||
mcl/function_info.hpp
|
||||
@@ -133,7 +135,7 @@ add_library(dynarmic STATIC
|
||||
interface/A64/config.h
|
||||
)
|
||||
|
||||
if (ARCHITECTURE_x86_64)
|
||||
if ("x86_64" IN_LIST ARCHITECTURE)
|
||||
# Newer versions of xbyak (>= 7.25.0) have stricter checks that currently
|
||||
# fail in dynarmic
|
||||
target_compile_definitions(dynarmic PRIVATE XBYAK_STRICT_CHECK_MEM_REG_SIZE=0)
|
||||
@@ -141,7 +143,7 @@ if (ARCHITECTURE_x86_64)
|
||||
target_compile_definitions(dynarmic PRIVATE XBYAK_OLD_DISP_CHECK=1)
|
||||
target_link_libraries(dynarmic PRIVATE xbyak::xbyak)
|
||||
|
||||
target_sources(dynarmic PRIVATE
|
||||
target_architecture_specific_sources(dynarmic "x86_64"
|
||||
backend/x64/abi.cpp
|
||||
backend/x64/abi.h
|
||||
backend/x64/block_of_code.cpp
|
||||
@@ -199,10 +201,10 @@ if (ARCHITECTURE_x86_64)
|
||||
)
|
||||
endif()
|
||||
|
||||
if (ARCHITECTURE_arm64)
|
||||
if ("arm64" IN_LIST ARCHITECTURE)
|
||||
target_link_libraries(dynarmic PRIVATE merry::oaknut)
|
||||
|
||||
target_sources(dynarmic PRIVATE
|
||||
target_architecture_specific_sources(dynarmic "arm64"
|
||||
backend/arm64/a32_jitstate.cpp
|
||||
backend/arm64/a32_jitstate.h
|
||||
backend/arm64/a64_jitstate.h
|
||||
@@ -253,7 +255,7 @@ if (ARCHITECTURE_arm64)
|
||||
)
|
||||
endif()
|
||||
|
||||
if (ARCHITECTURE_riscv64)
|
||||
if ("riscv64" IN_LIST ARCHITECTURE)
|
||||
target_link_libraries(dynarmic PRIVATE biscuit::biscuit)
|
||||
|
||||
target_sources(dynarmic PRIVATE
|
||||
@@ -293,7 +295,7 @@ if (ARCHITECTURE_riscv64)
|
||||
message(WARNING "TODO: Incomplete frontend for this host architecture")
|
||||
endif()
|
||||
|
||||
if (ARCHITECTURE_loongarch64)
|
||||
if ("loongarch64" IN_LIST ARCHITECTURE)
|
||||
target_link_libraries(dynarmic PRIVATE lagoon::lagoon)
|
||||
|
||||
target_sources(dynarmic PRIVATE
|
||||
@@ -398,9 +400,15 @@ if (DYNARMIC_USE_LLVM)
|
||||
target_compile_definitions(dynarmic PRIVATE DYNARMIC_USE_LLVM=1 ${LLVM_DEFINITIONS})
|
||||
llvm_config(dynarmic USE_SHARED armdesc armdisassembler aarch64desc aarch64disassembler x86desc x86disassembler)
|
||||
endif()
|
||||
if (DYNARMIC_ENABLE_CPU_FEATURE_DETECTION)
|
||||
target_compile_definitions(dynarmic PRIVATE DYNARMIC_ENABLE_CPU_FEATURE_DETECTION=1)
|
||||
endif()
|
||||
if (DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT)
|
||||
target_compile_definitions(dynarmic PRIVATE DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT=1)
|
||||
endif()
|
||||
if (DYNARMIC_IGNORE_ASSERTS)
|
||||
target_compile_definitions(dynarmic PRIVATE MCL_IGNORE_ASSERTS=1)
|
||||
endif()
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
target_compile_definitions(dynarmic PRIVATE FMT_USE_WINDOWS_H=0)
|
||||
endif()
|
||||
|
||||
@@ -197,15 +197,15 @@ void EmitA32Terminal(biscuit::Assembler& as, EmitContext& ctx, IR::Term::CheckHa
|
||||
|
||||
void EmitA32LeafTerminal(biscuit::Assembler& as, EmitContext& ctx, IR::Term::LeafTerminal terminal, IR::LocationDescriptor initial_location, bool is_single_step) {
|
||||
if (auto const x = std::get_if<IR::Term::ReturnToDispatch>(&terminal))
|
||||
return EmitA32Terminal(as, ctx, *x, initial_location, is_single_step);
|
||||
return EmitA32LeafTerminal(as, ctx, *x, initial_location, is_single_step);
|
||||
if (auto const x = std::get_if<IR::Term::LinkBlock>(&terminal))
|
||||
return EmitA32Terminal(as, ctx, *x, initial_location, is_single_step);
|
||||
return EmitA32LeafTerminal(as, ctx, *x, initial_location, is_single_step);
|
||||
if (auto const x = std::get_if<IR::Term::LinkBlockFast>(&terminal))
|
||||
return EmitA32Terminal(as, ctx, *x, initial_location, is_single_step);
|
||||
return EmitA32LeafTerminal(as, ctx, *x, initial_location, is_single_step);
|
||||
if (auto const x = std::get_if<IR::Term::PopRSBHint>(&terminal))
|
||||
return EmitA32Terminal(as, ctx, *x, initial_location, is_single_step);
|
||||
return EmitA32LeafTerminal(as, ctx, *x, initial_location, is_single_step);
|
||||
if (auto const x = std::get_if<IR::Term::FastDispatchHint>(&terminal))
|
||||
return EmitA32Terminal(as, ctx, *x, initial_location, is_single_step);
|
||||
return EmitA32LeafTerminal(as, ctx, *x, initial_location, is_single_step);
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@ void ProtectMemory(const void* base, size_t size, bool is_executable) {
|
||||
|
||||
static const HostFeature features = []() {
|
||||
HostFeature f{};
|
||||
#ifdef DYNARMIC_ENABLE_CPU_FEATURE_DETECTION
|
||||
using Cpu = Xbyak::util::Cpu;
|
||||
Xbyak::util::Cpu cpu_info{};
|
||||
if (cpu_info.has(Cpu::tSSSE3)) f |= HostFeature::SSSE3;
|
||||
@@ -120,6 +121,7 @@ static const HostFeature features = []() {
|
||||
}
|
||||
}
|
||||
return f;
|
||||
#endif
|
||||
}();
|
||||
HostFeature GetHostFeatures() {
|
||||
return features;
|
||||
|
||||
@@ -275,7 +275,6 @@ const void* EmitReadMemoryMov(BlockOfCode& code, int value_idx, const Xbyak::Reg
|
||||
code.xadd(qword[addr], Xbyak::Reg64(value_idx));
|
||||
break;
|
||||
case 128:
|
||||
ASSERT(Xbyak::Xmm(value_idx) != xmm0);
|
||||
code.lock();
|
||||
code.cmpxchg16b(xword[addr]);
|
||||
if (code.HasHostFeature(HostFeature::SSE41)) {
|
||||
|
||||
@@ -6226,7 +6226,9 @@ void EmitX64::EmitVectorZeroExtend64(EmitContext& ctx, IR::Inst* inst) {
|
||||
void EmitX64::EmitVectorZeroUpper(EmitContext& ctx, IR::Inst* inst) {
|
||||
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
||||
auto const a = ctx.reg_alloc.UseScratchXmm(code, args[0]);
|
||||
|
||||
code.movq(a, a); // TODO: !IsLastUse
|
||||
|
||||
ctx.reg_alloc.DefineValue(code, inst, a);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,12 @@
|
||||
#include "dynarmic/backend/x64/hostloc.h"
|
||||
#include "dynarmic/common/spin_lock.h"
|
||||
|
||||
#ifdef DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT
|
||||
static const auto default_cg_mode = Xbyak::DontSetProtectRWE;
|
||||
#else
|
||||
static const auto default_cg_mode = nullptr; //Allow RWE
|
||||
#endif
|
||||
|
||||
namespace Dynarmic {
|
||||
|
||||
void EmitSpinLockLock(Xbyak::CodeGenerator& code, Xbyak::Reg64 ptr, Xbyak::Reg32 tmp, bool waitpkg) {
|
||||
@@ -72,13 +78,7 @@ namespace {
|
||||
struct SpinLockImpl {
|
||||
void Initialize() noexcept;
|
||||
static void GlobalInitialize() noexcept;
|
||||
Xbyak::CodeGenerator code = Xbyak::CodeGenerator(4096
|
||||
#ifdef DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT
|
||||
, Xbyak::DontSetProtectRWE
|
||||
#else
|
||||
, nullptr //Allow RWE
|
||||
#endif
|
||||
);
|
||||
Xbyak::CodeGenerator code = Xbyak::CodeGenerator(4096, default_cg_mode);
|
||||
void (*lock)(volatile int*) = nullptr;
|
||||
void (*unlock)(volatile int*) = nullptr;
|
||||
};
|
||||
|
||||
@@ -91,7 +91,7 @@ struct detail {
|
||||
shifts[arg_index] = bit_position;
|
||||
}
|
||||
}
|
||||
#if !defined(__ANDROID__)
|
||||
#if !defined(DYNARMIC_IGNORE_ASSERTS) && !defined(__ANDROID__)
|
||||
// Avoids a MSVC ICE, and avoids Android NDK issue.
|
||||
DEBUG_ASSERT(std::all_of(masks.begin(), masks.end(), [](auto m) { return m != 0; }));
|
||||
#endif
|
||||
|
||||
@@ -2632,66 +2632,3 @@ TEST_CASE("A64: Rounding", "[a64]") {
|
||||
CHECK(jit.GetVector(5) == Vector{0x4000000040000000, 0x4000000040000000});
|
||||
CHECK(jit.GetVector(6) == Vector{0x4000000040000000, 0x4000000040000000});
|
||||
}
|
||||
|
||||
TEST_CASE("A64: SM4", "[a64]") {
|
||||
A64TestEnv env;
|
||||
A64::UserConfig jit_user_config{};
|
||||
jit_user_config.callbacks = &env;
|
||||
A64::Jit jit{jit_user_config};
|
||||
|
||||
oaknut::VectorCodeGenerator code{env.code_mem, nullptr};
|
||||
|
||||
code.SM4EKEY(V4.S4(), V0.S4(), V1.S4());
|
||||
code.SM4E(V5.S4(), V0.S4(), V1.S4());
|
||||
|
||||
jit.SetPC(0);
|
||||
jit.SetVector(0, {0xefcdab8967452301, 0x1032547698badcfe});
|
||||
jit.SetVector(1, {0xefcdab8967452301, 0x1032547698badcfe});
|
||||
env.ticks_left = env.code_mem.size();
|
||||
CheckedRun([&]() { jit.Run(); });
|
||||
|
||||
CHECK(jit.GetVector(4) == Vector{0x486a0c2e00224466, 0x5c7e183a62402604});
|
||||
CHECK(jit.GetVector(5) == Vector{0xc2e086a43c1e785a, 0xd7f593b104264062});
|
||||
}
|
||||
|
||||
TEST_CASE("A64: SM3", "[a64]") {
|
||||
A64TestEnv env;
|
||||
A64::UserConfig jit_user_config{};
|
||||
jit_user_config.callbacks = &env;
|
||||
SECTION("SM3SS1") {
|
||||
A64::Jit jit{jit_user_config};
|
||||
oaknut::VectorCodeGenerator code{env.code_mem, nullptr};
|
||||
code.SM3SS1(V0.S4(), V0.S4(), V1.S4(), V2.S4());
|
||||
jit.SetPC(0);
|
||||
jit.SetVector(0, {0xec4aff517369c667, 0x46e3fbf2abbacd29});
|
||||
jit.SetVector(1, {0x8de7e81bf854c27c, 0x9ac99f33632e5a76});
|
||||
jit.SetVector(2, {0x5aa35831b70d3266, 0xd45ee95817055d25});
|
||||
env.ticks_left = env.code_mem.size();
|
||||
CheckedRun([&]() { jit.Run(); });
|
||||
CHECK(jit.GetVector(0) == Vector{0x0000000000000000, 0x73d67cd700000000});
|
||||
}
|
||||
SECTION("SM3PARTW1") {
|
||||
A64::Jit jit{jit_user_config};
|
||||
oaknut::VectorCodeGenerator code{env.code_mem, nullptr};
|
||||
code.SM3PARTW1(V0.S4(), V0.S4(), V1.S4(), V2.S4());
|
||||
jit.SetPC(0);
|
||||
jit.SetVector(0, {0xec4aff517369c667, 0x46e3fbf2abbacd29});
|
||||
jit.SetVector(1, {0x8de7e81bf854c27c, 0x9ac99f33632e5a76});
|
||||
jit.SetVector(2, {0x5aa35831b70d3266, 0xd45ee95817055d25});
|
||||
env.ticks_left = env.code_mem.size();
|
||||
CheckedRun([&]() { jit.Run(); });
|
||||
CHECK(jit.GetVector(0) == Vector{0x653c64995693280c, 0xabcc7db97adebf12});
|
||||
}
|
||||
SECTION("SM3PARTW2") {
|
||||
A64::Jit jit{jit_user_config};
|
||||
oaknut::VectorCodeGenerator code{env.code_mem, nullptr};
|
||||
code.SM3PARTW2(V0.S4(), V0.S4(), V1.S4(), V2.S4());
|
||||
jit.SetPC(0);
|
||||
jit.SetVector(0, {0xec4aff517369c667, 0x46e3fbf2abbacd29});
|
||||
jit.SetVector(1, {0x8de7e81bf854c27c, 0x9ac99f33632e5a76});
|
||||
jit.SetVector(2, {0x5aa35831b70d3266, 0xd45ee95817055d25});
|
||||
env.ticks_left = env.code_mem.size();
|
||||
CheckedRun([&]() { jit.Run(); });
|
||||
CHECK(jit.GetVector(0) == Vector{0x30010fe70da43740, 0x6702425b4a3a05d4});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
include(TargetArchitectureSpecificSources)
|
||||
|
||||
add_executable(dynarmic_tests
|
||||
fp/FPToFixed.cpp
|
||||
fp/FPValue.cpp
|
||||
@@ -42,13 +44,13 @@ if (DYNARMIC_TESTS_USE_UNICORN)
|
||||
)
|
||||
endif()
|
||||
|
||||
if (ARCHITECTURE_riscv64)
|
||||
if ("riscv" IN_LIST ARCHITECTURE)
|
||||
target_link_libraries(dynarmic_tests PRIVATE biscuit::biscuit)
|
||||
endif()
|
||||
|
||||
if (ARCHITECTURE_x86_64)
|
||||
if ("x86_64" IN_LIST ARCHITECTURE)
|
||||
target_link_libraries(dynarmic_tests PRIVATE xbyak::xbyak)
|
||||
target_sources(dynarmic_tests PRIVATE
|
||||
target_architecture_specific_sources(dynarmic_tests "x86_64"
|
||||
x64_cpu_info.cpp
|
||||
native/preserve_xmm.cpp
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user