mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
ARM: Addapt to new Exclusive Monitor Interface.
This commit is contained in:
parent
1a5f2e290b
commit
25565dffd5
5 changed files with 24 additions and 31 deletions
|
@ -180,8 +180,6 @@ std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable&
|
||||||
return std::make_shared<Dynarmic::A64::Jit>(config);
|
return std::make_shared<Dynarmic::A64::Jit>(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ARM_Dynarmic_64::Run() {
|
void ARM_Dynarmic_64::Run() {
|
||||||
jit->Run();
|
jit->Run();
|
||||||
}
|
}
|
||||||
|
@ -297,24 +295,24 @@ DynarmicExclusiveMonitor::DynarmicExclusiveMonitor(Memory::Memory& memory, std::
|
||||||
|
|
||||||
DynarmicExclusiveMonitor::~DynarmicExclusiveMonitor() = default;
|
DynarmicExclusiveMonitor::~DynarmicExclusiveMonitor() = default;
|
||||||
|
|
||||||
void DynarmicExclusiveMonitor::SetExclusive8(std::size_t core_index, VAddr addr) {
|
u8 DynarmicExclusiveMonitor::ExclusiveRead8(std::size_t core_index, VAddr addr) {
|
||||||
monitor.Mark<u8>(core_index, addr, 1, [&]() -> u8 { return memory.Read8(addr); });
|
return monitor.ReadAndMark<u8>(core_index, addr, [&]() -> u8 { return memory.Read8(addr); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynarmicExclusiveMonitor::SetExclusive16(std::size_t core_index, VAddr addr) {
|
u16 DynarmicExclusiveMonitor::ExclusiveRead16(std::size_t core_index, VAddr addr) {
|
||||||
monitor.Mark<u16>(core_index, addr, 2, [&]() -> u16 { return memory.Read16(addr); });
|
return monitor.ReadAndMark<u16>(core_index, addr, [&]() -> u16 { return memory.Read16(addr); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynarmicExclusiveMonitor::SetExclusive32(std::size_t core_index, VAddr addr) {
|
u32 DynarmicExclusiveMonitor::ExclusiveRead32(std::size_t core_index, VAddr addr) {
|
||||||
monitor.Mark<u32>(core_index, addr, 4, [&]() -> u32 { return memory.Read32(addr); });
|
return monitor.ReadAndMark<u32>(core_index, addr, [&]() -> u32 { return memory.Read32(addr); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynarmicExclusiveMonitor::SetExclusive64(std::size_t core_index, VAddr addr) {
|
u64 DynarmicExclusiveMonitor::ExclusiveRead64(std::size_t core_index, VAddr addr) {
|
||||||
monitor.Mark<u64>(core_index, addr, 8, [&]() -> u64 { return memory.Read64(addr); });
|
return monitor.ReadAndMark<u64>(core_index, addr, [&]() -> u64 { return memory.Read64(addr); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynarmicExclusiveMonitor::SetExclusive128(std::size_t core_index, VAddr addr) {
|
u128 DynarmicExclusiveMonitor::ExclusiveRead128(std::size_t core_index, VAddr addr) {
|
||||||
monitor.Mark<u128>(core_index, addr, 16, [&]() -> u128 {
|
return monitor.ReadAndMark<u128>(core_index, addr, [&]() -> u128 {
|
||||||
u128 result;
|
u128 result;
|
||||||
result[0] = memory.Read64(addr);
|
result[0] = memory.Read64(addr);
|
||||||
result[1] = memory.Read64(addr + 8);
|
result[1] = memory.Read64(addr + 8);
|
||||||
|
|
|
@ -82,11 +82,11 @@ public:
|
||||||
explicit DynarmicExclusiveMonitor(Memory::Memory& memory, std::size_t core_count);
|
explicit DynarmicExclusiveMonitor(Memory::Memory& memory, std::size_t core_count);
|
||||||
~DynarmicExclusiveMonitor() override;
|
~DynarmicExclusiveMonitor() override;
|
||||||
|
|
||||||
void SetExclusive8(std::size_t core_index, VAddr addr) override;
|
u8 ExclusiveRead8(std::size_t core_index, VAddr addr) override;
|
||||||
void SetExclusive16(std::size_t core_index, VAddr addr) override;
|
u16 ExclusiveRead16(std::size_t core_index, VAddr addr) override;
|
||||||
void SetExclusive32(std::size_t core_index, VAddr addr) override;
|
u32 ExclusiveRead32(std::size_t core_index, VAddr addr) override;
|
||||||
void SetExclusive64(std::size_t core_index, VAddr addr) override;
|
u64 ExclusiveRead64(std::size_t core_index, VAddr addr) override;
|
||||||
void SetExclusive128(std::size_t core_index, VAddr addr) override;
|
u128 ExclusiveRead128(std::size_t core_index, VAddr addr) override;
|
||||||
void ClearExclusive() override;
|
void ClearExclusive() override;
|
||||||
|
|
||||||
bool ExclusiveWrite8(std::size_t core_index, VAddr vaddr, u8 value) override;
|
bool ExclusiveWrite8(std::size_t core_index, VAddr vaddr, u8 value) override;
|
||||||
|
|
|
@ -18,11 +18,11 @@ class ExclusiveMonitor {
|
||||||
public:
|
public:
|
||||||
virtual ~ExclusiveMonitor();
|
virtual ~ExclusiveMonitor();
|
||||||
|
|
||||||
virtual void SetExclusive8(std::size_t core_index, VAddr addr) = 0;
|
virtual u8 ExclusiveRead8(std::size_t core_index, VAddr addr) = 0;
|
||||||
virtual void SetExclusive16(std::size_t core_index, VAddr addr) = 0;
|
virtual u16 ExclusiveRead16(std::size_t core_index, VAddr addr) = 0;
|
||||||
virtual void SetExclusive32(std::size_t core_index, VAddr addr) = 0;
|
virtual u32 ExclusiveRead32(std::size_t core_index, VAddr addr) = 0;
|
||||||
virtual void SetExclusive64(std::size_t core_index, VAddr addr) = 0;
|
virtual u64 ExclusiveRead64(std::size_t core_index, VAddr addr) = 0;
|
||||||
virtual void SetExclusive128(std::size_t core_index, VAddr addr) = 0;
|
virtual u128 ExclusiveRead128(std::size_t core_index, VAddr addr) = 0;
|
||||||
virtual void ClearExclusive() = 0;
|
virtual void ClearExclusive() = 0;
|
||||||
|
|
||||||
virtual bool ExclusiveWrite8(std::size_t core_index, VAddr vaddr, u8 value) = 0;
|
virtual bool ExclusiveWrite8(std::size_t core_index, VAddr vaddr, u8 value) = 0;
|
||||||
|
|
|
@ -80,8 +80,7 @@ ResultCode AddressArbiter::IncrementAndSignalToAddressIfEqual(VAddr address, s32
|
||||||
auto& monitor = system.Monitor();
|
auto& monitor = system.Monitor();
|
||||||
u32 current_value;
|
u32 current_value;
|
||||||
do {
|
do {
|
||||||
monitor.SetExclusive32(current_core, address);
|
current_value = monitor.ExclusiveRead32(current_core, address);
|
||||||
current_value = memory.Read32(address);
|
|
||||||
|
|
||||||
if (current_value != value) {
|
if (current_value != value) {
|
||||||
return ERR_INVALID_STATE;
|
return ERR_INVALID_STATE;
|
||||||
|
@ -110,8 +109,7 @@ ResultCode AddressArbiter::ModifyByWaitingCountAndSignalToAddressIfEqual(VAddr a
|
||||||
auto& monitor = system.Monitor();
|
auto& monitor = system.Monitor();
|
||||||
s32 updated_value;
|
s32 updated_value;
|
||||||
do {
|
do {
|
||||||
monitor.SetExclusive32(current_core, address);
|
updated_value = monitor.ExclusiveRead32(current_core, address);
|
||||||
updated_value = memory.Read32(address);
|
|
||||||
|
|
||||||
if (updated_value != value) {
|
if (updated_value != value) {
|
||||||
return ERR_INVALID_STATE;
|
return ERR_INVALID_STATE;
|
||||||
|
@ -186,8 +184,7 @@ ResultCode AddressArbiter::WaitForAddressIfLessThan(VAddr address, s32 value, s6
|
||||||
const std::size_t current_core = system.CurrentCoreIndex();
|
const std::size_t current_core = system.CurrentCoreIndex();
|
||||||
auto& monitor = system.Monitor();
|
auto& monitor = system.Monitor();
|
||||||
do {
|
do {
|
||||||
monitor.SetExclusive32(current_core, address);
|
current_value = static_cast<s32>(monitor.ExclusiveRead32(current_core, address));
|
||||||
current_value = static_cast<s32>(memory.Read32(address));
|
|
||||||
if (should_decrement) {
|
if (should_decrement) {
|
||||||
decrement_value = current_value - 1;
|
decrement_value = current_value - 1;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1653,10 +1653,8 @@ static void SignalProcessWideKey(Core::System& system, VAddr condition_variable_
|
||||||
u32 update_val = 0;
|
u32 update_val = 0;
|
||||||
const VAddr mutex_address = thread->GetMutexWaitAddress();
|
const VAddr mutex_address = thread->GetMutexWaitAddress();
|
||||||
do {
|
do {
|
||||||
monitor.SetExclusive32(current_core, mutex_address);
|
|
||||||
|
|
||||||
// If the mutex is not yet acquired, acquire it.
|
// If the mutex is not yet acquired, acquire it.
|
||||||
mutex_val = memory.Read32(mutex_address);
|
mutex_val = monitor.ExclusiveRead32(current_core, mutex_address);
|
||||||
|
|
||||||
if (mutex_val != 0) {
|
if (mutex_val != 0) {
|
||||||
update_val = mutex_val | Mutex::MutexHasWaitersFlag;
|
update_val = mutex_val | Mutex::MutexHasWaitersFlag;
|
||||||
|
|
Loading…
Reference in a new issue