summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2020-01-24 15:38:20 -0400
committerGravatar Fernando Sahmkow2020-01-24 15:38:20 -0400
commitab89ced244db69616d29c91470d870b73b09cc69 (patch)
tree0c45b8298ab75d60b74448aac2857f2ead2c613b /src
parentMerge pull request #2800 from FearlessTobi/port-4049 (diff)
downloadyuzu-ab89ced244db69616d29c91470d870b73b09cc69.tar.gz
yuzu-ab89ced244db69616d29c91470d870b73b09cc69.tar.xz
yuzu-ab89ced244db69616d29c91470d870b73b09cc69.zip
Kernel: Implement Physical Core.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/physical_core.cpp19
-rw-r--r--src/core/hle/kernel/physical_core.h62
2 files changed, 81 insertions, 0 deletions
diff --git a/src/core/hle/kernel/physical_core.cpp b/src/core/hle/kernel/physical_core.cpp
new file mode 100644
index 000000000..17faef348
--- /dev/null
+++ b/src/core/hle/kernel/physical_core.cpp
@@ -0,0 +1,19 @@
1// Copyright 2020 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5namespace Kernel {
6
7PhysicalCore::PhysicalCore(KernelCore& kernel, std::size_t id, ExclusiveMonitor& exclusive_monitor)
8 : core_index{id}, kernel{kernel} {
9#ifdef ARCHITECTURE_x86_64
10 arm_interface = std::make_unique<ARM_Dynarmic>(system, exclusive_monitor, core_index);
11#else
12 arm_interface = std::make_unique<ARM_Unicorn>(system);
13 LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available");
14#endif
15
16 scheduler = std::make_unique<Kernel::Scheduler>(system, *arm_interface, core_index);
17}
18
19} // namespace Kernel
diff --git a/src/core/hle/kernel/physical_core.h b/src/core/hle/kernel/physical_core.h
new file mode 100644
index 000000000..225b31d3e
--- /dev/null
+++ b/src/core/hle/kernel/physical_core.h
@@ -0,0 +1,62 @@
1// Copyright 2020 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7namespace Kernel {
8class Scheduler;
9} // namespace Kernel
10
11class ARM_Interface;
12class ExclusiveMonitor;
13
14namespace Kernel {
15
16class PhysicalCore {
17public:
18 PhysicalCore(KernelCore& kernel, std::size_t id, ExclusiveMonitor& exclusive_monitor);
19
20 /// Execute current jit state
21 void Run();
22 /// Execute a single instruction in current jit.
23 void Step();
24 /// Stop JIT execution/exit
25 void Stop();
26
27 ARM_Interface& ArmInterface() {
28 return *arm_interface;
29 }
30
31 const ARM_Interface& ArmInterface() const {
32 return *arm_interface;
33 }
34
35 bool IsMainCore() const {
36 return core_index == 0;
37 }
38
39 bool IsSystemCore() const {
40 return core_index == 3;
41 }
42
43 std::size_t CoreIndex() const {
44 return core_index;
45 }
46
47 Scheduler& Scheduler() {
48 return *scheduler;
49 }
50
51 const Scheduler& Scheduler() const {
52 return *scheduler;
53 }
54
55private:
56 std::size_t core_index;
57 std::unique_ptr<ARM_Interface> arm_interface;
58 std::unique_ptr<Kernel::Scheduler> scheduler;
59 KernelCore& kernel;
60}
61
62} // namespace Kernel