summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/physical_core.h
blob: 225b31d3edabe6e48f5484bc11a51ef07a82c574 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright 2020 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

#pragma once

namespace Kernel {
class Scheduler;
} // namespace Kernel

class ARM_Interface;
class ExclusiveMonitor;

namespace Kernel {

class PhysicalCore {
public:
    PhysicalCore(KernelCore& kernel, std::size_t id, ExclusiveMonitor& exclusive_monitor);

    /// Execute current jit state
    void Run();
    /// Execute a single instruction in current jit.
    void Step();
    /// Stop JIT execution/exit
    void Stop();

    ARM_Interface& ArmInterface() {
        return *arm_interface;
    }

    const ARM_Interface& ArmInterface() const {
        return *arm_interface;
    }

    bool IsMainCore() const {
        return core_index == 0;
    }

    bool IsSystemCore() const {
        return core_index == 3;
    }

    std::size_t CoreIndex() const {
        return core_index;
    }

    Scheduler& Scheduler() {
        return *scheduler;
    }

    const Scheduler& Scheduler() const {
        return *scheduler;
    }

private:
    std::size_t core_index;
    std::unique_ptr<ARM_Interface> arm_interface;
    std::unique_ptr<Kernel::Scheduler> scheduler;
    KernelCore& kernel;
}

} // namespace Kernel