early-access version 2524

This commit is contained in:
pineappleEA 2022-03-01 03:16:42 +01:00
parent 93aa93977d
commit 165c5792cc
10 changed files with 47 additions and 8 deletions

View file

@ -1,7 +1,7 @@
yuzu emulator early access
=============
This is the source code for early-access 2522.
This is the source code for early-access 2524.
## Legal Notice

View file

@ -61,6 +61,7 @@ void A32EmitX64::GenFastmemFallbacks() {
code.mov(Xbyak::Reg64{value_idx}, code.ABI_RETURN);
}
ABI_PopCallerSaveRegistersAndAdjustStackExcept(code, HostLocRegIdx(value_idx));
code.ZeroExtendFrom(bitsize, Xbyak::Reg64{value_idx});
code.ret();
PerfMapRegister(read_fallbacks[std::make_tuple(bitsize, vaddr_idx, value_idx)], code.getCurr(), fmt::format("a32_read_fallback_{}", bitsize));
}
@ -277,6 +278,7 @@ void A32EmitX64::EmitMemoryRead(A32EmitContext& ctx, IR::Inst* inst) {
// Neither fastmem nor page table: Use callbacks
ctx.reg_alloc.HostCall(inst, {}, args[0]);
Devirtualize<callback>(conf.callbacks).EmitCall(code);
code.ZeroExtendFrom(bitsize, code.ABI_RETURN);
return;
}
@ -422,6 +424,7 @@ void A32EmitX64::ExclusiveReadMemory(A32EmitContext& ctx, IR::Inst* inst) {
return (conf.callbacks->*callback)(vaddr);
});
});
code.ZeroExtendFrom(bitsize, code.ABI_RETURN);
}
template<size_t bitsize, auto callback>

View file

@ -140,6 +140,7 @@ void A64EmitX64::ClearCache() {
EmitX64::ClearCache();
block_ranges.ClearCache();
ClearFastDispatchTable();
fastmem_patch_info.clear();
}
void A64EmitX64::InvalidateCacheRanges(const boost::icl::interval_set<u64>& ranges) {

View file

@ -167,7 +167,7 @@ void A64EmitX64::GenFastmemFallbacks() {
code.align();
exclusive_write_fallbacks[std::make_tuple(128, vaddr_idx, value_idx)] = code.getCurr<void (*)()>();
ABI_PushCallerSaveRegistersAndAdjustStack(code);
ABI_PushCallerSaveRegistersAndAdjustStackExcept(code, HostLoc::RAX);
if (value_idx != 1) {
code.movaps(xmm1, Xbyak::Xmm{value_idx});
}
@ -183,7 +183,7 @@ void A64EmitX64::GenFastmemFallbacks() {
code.mov(code.ABI_PARAM2, Xbyak::Reg64{vaddr_idx});
}
code.call(memory_exclusive_write_128);
ABI_PopCallerSaveRegistersAndAdjustStack(code);
ABI_PopCallerSaveRegistersAndAdjustStackExcept(code, HostLoc::RAX);
code.ret();
PerfMapRegister(exclusive_write_fallbacks[std::make_tuple(128, vaddr_idx, value_idx)], code.getCurr(), "a64_write_fallback_128");
@ -203,6 +203,7 @@ void A64EmitX64::GenFastmemFallbacks() {
code.mov(Xbyak::Reg64{value_idx}, code.ABI_RETURN);
}
ABI_PopCallerSaveRegistersAndAdjustStackExcept(code, HostLocRegIdx(value_idx));
code.ZeroExtendFrom(bitsize, Xbyak::Reg64{value_idx});
code.ret();
PerfMapRegister(read_fallbacks[std::make_tuple(bitsize, vaddr_idx, value_idx)], code.getCurr(), fmt::format("a64_read_fallback_{}", bitsize));
}
@ -498,6 +499,7 @@ void A64EmitX64::EmitMemoryRead(A64EmitContext& ctx, IR::Inst* inst) {
} else {
ctx.reg_alloc.HostCall(inst, {}, args[0]);
Devirtualize<callback>(conf.callbacks).EmitCall(code);
code.ZeroExtendFrom(bitsize, code.ABI_RETURN);
}
return;
}
@ -668,6 +670,7 @@ void A64EmitX64::EmitExclusiveReadMemory(A64EmitContext& ctx, IR::Inst* inst) {
return (conf.callbacks->*callback)(vaddr);
});
});
code.ZeroExtendFrom(bitsize, code.ABI_RETURN);
} else {
const Xbyak::Xmm result = ctx.reg_alloc.ScratchXmm();
ctx.reg_alloc.Use(args[0], ABI_PARAM2);

View file

@ -96,6 +96,24 @@ public:
CallFunction(Common::FptrCast(l));
}
void ZeroExtendFrom(size_t bitsize, Xbyak::Reg64 reg) {
switch (bitsize) {
case 8:
movzx(reg.cvt32(), reg.cvt8());
return;
case 16:
movzx(reg.cvt32(), reg.cvt16());
return;
case 32:
mov(reg.cvt32(), reg.cvt32());
return;
case 64:
return;
default:
UNREACHABLE();
}
}
Xbyak::Address MConst(const Xbyak::AddressFrame& frame, u64 lower, u64 upper = 0);
/// Far code sits far away from the near code. Execution remains primarily in near code.

View file

@ -15,6 +15,7 @@ void EmitX64::EmitSM4AccessSubstitutionBox(EmitContext& ctx, IR::Inst* inst) {
ctx.reg_alloc.HostCall(inst, args[0]);
code.CallFunction(&Common::Crypto::SM4::AccessSubstitutionBox);
code.movzx(code.ABI_RETURN.cvt32(), code.ABI_RETURN.cvt8());
}
} // namespace Dynarmic::Backend::X64

View file

@ -397,7 +397,8 @@ static void RunTestInstance(Dynarmic::A32::Jit& jit,
if (uni.GetRegisters()[15] > jit.Regs()[15]) {
const u32 final_pc = jit.Regs()[15];
if (final_pc >= initial_pc && final_pc < expected_end_pc) {
int trials = 0;
while (final_pc >= initial_pc && final_pc < expected_end_pc && trials++ < 100) {
fmt::print("Warning: Possible unicorn overrrun, attempt recovery\n");
jit.Step();
}

View file

@ -214,6 +214,6 @@ else(WIN32)
set(FFmpeg_LDFLAGS "${FFmpeg_LDFLAGS}" PARENT_SCOPE)
set(FFmpeg_LIBRARIES "${FFmpeg_LIBRARIES}" PARENT_SCOPE)
set(FFmpeg_INCLUDE_DIR "${FFmpeg_INCLUDE_DIR}" PARENT_SCOPE)
endif(WIN32)
endif()
unset(FFmpeg_COMPONENTS)

View file

@ -310,7 +310,7 @@ public:
ResultCode GetAvailableMapRegion(Kernel::KPageTable& page_table, u64 size, VAddr& out_addr) {
size = Common::AlignUp(size, Kernel::PageSize);
size += page_table.GetNumGuardPages() * Kernel::PageSize * 2;
size += page_table.GetNumGuardPages() * Kernel::PageSize * 4;
auto is_region_available = [&](VAddr addr) {
const auto end_addr = addr + size;
@ -318,6 +318,19 @@ public:
if (system.Memory().IsValidVirtualAddress(addr)) {
return false;
}
if (!page_table.IsInsideAddressSpace(out_addr, size)) {
return false;
}
if (page_table.IsInsideHeapRegion(out_addr, size)) {
return false;
}
if (page_table.IsInsideAliasRegion(out_addr, size)) {
return false;
}
addr += Kernel::PageSize;
}
return true;

View file

@ -31,9 +31,8 @@ bool GLInnerFence::IsSignaled() const {
return true;
}
ASSERT(sync_object.handle != 0);
GLsizei length;
GLint sync_status;
glGetSynciv(sync_object.handle, GL_SYNC_STATUS, sizeof(GLint), &length, &sync_status);
glGetSynciv(sync_object.handle, GL_SYNC_STATUS, 1, nullptr, &sync_status);
return sync_status == GL_SIGNALED;
}