linker fixes

This commit is contained in:
Niko 2024-09-04 21:50:01 -04:00
parent 59294f4536
commit 41193b6a83
2 changed files with 14 additions and 12 deletions

View File

@ -306,9 +306,8 @@ bool Linker::Resolve(const std::string& name, Loader::SymbolType sym_type, Modul
return false; return false;
} }
void* Linker::TlsGetAddr(u64 module_index, u64 offset) void* Linker::TlsGetAddr(u64 module_index, u64 offset) {
{
#ifdef __x86_64__
std::scoped_lock lk{mutex}; std::scoped_lock lk{mutex};
DtvEntry* dtv_table = GetTcbBase()->tcb_dtv; DtvEntry* dtv_table = GetTcbBase()->tcb_dtv;
@ -341,10 +340,6 @@ void* Linker::TlsGetAddr(u64 module_index, u64 offset)
dtv_table[module_index + 1].pointer = dest; dtv_table[module_index + 1].pointer = dest;
addr = dest; addr = dest;
} }
return addr + offset;
#else
return 0;
#endif
} }
void Linker::InitTlsForThread(bool is_primary) { void Linker::InitTlsForThread(bool is_primary) {

View File

@ -1,8 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#ifdef __x86_64__
#include <mutex> #include <mutex>
#include "common/assert.h" #include "common/assert.h"
#include "common/types.h" #include "common/types.h"
@ -42,7 +40,7 @@ Tcb* GetTcbBase() {
return reinterpret_cast<Tcb*>(TlsGetValue(GetTcbKey())); return reinterpret_cast<Tcb*>(TlsGetValue(GetTcbKey()));
} }
#elif defined(__APPLE__) #elif defined(__APPLE__) && defined(__x86_64__)
// Reserve space in the 32-bit address range for allocating TCB pages. // Reserve space in the 32-bit address range for allocating TCB pages.
asm(".zerofill TCB_SPACE,TCB_SPACE,__guest_system,0x3FC000"); asm(".zerofill TCB_SPACE,TCB_SPACE,__guest_system,0x3FC000");
@ -134,6 +132,17 @@ Tcb* GetTcbBase() {
return tcb; return tcb;
} }
#elif defined(__APPLE__) && defined(__aarch64__)
void SetTcbBase(void* image_address) {
LOG_INFO(Core_Linker, "TODO: SetTcbBase");
}
Tcb* GetTcbBase() {
LOG_INFO(Core_Linker, "TODO: GetTcbBase");
return 0;
}
#else #else
void SetTcbBase(void* image_address) { void SetTcbBase(void* image_address) {
@ -149,5 +158,3 @@ Tcb* GetTcbBase() {
#endif #endif
} // namespace Core } // namespace Core
#endif