mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-08-15 21:19:47 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 360b6542a9 | |||
| 29e3a3a780 | |||
| 1ec388c01b | |||
| 54ce017b10 | |||
| 672432372d | |||
| 7e30579a7a | |||
| 01a616704b | |||
| 07031708ce | |||
| 600c8b5ab9 |
@@ -162,8 +162,7 @@ bool ArmNce::HandleGuestAccessFault(GuestContext* guest_ctx, void* raw_info, voi
|
|||||||
|
|
||||||
// Try to handle an invalid access.
|
// Try to handle an invalid access.
|
||||||
// TODO: handle accesses which split a page?
|
// TODO: handle accesses which split a page?
|
||||||
const Common::ProcessAddress addr =
|
const Common::ProcessAddress addr = u64(info->si_addr) & ~Memory::YUZU_PAGEMASK;
|
||||||
(reinterpret_cast<u64>(info->si_addr) & ~Memory::YUZU_PAGEMASK);
|
|
||||||
auto& memory = guest_ctx->parent->m_running_thread->GetOwnerProcess()->GetMemory();
|
auto& memory = guest_ctx->parent->m_running_thread->GetOwnerProcess()->GetMemory();
|
||||||
if (memory.InvalidateNCE(addr, Memory::YUZU_PAGESIZE)) {
|
if (memory.InvalidateNCE(addr, Memory::YUZU_PAGESIZE)) {
|
||||||
// We handled the access successfully and are returning to guest code.
|
// We handled the access successfully and are returning to guest code.
|
||||||
|
|||||||
+17
-19
@@ -737,10 +737,9 @@ struct Memory::Impl {
|
|||||||
PAddr last_address;
|
PAddr last_address;
|
||||||
};
|
};
|
||||||
|
|
||||||
void InvalidateGPUMemory(u8* p, size_t size) {
|
void InvalidateGPUMemory(u8* p, size_t size, bool flush) {
|
||||||
constexpr size_t sys_core = Core::Hardware::NUM_CPU_CORES - 1;
|
constexpr size_t sys_core = Core::Hardware::NUM_CPU_CORES - 1;
|
||||||
const size_t core = (std::min)(system.GetCurrentHostThreadID(),
|
const size_t core = (std::min)(system.GetCurrentHostThreadID(), sys_core); // any other calls threads go to syscore.
|
||||||
sys_core); // any other calls threads go to syscore.
|
|
||||||
if (!gpu_device_memory) [[unlikely]] {
|
if (!gpu_device_memory) [[unlikely]] {
|
||||||
gpu_device_memory = &system.Host1x().MemoryManager();
|
gpu_device_memory = &system.Host1x().MemoryManager();
|
||||||
}
|
}
|
||||||
@@ -754,8 +753,12 @@ struct Memory::Impl {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
auto& gpu = system.GPU();
|
auto& gpu = system.GPU();
|
||||||
gpu_device_memory->ApplyOpOnPointer(
|
gpu_device_memory->ApplyOpOnPointer(p, scratch_buffers[core], [&](DAddr addr) {
|
||||||
p, scratch_buffers[core], [&](DAddr address) { gpu.InvalidateRegion(address, size); });
|
if (flush) {
|
||||||
|
void(gpu.OnCPURead(addr, size));
|
||||||
|
}
|
||||||
|
gpu.InvalidateRegion(addr, size);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::System& system;
|
Core::System& system;
|
||||||
@@ -959,27 +962,22 @@ void Memory::MarkRegionDebug(Common::ProcessAddress vaddr, u64 size, bool debug)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Memory::InvalidateNCE(Common::ProcessAddress vaddr, size_t size) {
|
bool Memory::InvalidateNCE(Common::ProcessAddress vaddr, size_t size) {
|
||||||
[[maybe_unused]] bool mapped = true;
|
bool mapped = true;
|
||||||
[[maybe_unused]] bool rasterizer = false;
|
bool rasterizer = false;
|
||||||
|
u8* const ptr = impl->GetPointerImpl(GetInteger(vaddr), [&] {
|
||||||
u8* const ptr = impl->GetPointerImpl(
|
LOG_ERROR(HW_Memory, "Unmapped InvalidateNCE for {} bytes @ {:#x}", size, GetInteger(vaddr));
|
||||||
GetInteger(vaddr),
|
mapped = false;
|
||||||
[&] {
|
}, [&] {
|
||||||
LOG_ERROR(HW_Memory, "Unmapped InvalidateNCE for {} bytes @ {:#x}", size,
|
rasterizer = true;
|
||||||
GetInteger(vaddr));
|
});
|
||||||
mapped = false;
|
|
||||||
},
|
|
||||||
[&] { rasterizer = true; });
|
|
||||||
if (rasterizer) {
|
if (rasterizer) {
|
||||||
impl->InvalidateGPUMemory(ptr, size);
|
impl->InvalidateGPUMemory(ptr, size, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
if (!rasterizer && mapped) {
|
if (!rasterizer && mapped) {
|
||||||
impl->host_buffer->DeferredMapSeparateHeap(GetInteger(vaddr));
|
impl->host_buffer->DeferredMapSeparateHeap(GetInteger(vaddr));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return mapped && ptr != nullptr;
|
return mapped && ptr != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
|
|||||||
Reference in New Issue
Block a user