mirror of
https://github.com/pineappleEA/pineapple-src.git
synced 2024-11-25 16:18:24 -05:00
early-access version 1725
This commit is contained in:
parent
b9f5baa9ef
commit
b09a4af601
@ -1,7 +1,7 @@
|
||||
yuzu emulator early access
|
||||
=============
|
||||
|
||||
This is the source code for early-access 1722.
|
||||
This is the source code for early-access 1725.
|
||||
|
||||
## Legal Notice
|
||||
|
||||
|
@ -14,6 +14,7 @@ void PageTable::Resize(size_t address_space_width_in_bits, size_t page_size_in_b
|
||||
const size_t num_page_table_entries{1ULL << (address_space_width_in_bits - page_size_in_bits)};
|
||||
pointers.resize(num_page_table_entries);
|
||||
backing_addr.resize(num_page_table_entries);
|
||||
current_address_space_width_in_bits = address_space_width_in_bits;
|
||||
}
|
||||
|
||||
} // namespace Common
|
||||
|
@ -98,6 +98,10 @@ struct PageTable {
|
||||
*/
|
||||
void Resize(size_t address_space_width_in_bits, size_t page_size_in_bits);
|
||||
|
||||
size_t GetAddressSpaceBits() const {
|
||||
return current_address_space_width_in_bits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Vector of memory pointers backing each page. An entry can only be non-null if the
|
||||
* corresponding attribute element is of type `Memory`.
|
||||
@ -105,6 +109,8 @@ struct PageTable {
|
||||
VirtualBuffer<PageInfo> pointers;
|
||||
|
||||
VirtualBuffer<u64> backing_addr;
|
||||
|
||||
size_t current_address_space_width_in_bits;
|
||||
};
|
||||
|
||||
} // namespace Common
|
||||
|
@ -24,45 +24,46 @@ namespace Core {
|
||||
|
||||
class DynarmicCallbacks32 : public Dynarmic::A32::UserCallbacks {
|
||||
public:
|
||||
explicit DynarmicCallbacks32(ARM_Dynarmic_32& parent_) : parent{parent_} {}
|
||||
explicit DynarmicCallbacks32(ARM_Dynarmic_32& parent_)
|
||||
: parent{parent_}, memory(parent.system.Memory()) {}
|
||||
|
||||
u8 MemoryRead8(u32 vaddr) override {
|
||||
return parent.system.Memory().Read8(vaddr);
|
||||
return memory.Read8(vaddr);
|
||||
}
|
||||
u16 MemoryRead16(u32 vaddr) override {
|
||||
return parent.system.Memory().Read16(vaddr);
|
||||
return memory.Read16(vaddr);
|
||||
}
|
||||
u32 MemoryRead32(u32 vaddr) override {
|
||||
return parent.system.Memory().Read32(vaddr);
|
||||
return memory.Read32(vaddr);
|
||||
}
|
||||
u64 MemoryRead64(u32 vaddr) override {
|
||||
return parent.system.Memory().Read64(vaddr);
|
||||
return memory.Read64(vaddr);
|
||||
}
|
||||
|
||||
void MemoryWrite8(u32 vaddr, u8 value) override {
|
||||
parent.system.Memory().Write8(vaddr, value);
|
||||
memory.Write8(vaddr, value);
|
||||
}
|
||||
void MemoryWrite16(u32 vaddr, u16 value) override {
|
||||
parent.system.Memory().Write16(vaddr, value);
|
||||
memory.Write16(vaddr, value);
|
||||
}
|
||||
void MemoryWrite32(u32 vaddr, u32 value) override {
|
||||
parent.system.Memory().Write32(vaddr, value);
|
||||
memory.Write32(vaddr, value);
|
||||
}
|
||||
void MemoryWrite64(u32 vaddr, u64 value) override {
|
||||
parent.system.Memory().Write64(vaddr, value);
|
||||
memory.Write64(vaddr, value);
|
||||
}
|
||||
|
||||
bool MemoryWriteExclusive8(u32 vaddr, u8 value, u8 expected) override {
|
||||
return parent.system.Memory().WriteExclusive8(vaddr, value, expected);
|
||||
return memory.WriteExclusive8(vaddr, value, expected);
|
||||
}
|
||||
bool MemoryWriteExclusive16(u32 vaddr, u16 value, u16 expected) override {
|
||||
return parent.system.Memory().WriteExclusive16(vaddr, value, expected);
|
||||
return memory.WriteExclusive16(vaddr, value, expected);
|
||||
}
|
||||
bool MemoryWriteExclusive32(u32 vaddr, u32 value, u32 expected) override {
|
||||
return parent.system.Memory().WriteExclusive32(vaddr, value, expected);
|
||||
return memory.WriteExclusive32(vaddr, value, expected);
|
||||
}
|
||||
bool MemoryWriteExclusive64(u32 vaddr, u64 value, u64 expected) override {
|
||||
return parent.system.Memory().WriteExclusive64(vaddr, value, expected);
|
||||
return memory.WriteExclusive64(vaddr, value, expected);
|
||||
}
|
||||
|
||||
void InterpreterFallback(u32 pc, std::size_t num_instructions) override {
|
||||
@ -112,6 +113,7 @@ public:
|
||||
}
|
||||
|
||||
ARM_Dynarmic_32& parent;
|
||||
Core::Memory::Memory& memory;
|
||||
std::size_t num_interpreted_instructions{};
|
||||
static constexpr u64 minimum_run_cycles = 1000U;
|
||||
};
|
||||
|
@ -27,57 +27,56 @@ using Vector = Dynarmic::A64::Vector;
|
||||
|
||||
class DynarmicCallbacks64 : public Dynarmic::A64::UserCallbacks {
|
||||
public:
|
||||
explicit DynarmicCallbacks64(ARM_Dynarmic_64& parent_) : parent{parent_} {}
|
||||
explicit DynarmicCallbacks64(ARM_Dynarmic_64& parent_)
|
||||
: parent{parent_}, memory(parent.system.Memory()) {}
|
||||
|
||||
u8 MemoryRead8(u64 vaddr) override {
|
||||
return parent.system.Memory().Read8(vaddr);
|
||||
return memory.Read8(vaddr);
|
||||
}
|
||||
u16 MemoryRead16(u64 vaddr) override {
|
||||
return parent.system.Memory().Read16(vaddr);
|
||||
return memory.Read16(vaddr);
|
||||
}
|
||||
u32 MemoryRead32(u64 vaddr) override {
|
||||
return parent.system.Memory().Read32(vaddr);
|
||||
return memory.Read32(vaddr);
|
||||
}
|
||||
u64 MemoryRead64(u64 vaddr) override {
|
||||
return parent.system.Memory().Read64(vaddr);
|
||||
return memory.Read64(vaddr);
|
||||
}
|
||||
Vector MemoryRead128(u64 vaddr) override {
|
||||
auto& memory = parent.system.Memory();
|
||||
return {memory.Read64(vaddr), memory.Read64(vaddr + 8)};
|
||||
}
|
||||
|
||||
void MemoryWrite8(u64 vaddr, u8 value) override {
|
||||
parent.system.Memory().Write8(vaddr, value);
|
||||
memory.Write8(vaddr, value);
|
||||
}
|
||||
void MemoryWrite16(u64 vaddr, u16 value) override {
|
||||
parent.system.Memory().Write16(vaddr, value);
|
||||
memory.Write16(vaddr, value);
|
||||
}
|
||||
void MemoryWrite32(u64 vaddr, u32 value) override {
|
||||
parent.system.Memory().Write32(vaddr, value);
|
||||
memory.Write32(vaddr, value);
|
||||
}
|
||||
void MemoryWrite64(u64 vaddr, u64 value) override {
|
||||
parent.system.Memory().Write64(vaddr, value);
|
||||
memory.Write64(vaddr, value);
|
||||
}
|
||||
void MemoryWrite128(u64 vaddr, Vector value) override {
|
||||
auto& memory = parent.system.Memory();
|
||||
memory.Write64(vaddr, value[0]);
|
||||
memory.Write64(vaddr + 8, value[1]);
|
||||
}
|
||||
|
||||
bool MemoryWriteExclusive8(u64 vaddr, std::uint8_t value, std::uint8_t expected) override {
|
||||
return parent.system.Memory().WriteExclusive8(vaddr, value, expected);
|
||||
return memory.WriteExclusive8(vaddr, value, expected);
|
||||
}
|
||||
bool MemoryWriteExclusive16(u64 vaddr, std::uint16_t value, std::uint16_t expected) override {
|
||||
return parent.system.Memory().WriteExclusive16(vaddr, value, expected);
|
||||
return memory.WriteExclusive16(vaddr, value, expected);
|
||||
}
|
||||
bool MemoryWriteExclusive32(u64 vaddr, std::uint32_t value, std::uint32_t expected) override {
|
||||
return parent.system.Memory().WriteExclusive32(vaddr, value, expected);
|
||||
return memory.WriteExclusive32(vaddr, value, expected);
|
||||
}
|
||||
bool MemoryWriteExclusive64(u64 vaddr, std::uint64_t value, std::uint64_t expected) override {
|
||||
return parent.system.Memory().WriteExclusive64(vaddr, value, expected);
|
||||
return memory.WriteExclusive64(vaddr, value, expected);
|
||||
}
|
||||
bool MemoryWriteExclusive128(u64 vaddr, Vector value, Vector expected) override {
|
||||
return parent.system.Memory().WriteExclusive128(vaddr, value, expected);
|
||||
return memory.WriteExclusive128(vaddr, value, expected);
|
||||
}
|
||||
|
||||
void InterpreterFallback(u64 pc, std::size_t num_instructions) override {
|
||||
@ -139,6 +138,7 @@ public:
|
||||
}
|
||||
|
||||
ARM_Dynarmic_64& parent;
|
||||
Core::Memory::Memory& memory;
|
||||
u64 tpidrro_el0 = 0;
|
||||
u64 tpidr_el0 = 0;
|
||||
static constexpr u64 minimum_run_cycles = 1000U;
|
||||
|
@ -22,7 +22,7 @@ class KClientPort final : public KSynchronizationObject {
|
||||
|
||||
public:
|
||||
explicit KClientPort(KernelCore& kernel_);
|
||||
virtual ~KClientPort() override;
|
||||
~KClientPort() override;
|
||||
|
||||
void Initialize(KPort* parent_, s32 max_sessions_, std::string&& name_);
|
||||
void OnSessionFinalized();
|
||||
@ -49,8 +49,8 @@ public:
|
||||
bool IsServerClosed() const;
|
||||
|
||||
// Overridden virtual functions.
|
||||
virtual void Destroy() override;
|
||||
virtual bool IsSignaled() const override;
|
||||
void Destroy() override;
|
||||
bool IsSignaled() const override;
|
||||
|
||||
ResultCode CreateSession(KClientSession** out);
|
||||
|
||||
|
@ -34,7 +34,7 @@ class KClientSession final
|
||||
|
||||
public:
|
||||
explicit KClientSession(KernelCore& kernel_);
|
||||
virtual ~KClientSession();
|
||||
~KClientSession() override;
|
||||
|
||||
void Initialize(KSession* parent_, std::string&& name_) {
|
||||
// Set member variables.
|
||||
@ -42,7 +42,7 @@ public:
|
||||
name = std::move(name_);
|
||||
}
|
||||
|
||||
virtual void Destroy() override;
|
||||
void Destroy() override;
|
||||
static void PostDestroy([[maybe_unused]] uintptr_t arg) {}
|
||||
|
||||
KSession* GetParent() const {
|
||||
|
@ -20,23 +20,21 @@ class KEvent final : public KAutoObjectWithSlabHeapAndContainer<KEvent, KAutoObj
|
||||
|
||||
public:
|
||||
explicit KEvent(KernelCore& kernel_);
|
||||
virtual ~KEvent();
|
||||
~KEvent() override;
|
||||
|
||||
void Initialize(std::string&& name);
|
||||
|
||||
virtual void Finalize() override;
|
||||
void Finalize() override;
|
||||
|
||||
virtual bool IsInitialized() const override {
|
||||
bool IsInitialized() const override {
|
||||
return initialized;
|
||||
}
|
||||
|
||||
virtual uintptr_t GetPostDestroyArgument() const override {
|
||||
uintptr_t GetPostDestroyArgument() const override {
|
||||
return reinterpret_cast<uintptr_t>(owner);
|
||||
}
|
||||
|
||||
static void PostDestroy(uintptr_t arg);
|
||||
|
||||
virtual KProcess* GetOwner() const override {
|
||||
KProcess* GetOwner() const override {
|
||||
return owner;
|
||||
}
|
||||
|
||||
@ -48,6 +46,8 @@ public:
|
||||
return writable_event;
|
||||
}
|
||||
|
||||
static void PostDestroy(uintptr_t arg);
|
||||
|
||||
private:
|
||||
KReadableEvent readable_event;
|
||||
KWritableEvent writable_event;
|
||||
|
@ -22,7 +22,7 @@ class KPort final : public KAutoObjectWithSlabHeapAndContainer<KPort, KAutoObjec
|
||||
|
||||
public:
|
||||
explicit KPort(KernelCore& kernel_);
|
||||
virtual ~KPort();
|
||||
~KPort() override;
|
||||
|
||||
static void PostDestroy([[maybe_unused]] uintptr_t arg) {}
|
||||
|
||||
@ -59,7 +59,6 @@ private:
|
||||
ServerClosed = 3,
|
||||
};
|
||||
|
||||
private:
|
||||
KServerPort server;
|
||||
KClientPort client;
|
||||
State state{State::Invalid};
|
||||
|
@ -331,19 +331,19 @@ public:
|
||||
|
||||
void LoadModule(CodeSet code_set, VAddr base_addr);
|
||||
|
||||
virtual bool IsInitialized() const override {
|
||||
bool IsInitialized() const override {
|
||||
return is_initialized;
|
||||
}
|
||||
|
||||
static void PostDestroy([[maybe_unused]] uintptr_t arg) {}
|
||||
|
||||
virtual void Finalize();
|
||||
void Finalize() override;
|
||||
|
||||
virtual u64 GetId() const override final {
|
||||
u64 GetId() const override {
|
||||
return GetProcessID();
|
||||
}
|
||||
|
||||
virtual bool IsSignaled() const override;
|
||||
bool IsSignaled() const override;
|
||||
|
||||
void PinCurrentThread();
|
||||
void UnpinCurrentThread();
|
||||
|
@ -31,8 +31,8 @@ public:
|
||||
return parent;
|
||||
}
|
||||
|
||||
virtual bool IsSignaled() const override;
|
||||
virtual void Destroy() override;
|
||||
bool IsSignaled() const override;
|
||||
void Destroy() override;
|
||||
|
||||
ResultCode Signal();
|
||||
ResultCode Clear();
|
||||
|
@ -37,10 +37,10 @@ class KResourceLimit final
|
||||
|
||||
public:
|
||||
explicit KResourceLimit(KernelCore& kernel_);
|
||||
virtual ~KResourceLimit();
|
||||
~KResourceLimit() override;
|
||||
|
||||
void Initialize(const Core::Timing::CoreTiming* core_timing_);
|
||||
virtual void Finalize() override;
|
||||
void Finalize() override;
|
||||
|
||||
s64 GetLimitValue(LimitableResource which) const;
|
||||
s64 GetCurrentValue(LimitableResource which) const;
|
||||
|
@ -25,12 +25,9 @@ class SessionRequestHandler;
|
||||
class KServerPort final : public KSynchronizationObject {
|
||||
KERNEL_AUTOOBJECT_TRAITS(KServerPort, KSynchronizationObject);
|
||||
|
||||
private:
|
||||
using SessionList = boost::intrusive::list<KServerSession>;
|
||||
|
||||
public:
|
||||
explicit KServerPort(KernelCore& kernel_);
|
||||
virtual ~KServerPort() override;
|
||||
~KServerPort() override;
|
||||
|
||||
void Initialize(KPort* parent_, std::string&& name_);
|
||||
|
||||
@ -63,13 +60,14 @@ public:
|
||||
bool IsLight() const;
|
||||
|
||||
// Overridden virtual functions.
|
||||
virtual void Destroy() override;
|
||||
virtual bool IsSignaled() const override;
|
||||
void Destroy() override;
|
||||
bool IsSignaled() const override;
|
||||
|
||||
private:
|
||||
using SessionList = boost::intrusive::list<KServerSession>;
|
||||
|
||||
void CleanupSessions();
|
||||
|
||||
private:
|
||||
SessionList session_list;
|
||||
SessionRequestHandlerPtr session_handler;
|
||||
KPort* parent{};
|
||||
|
@ -42,9 +42,9 @@ class KServerSession final : public KSynchronizationObject,
|
||||
|
||||
public:
|
||||
explicit KServerSession(KernelCore& kernel_);
|
||||
virtual ~KServerSession() override;
|
||||
~KServerSession() override;
|
||||
|
||||
virtual void Destroy() override;
|
||||
void Destroy() override;
|
||||
|
||||
void Initialize(KSession* parent_, std::string&& name_);
|
||||
|
||||
@ -56,7 +56,7 @@ public:
|
||||
return parent;
|
||||
}
|
||||
|
||||
virtual bool IsSignaled() const override;
|
||||
bool IsSignaled() const override;
|
||||
|
||||
void OnClientClosed();
|
||||
|
||||
|
@ -18,17 +18,17 @@ class KSession final : public KAutoObjectWithSlabHeapAndContainer<KSession, KAut
|
||||
|
||||
public:
|
||||
explicit KSession(KernelCore& kernel_);
|
||||
virtual ~KSession() override;
|
||||
~KSession() override;
|
||||
|
||||
void Initialize(KClientPort* port_, const std::string& name_);
|
||||
|
||||
virtual void Finalize() override;
|
||||
void Finalize() override;
|
||||
|
||||
virtual bool IsInitialized() const override {
|
||||
bool IsInitialized() const override {
|
||||
return initialized;
|
||||
}
|
||||
|
||||
virtual uintptr_t GetPostDestroyArgument() const override {
|
||||
uintptr_t GetPostDestroyArgument() const override {
|
||||
return reinterpret_cast<uintptr_t>(process);
|
||||
}
|
||||
|
||||
@ -78,7 +78,6 @@ private:
|
||||
ServerClosed = 3,
|
||||
};
|
||||
|
||||
private:
|
||||
void SetState(State state) {
|
||||
atomic_state = static_cast<u8>(state);
|
||||
}
|
||||
@ -87,7 +86,6 @@ private:
|
||||
return static_cast<State>(atomic_state.load(std::memory_order_relaxed));
|
||||
}
|
||||
|
||||
private:
|
||||
KServerSession server;
|
||||
KClientSession client;
|
||||
std::atomic<std::underlying_type_t<State>> atomic_state{
|
||||
|
@ -68,9 +68,9 @@ public:
|
||||
return device_memory->GetPointer(physical_address + offset);
|
||||
}
|
||||
|
||||
virtual void Finalize() override;
|
||||
void Finalize() override;
|
||||
|
||||
virtual bool IsInitialized() const override {
|
||||
bool IsInitialized() const override {
|
||||
return is_initialized;
|
||||
}
|
||||
static void PostDestroy([[maybe_unused]] uintptr_t arg) {}
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
KSynchronizationObject** objects, const s32 num_objects,
|
||||
s64 timeout);
|
||||
|
||||
virtual void Finalize() override;
|
||||
void Finalize() override;
|
||||
|
||||
[[nodiscard]] virtual bool IsSignaled() const = 0;
|
||||
|
||||
@ -37,7 +37,7 @@ public:
|
||||
|
||||
protected:
|
||||
explicit KSynchronizationObject(KernelCore& kernel);
|
||||
virtual ~KSynchronizationObject();
|
||||
~KSynchronizationObject() override;
|
||||
|
||||
virtual void OnFinalizeSynchronizationObject() {}
|
||||
|
||||
|
@ -168,13 +168,13 @@ ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_s
|
||||
std::memset(static_cast<void*>(std::addressof(GetStackParameters())), 0,
|
||||
sizeof(StackParameters));
|
||||
|
||||
// Setup the TLS, if needed.
|
||||
if (type == ThreadType::User) {
|
||||
tls_address = owner->CreateTLSRegion();
|
||||
}
|
||||
|
||||
// Set parent, if relevant.
|
||||
if (owner != nullptr) {
|
||||
// Setup the TLS, if needed.
|
||||
if (type == ThreadType::User) {
|
||||
tls_address = owner->CreateTLSRegion();
|
||||
}
|
||||
|
||||
parent = owner;
|
||||
parent->Open();
|
||||
parent->IncrementThreadCount();
|
||||
|
@ -358,21 +358,21 @@ public:
|
||||
return termination_requested || GetRawState() == ThreadState::Terminated;
|
||||
}
|
||||
|
||||
[[nodiscard]] virtual u64 GetId() const override final {
|
||||
[[nodiscard]] u64 GetId() const override {
|
||||
return this->GetThreadID();
|
||||
}
|
||||
|
||||
[[nodiscard]] virtual bool IsInitialized() const override {
|
||||
[[nodiscard]] bool IsInitialized() const override {
|
||||
return initialized;
|
||||
}
|
||||
|
||||
[[nodiscard]] virtual uintptr_t GetPostDestroyArgument() const override {
|
||||
[[nodiscard]] uintptr_t GetPostDestroyArgument() const override {
|
||||
return reinterpret_cast<uintptr_t>(parent) | (resource_limit_release_hint ? 1 : 0);
|
||||
}
|
||||
|
||||
virtual void Finalize() override;
|
||||
void Finalize() override;
|
||||
|
||||
[[nodiscard]] virtual bool IsSignaled() const override;
|
||||
[[nodiscard]] bool IsSignaled() const override;
|
||||
|
||||
static void PostDestroy(uintptr_t arg);
|
||||
|
||||
|
@ -27,23 +27,23 @@ class KTransferMemory final
|
||||
|
||||
public:
|
||||
explicit KTransferMemory(KernelCore& kernel_);
|
||||
virtual ~KTransferMemory() override;
|
||||
~KTransferMemory() override;
|
||||
|
||||
ResultCode Initialize(VAddr address_, std::size_t size_, Svc::MemoryPermission owner_perm_);
|
||||
|
||||
virtual void Finalize() override;
|
||||
void Finalize() override;
|
||||
|
||||
virtual bool IsInitialized() const override {
|
||||
bool IsInitialized() const override {
|
||||
return is_initialized;
|
||||
}
|
||||
|
||||
virtual uintptr_t GetPostDestroyArgument() const override {
|
||||
uintptr_t GetPostDestroyArgument() const override {
|
||||
return reinterpret_cast<uintptr_t>(owner);
|
||||
}
|
||||
|
||||
static void PostDestroy(uintptr_t arg);
|
||||
|
||||
KProcess* GetOwner() const {
|
||||
KProcess* GetOwner() const override {
|
||||
return owner;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
explicit KWritableEvent(KernelCore& kernel_);
|
||||
~KWritableEvent() override;
|
||||
|
||||
virtual void Destroy() override;
|
||||
void Destroy() override;
|
||||
|
||||
static void PostDestroy([[maybe_unused]] uintptr_t arg) {}
|
||||
|
||||
|
@ -591,7 +591,15 @@ struct Memory::Impl {
|
||||
* @returns The instance of T read from the specified virtual address.
|
||||
*/
|
||||
template <typename T>
|
||||
T Read(const VAddr vaddr) {
|
||||
T Read(VAddr vaddr) {
|
||||
// AARCH64 masks the upper 16 bit of all memory accesses
|
||||
vaddr &= 0xffffffffffffLL;
|
||||
|
||||
if (vaddr >= 1uLL << current_page_table->GetAddressSpaceBits()) {
|
||||
LOG_ERROR(HW_Memory, "Unmapped Read{} @ 0x{:08X}", sizeof(T) * 8, vaddr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Avoid adding any extra logic to this fast-path block
|
||||
const uintptr_t raw_pointer = current_page_table->pointers[vaddr >> PAGE_BITS].Raw();
|
||||
if (const u8* const pointer = Common::PageTable::PageInfo::ExtractPointer(raw_pointer)) {
|
||||
@ -629,7 +637,16 @@ struct Memory::Impl {
|
||||
* is undefined.
|
||||
*/
|
||||
template <typename T>
|
||||
void Write(const VAddr vaddr, const T data) {
|
||||
void Write(VAddr vaddr, const T data) {
|
||||
// AARCH64 masks the upper 16 bit of all memory accesses
|
||||
vaddr &= 0xffffffffffffLL;
|
||||
|
||||
if (vaddr >= 1uLL << current_page_table->GetAddressSpaceBits()) {
|
||||
LOG_ERROR(HW_Memory, "Unmapped Write{} 0x{:08X} @ 0x{:016X}", sizeof(data) * 8,
|
||||
static_cast<u32>(data), vaddr);
|
||||
return;
|
||||
}
|
||||
|
||||
// Avoid adding any extra logic to this fast-path block
|
||||
const uintptr_t raw_pointer = current_page_table->pointers[vaddr >> PAGE_BITS].Raw();
|
||||
if (u8* const pointer = Common::PageTable::PageInfo::ExtractPointer(raw_pointer)) {
|
||||
@ -656,7 +673,16 @@ struct Memory::Impl {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool WriteExclusive(const VAddr vaddr, const T data, const T expected) {
|
||||
bool WriteExclusive(VAddr vaddr, const T data, const T expected) {
|
||||
// AARCH64 masks the upper 16 bit of all memory accesses
|
||||
vaddr &= 0xffffffffffffLL;
|
||||
|
||||
if (vaddr >= 1uLL << current_page_table->GetAddressSpaceBits()) {
|
||||
LOG_ERROR(HW_Memory, "Unmapped Write{} 0x{:08X} @ 0x{:016X}", sizeof(data) * 8,
|
||||
static_cast<u32>(data), vaddr);
|
||||
return true;
|
||||
}
|
||||
|
||||
const uintptr_t raw_pointer = current_page_table->pointers[vaddr >> PAGE_BITS].Raw();
|
||||
if (u8* const pointer = Common::PageTable::PageInfo::ExtractPointer(raw_pointer)) {
|
||||
// NOTE: Avoid adding any extra logic to this fast-path block
|
||||
@ -683,7 +709,16 @@ struct Memory::Impl {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WriteExclusive128(const VAddr vaddr, const u128 data, const u128 expected) {
|
||||
bool WriteExclusive128(VAddr vaddr, const u128 data, const u128 expected) {
|
||||
// AARCH64 masks the upper 16 bit of all memory accesses
|
||||
vaddr &= 0xffffffffffffLL;
|
||||
|
||||
if (vaddr >= 1uLL << current_page_table->GetAddressSpaceBits()) {
|
||||
LOG_ERROR(HW_Memory, "Unmapped Write{} 0x{:08X} @ 0x{:016X}", sizeof(data) * 8,
|
||||
static_cast<u32>(data[0]), vaddr);
|
||||
return true;
|
||||
}
|
||||
|
||||
const uintptr_t raw_pointer = current_page_table->pointers[vaddr >> PAGE_BITS].Raw();
|
||||
if (u8* const pointer = Common::PageTable::PageInfo::ExtractPointer(raw_pointer)) {
|
||||
// NOTE: Avoid adding any extra logic to this fast-path block
|
||||
|
@ -104,7 +104,13 @@ void GPU::WaitFence(u32 syncpoint_id, u32 value) {
|
||||
}
|
||||
MICROPROFILE_SCOPE(GPU_wait);
|
||||
std::unique_lock lock{sync_mutex};
|
||||
sync_cv.wait(lock, [=, this] { return syncpoints.at(syncpoint_id).load() >= value; });
|
||||
sync_cv.wait(lock, [=, this] {
|
||||
if (shutting_down.load(std::memory_order_relaxed)) {
|
||||
// We're shutting down, ensure no threads continue to wait for the next syncpoint
|
||||
return true;
|
||||
}
|
||||
return syncpoints.at(syncpoint_id).load() >= value;
|
||||
});
|
||||
}
|
||||
|
||||
void GPU::IncrementSyncPoint(const u32 syncpoint_id) {
|
||||
@ -523,6 +529,10 @@ void GPU::TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const {
|
||||
}
|
||||
|
||||
void GPU::ShutDown() {
|
||||
// Signal that threads should no longer block on syncpoint fences
|
||||
shutting_down.store(true, std::memory_order_relaxed);
|
||||
sync_cv.notify_all();
|
||||
|
||||
gpu_thread.ShutDown();
|
||||
}
|
||||
|
||||
|
@ -389,6 +389,8 @@ private:
|
||||
std::unique_ptr<Engines::KeplerMemory> kepler_memory;
|
||||
/// Shader build notifier
|
||||
std::unique_ptr<VideoCore::ShaderNotify> shader_notify;
|
||||
/// When true, we are about to shut down emulation session, so terminate outstanding tasks
|
||||
std::atomic_bool shutting_down{};
|
||||
|
||||
std::array<std::atomic<u32>, Service::Nvidia::MaxSyncPoints> syncpoints{};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user