tls: Fix linux crash

This commit is contained in:
IndecisiveTurtle 2024-06-29 16:12:04 +03:00 committed by TheTurtle
parent 10ef357f1f
commit 114f06d3f2
2 changed files with 2 additions and 3 deletions

View File

@ -124,9 +124,9 @@ static void PatchFsAccess(u8* code, const TLSPattern& tls_pattern, Xbyak::CodeGe
const u32 idx1st = slot / PthreadKeySecondLevelSize;
const u32 idx2nd = slot % PthreadKeySecondLevelSize;
const auto target_reg = Xbyak::Reg64(tls_pattern.target_reg);
c.mov(target_reg, PthreadSpecificOffset);
c.putSeg(fs);
c.mov(target_reg,
qword[PthreadSpecificOffset + idx1st * 8]); // Load first level specific array.
c.mov(target_reg, qword[target_reg + idx1st * 8]); // Load first level specific array.
c.mov(target_reg, qword[target_reg + idx2nd * 16 +
8]); // Load data member of pthread_key_data our slot specifies.
c.jmp(code + total_size); // Return to the instruction right after the mov.

View File

@ -139,7 +139,6 @@ void Emulator::Run(const std::filesystem::path& file) {
}
void Emulator::LoadSystemModules(const std::filesystem::path& file) {
constexpr std::array<SysModules, 6> ModulesToLoad{
{{"libSceNgs2.sprx", nullptr},
{"libSceLibcInternal.sprx", &Libraries::LibcInternal::RegisterlibSceLibcInternal},