summaryrefslogtreecommitdiffstats
path: root/src/core/arm/exclusive_monitor.h
blob: 2ee312eeeae423887b6cf05a1478378214bbee3c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2018 yuzu emulator team
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

#pragma once

#include <memory>

#include "common/common_types.h"

namespace Core::Memory {
class Memory;
}

namespace Core {

class ExclusiveMonitor {
public:
    virtual ~ExclusiveMonitor();

    virtual void SetExclusive8(std::size_t core_index, VAddr addr) = 0;
    virtual void SetExclusive16(std::size_t core_index, VAddr addr) = 0;
    virtual void SetExclusive32(std::size_t core_index, VAddr addr) = 0;
    virtual void SetExclusive64(std::size_t core_index, VAddr addr) = 0;
    virtual void SetExclusive128(std::size_t core_index, VAddr addr) = 0;
    virtual void ClearExclusive() = 0;

    virtual bool ExclusiveWrite8(std::size_t core_index, VAddr vaddr, u8 value) = 0;
    virtual bool ExclusiveWrite16(std::size_t core_index, VAddr vaddr, u16 value) = 0;
    virtual bool ExclusiveWrite32(std::size_t core_index, VAddr vaddr, u32 value) = 0;
    virtual bool ExclusiveWrite64(std::size_t core_index, VAddr vaddr, u64 value) = 0;
    virtual bool ExclusiveWrite128(std::size_t core_index, VAddr vaddr, u128 value) = 0;
};

std::unique_ptr<Core::ExclusiveMonitor> MakeExclusiveMonitor(Memory::Memory& memory,
                                                             std::size_t num_cores);

} // namespace Core