Browse Source
Merge pull request #1175 from lioncash/ns
core: Namespace all code in the arm subdirectory under the Core namespace
pull/15/merge
bunnei
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with
42 additions and
12 deletions
-
src/core/arm/arm_interface.h
-
src/core/arm/dynarmic/arm_dynarmic.cpp
-
src/core/arm/dynarmic/arm_dynarmic.h
-
src/core/arm/exclusive_monitor.cpp
-
src/core/arm/exclusive_monitor.h
-
src/core/arm/unicorn/arm_unicorn.cpp
-
src/core/arm/unicorn/arm_unicorn.h
-
src/core/core.h
-
src/core/core_cpu.h
-
src/core/hle/kernel/scheduler.cpp
-
src/core/hle/kernel/scheduler.h
-
src/core/hle/kernel/thread.cpp
-
src/core/hle/kernel/thread.h
|
|
|
@ -8,6 +8,8 @@ |
|
|
|
#include "common/common_types.h" |
|
|
|
#include "core/hle/kernel/vm_manager.h" |
|
|
|
|
|
|
|
namespace Core { |
|
|
|
|
|
|
|
/// Generic ARM11 CPU interface |
|
|
|
class ARM_Interface : NonCopyable { |
|
|
|
public: |
|
|
|
@ -122,3 +124,5 @@ public: |
|
|
|
/// Prepare core for thread reschedule (if needed to correctly handle state) |
|
|
|
virtual void PrepareReschedule() = 0; |
|
|
|
}; |
|
|
|
|
|
|
|
} // namespace Core |
|
|
|
@ -14,6 +14,8 @@ |
|
|
|
#include "core/hle/kernel/svc.h"
|
|
|
|
#include "core/memory.h"
|
|
|
|
|
|
|
|
namespace Core { |
|
|
|
|
|
|
|
using Vector = Dynarmic::A64::Vector; |
|
|
|
|
|
|
|
class ARM_Dynarmic_Callbacks : public Dynarmic::A64::UserCallbacks { |
|
|
|
@ -300,3 +302,5 @@ bool DynarmicExclusiveMonitor::ExclusiveWrite128(size_t core_index, VAddr vaddr, |
|
|
|
Memory::Write64(vaddr, value[1]); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
} // namespace Core
|
|
|
|
@ -12,6 +12,8 @@ |
|
|
|
#include "core/arm/exclusive_monitor.h" |
|
|
|
#include "core/arm/unicorn/arm_unicorn.h" |
|
|
|
|
|
|
|
namespace Core { |
|
|
|
|
|
|
|
class ARM_Dynarmic_Callbacks; |
|
|
|
class DynarmicExclusiveMonitor; |
|
|
|
|
|
|
|
@ -81,3 +83,5 @@ private: |
|
|
|
friend class ARM_Dynarmic; |
|
|
|
Dynarmic::A64::ExclusiveMonitor monitor; |
|
|
|
}; |
|
|
|
|
|
|
|
} // namespace Core |
|
|
|
@ -4,4 +4,8 @@ |
|
|
|
|
|
|
|
#include "core/arm/exclusive_monitor.h"
|
|
|
|
|
|
|
|
namespace Core { |
|
|
|
|
|
|
|
ExclusiveMonitor::~ExclusiveMonitor() = default; |
|
|
|
|
|
|
|
} // namespace Core
|
|
|
|
@ -6,6 +6,8 @@ |
|
|
|
|
|
|
|
#include "common/common_types.h" |
|
|
|
|
|
|
|
namespace Core { |
|
|
|
|
|
|
|
class ExclusiveMonitor { |
|
|
|
public: |
|
|
|
virtual ~ExclusiveMonitor(); |
|
|
|
@ -19,3 +21,5 @@ public: |
|
|
|
virtual bool ExclusiveWrite64(size_t core_index, VAddr vaddr, u64 value) = 0; |
|
|
|
virtual bool ExclusiveWrite128(size_t core_index, VAddr vaddr, u128 value) = 0; |
|
|
|
}; |
|
|
|
|
|
|
|
} // namespace Core |
|
|
|
@ -11,6 +11,8 @@ |
|
|
|
#include "core/core_timing.h"
|
|
|
|
#include "core/hle/kernel/svc.h"
|
|
|
|
|
|
|
|
namespace Core { |
|
|
|
|
|
|
|
// Load Unicorn DLL once on Windows using RAII
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#include <unicorn_dynload.h>
|
|
|
|
@ -211,7 +213,7 @@ void ARM_Unicorn::ExecuteInstructions(int num_instructions) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void ARM_Unicorn::SaveContext(ARM_Interface::ThreadContext& ctx) { |
|
|
|
void ARM_Unicorn::SaveContext(ThreadContext& ctx) { |
|
|
|
int uregs[32]; |
|
|
|
void* tregs[32]; |
|
|
|
|
|
|
|
@ -238,7 +240,7 @@ void ARM_Unicorn::SaveContext(ARM_Interface::ThreadContext& ctx) { |
|
|
|
CHECKED(uc_reg_read_batch(uc, uregs, tregs, 32)); |
|
|
|
} |
|
|
|
|
|
|
|
void ARM_Unicorn::LoadContext(const ARM_Interface::ThreadContext& ctx) { |
|
|
|
void ARM_Unicorn::LoadContext(const ThreadContext& ctx) { |
|
|
|
int uregs[32]; |
|
|
|
void* tregs[32]; |
|
|
|
|
|
|
|
@ -277,3 +279,5 @@ void ARM_Unicorn::RecordBreak(GDBStub::BreakpointAddress bkpt) { |
|
|
|
last_bkpt = bkpt; |
|
|
|
last_bkpt_hit = true; |
|
|
|
} |
|
|
|
|
|
|
|
} // namespace Core
|
|
|
|
@ -9,6 +9,8 @@ |
|
|
|
#include "core/arm/arm_interface.h" |
|
|
|
#include "core/gdbstub/gdbstub.h" |
|
|
|
|
|
|
|
namespace Core { |
|
|
|
|
|
|
|
class ARM_Unicorn final : public ARM_Interface { |
|
|
|
public: |
|
|
|
ARM_Unicorn(); |
|
|
|
@ -46,3 +48,5 @@ private: |
|
|
|
GDBStub::BreakpointAddress last_bkpt{}; |
|
|
|
bool last_bkpt_hit; |
|
|
|
}; |
|
|
|
|
|
|
|
} // namespace Core |
|
|
|
@ -23,8 +23,6 @@ |
|
|
|
#include "video_core/debug_utils/debug_utils.h" |
|
|
|
#include "video_core/gpu.h" |
|
|
|
|
|
|
|
class ARM_Interface; |
|
|
|
|
|
|
|
namespace Core::Frontend { |
|
|
|
class EmuWindow; |
|
|
|
} |
|
|
|
@ -39,6 +37,8 @@ class RendererBase; |
|
|
|
|
|
|
|
namespace Core { |
|
|
|
|
|
|
|
class ARM_Interface; |
|
|
|
|
|
|
|
class System { |
|
|
|
public: |
|
|
|
System(const System&) = delete; |
|
|
|
|
|
|
|
@ -12,14 +12,14 @@ |
|
|
|
#include "common/common_types.h" |
|
|
|
#include "core/arm/exclusive_monitor.h" |
|
|
|
|
|
|
|
class ARM_Interface; |
|
|
|
|
|
|
|
namespace Kernel { |
|
|
|
class Scheduler; |
|
|
|
} |
|
|
|
|
|
|
|
namespace Core { |
|
|
|
|
|
|
|
class ARM_Interface; |
|
|
|
|
|
|
|
constexpr unsigned NUM_CPU_CORES{4}; |
|
|
|
|
|
|
|
class CpuBarrier { |
|
|
|
|
|
|
|
@ -17,7 +17,7 @@ namespace Kernel { |
|
|
|
|
|
|
|
std::mutex Scheduler::scheduler_mutex; |
|
|
|
|
|
|
|
Scheduler::Scheduler(ARM_Interface* cpu_core) : cpu_core(cpu_core) {} |
|
|
|
Scheduler::Scheduler(Core::ARM_Interface* cpu_core) : cpu_core(cpu_core) {} |
|
|
|
|
|
|
|
Scheduler::~Scheduler() { |
|
|
|
for (auto& thread : thread_list) { |
|
|
|
|
|
|
|
@ -11,13 +11,15 @@ |
|
|
|
#include "core/hle/kernel/object.h" |
|
|
|
#include "core/hle/kernel/thread.h" |
|
|
|
|
|
|
|
namespace Core { |
|
|
|
class ARM_Interface; |
|
|
|
} |
|
|
|
|
|
|
|
namespace Kernel { |
|
|
|
|
|
|
|
class Scheduler final { |
|
|
|
public: |
|
|
|
explicit Scheduler(ARM_Interface* cpu_core); |
|
|
|
explicit Scheduler(Core::ARM_Interface* cpu_core); |
|
|
|
~Scheduler(); |
|
|
|
|
|
|
|
/// Returns whether there are any threads that are ready to run. |
|
|
|
@ -70,7 +72,7 @@ private: |
|
|
|
|
|
|
|
SharedPtr<Thread> current_thread = nullptr; |
|
|
|
|
|
|
|
ARM_Interface* cpu_core; |
|
|
|
Core::ARM_Interface* cpu_core; |
|
|
|
|
|
|
|
static std::mutex scheduler_mutex; |
|
|
|
}; |
|
|
|
|
|
|
|
@ -283,9 +283,9 @@ static std::tuple<std::size_t, std::size_t, bool> GetFreeThreadLocalSlot( |
|
|
|
* @param entry_point Address of entry point for execution |
|
|
|
* @param arg User argument for thread |
|
|
|
*/ |
|
|
|
static void ResetThreadContext(ARM_Interface::ThreadContext& context, VAddr stack_top, |
|
|
|
static void ResetThreadContext(Core::ARM_Interface::ThreadContext& context, VAddr stack_top, |
|
|
|
VAddr entry_point, u64 arg) { |
|
|
|
memset(&context, 0, sizeof(ARM_Interface::ThreadContext)); |
|
|
|
memset(&context, 0, sizeof(Core::ARM_Interface::ThreadContext)); |
|
|
|
|
|
|
|
context.cpu_registers[0] = arg; |
|
|
|
context.pc = entry_point; |
|
|
|
|
|
|
|
@ -204,7 +204,7 @@ public: |
|
|
|
return status == ThreadStatus::WaitSynchAll; |
|
|
|
} |
|
|
|
|
|
|
|
ARM_Interface::ThreadContext context; |
|
|
|
Core::ARM_Interface::ThreadContext context; |
|
|
|
|
|
|
|
u32 thread_id; |
|
|
|
|
|
|
|
|