summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2022-06-05 05:50:43 +0200
committerLiam <byteslice@airmail.cc>2022-06-05 15:42:05 +0200
commit3c313a43fde6e1f1ef74fd874ca9bf2611be9d95 (patch)
tree89ed86920027a857bcdab5cfc947f220dabd5602 /src/core/hle
parentMerge pull request #8410 from liamwhite/thread-names (diff)
downloadyuzu-3c313a43fde6e1f1ef74fd874ca9bf2611be9d95.tar
yuzu-3c313a43fde6e1f1ef74fd874ca9bf2611be9d95.tar.gz
yuzu-3c313a43fde6e1f1ef74fd874ca9bf2611be9d95.tar.bz2
yuzu-3c313a43fde6e1f1ef74fd874ca9bf2611be9d95.tar.lz
yuzu-3c313a43fde6e1f1ef74fd874ca9bf2611be9d95.tar.xz
yuzu-3c313a43fde6e1f1ef74fd874ca9bf2611be9d95.tar.zst
yuzu-3c313a43fde6e1f1ef74fd874ca9bf2611be9d95.zip
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/service/jit/jit_context.cpp32
1 files changed, 8 insertions, 24 deletions
diff --git a/src/core/hle/service/jit/jit_context.cpp b/src/core/hle/service/jit/jit_context.cpp
index 19bd85b6c..4ed3f02e2 100644
--- a/src/core/hle/service/jit/jit_context.cpp
+++ b/src/core/hle/service/jit/jit_context.cpp
@@ -11,10 +11,13 @@
#include "common/alignment.h"
#include "common/common_funcs.h"
#include "common/div_ceil.h"
+#include "common/elf.h"
#include "common/logging/log.h"
#include "core/hle/service/jit/jit_context.h"
#include "core/memory.h"
+using namespace Common::ELF;
+
namespace Service::JIT {
constexpr std::array<u8, 8> SVC0_ARM64 = {
@@ -26,25 +29,6 @@ constexpr std::array HELPER_FUNCTIONS{
"_stop", "_resolve", "_panic", "memcpy", "memmove", "memset",
};
-struct Elf64_Dyn {
- u64 d_tag;
- u64 d_un;
-};
-
-struct Elf64_Rela {
- u64 r_offset;
- u64 r_info;
- s64 r_addend;
-};
-
-static constexpr u32 Elf64_RelaType(const Elf64_Rela* rela) {
- return static_cast<u32>(rela->r_info);
-}
-
-constexpr int DT_RELA = 7; /* Address of Rela relocs */
-constexpr int DT_RELASZ = 8; /* Total size of Rela relocs */
-constexpr int R_AARCH64_RELATIVE = 1027; /* Adjust by program base. */
-
constexpr size_t STACK_ALIGN = 16;
class JITContextImpl;
@@ -206,17 +190,17 @@ public:
if (!dyn.d_tag) {
break;
}
- if (dyn.d_tag == DT_RELA) {
- rela_dyn = dyn.d_un;
+ if (dyn.d_tag == ElfDtRela) {
+ rela_dyn = dyn.d_un.d_ptr;
}
- if (dyn.d_tag == DT_RELASZ) {
- num_rela = dyn.d_un / sizeof(Elf64_Rela);
+ if (dyn.d_tag == ElfDtRelasz) {
+ num_rela = dyn.d_un.d_val / sizeof(Elf64_Rela);
}
}
for (size_t i = 0; i < num_rela; i++) {
const auto rela{callbacks->ReadMemory<Elf64_Rela>(rela_dyn + i * sizeof(Elf64_Rela))};
- if (Elf64_RelaType(&rela) != R_AARCH64_RELATIVE) {
+ if (Elf64RelType(rela.r_info) != ElfAArch64Relative) {
continue;
}
const VAddr contents{callbacks->MemoryRead64(rela.r_offset)};