Clang Format.

This commit is contained in:
Fernando Sahmkow 2020-05-08 18:53:13 -04:00
parent 3714f2e471
commit 467d43570e
14 changed files with 49 additions and 48 deletions

View File

@ -35,26 +35,26 @@ bool AtomicCompareAndSwap(u64 volatile* pointer, u64 value, u64 expected) {
} }
bool AtomicCompareAndSwap(u64 volatile* pointer, u128 value, u128 expected) { bool AtomicCompareAndSwap(u64 volatile* pointer, u128 value, u128 expected) {
return _InterlockedCompareExchange128((__int64*)pointer, value[1], value[0], (__int64*)expected.data()) != 0; return _InterlockedCompareExchange128((__int64*)pointer, value[1], value[0],
(__int64*)expected.data()) != 0;
} }
#else #else
bool AtomicCompareAndSwap(u8 volatile* pointer, u8 value, u8 expected) { bool AtomicCompareAndSwap(u8 volatile* pointer, u8 value, u8 expected) {
return __sync_bool_compare_and_swap (pointer, value, expected); return __sync_bool_compare_and_swap(pointer, value, expected);
} }
bool AtomicCompareAndSwap(u16 volatile* pointer, u16 value, u16 expected) { bool AtomicCompareAndSwap(u16 volatile* pointer, u16 value, u16 expected) {
return __sync_bool_compare_and_swap (pointer, value, expected); return __sync_bool_compare_and_swap(pointer, value, expected);
} }
bool AtomicCompareAndSwap(u32 volatile* pointer, u32 value, u32 expected) { bool AtomicCompareAndSwap(u32 volatile* pointer, u32 value, u32 expected) {
return __sync_bool_compare_and_swap (pointer, value, expected); return __sync_bool_compare_and_swap(pointer, value, expected);
} }
bool AtomicCompareAndSwap(u64 volatile* pointer, u64 value, u64 expected) { bool AtomicCompareAndSwap(u64 volatile* pointer, u64 value, u64 expected) {
return __sync_bool_compare_and_swap (pointer, value, expected); return __sync_bool_compare_and_swap(pointer, value, expected);
} }
bool AtomicCompareAndSwap(u64 volatile* pointer, u128 value, u128 expected) { bool AtomicCompareAndSwap(u64 volatile* pointer, u128 value, u128 expected) {
@ -62,7 +62,7 @@ bool AtomicCompareAndSwap(u64 volatile* pointer, u128 value, u128 expected) {
unsigned __int128 expected_a; unsigned __int128 expected_a;
std::memcpy(&value_a, value.data(), sizeof(u128)); std::memcpy(&value_a, value.data(), sizeof(u128));
std::memcpy(&expected_a, expected.data(), sizeof(u128)); std::memcpy(&expected_a, expected.data(), sizeof(u128));
return __sync_bool_compare_and_swap ((unsigned __int128*)pointer, value_a, expected_a); return __sync_bool_compare_and_swap((unsigned __int128*)pointer, value_a, expected_a);
} }
#endif #endif

View File

@ -8,7 +8,7 @@
namespace Common { namespace Common {
bool AtomicCompareAndSwap(u8 volatile * pointer, u8 value, u8 expected); bool AtomicCompareAndSwap(u8 volatile* pointer, u8 value, u8 expected);
bool AtomicCompareAndSwap(u16 volatile* pointer, u16 value, u16 expected); bool AtomicCompareAndSwap(u16 volatile* pointer, u16 value, u16 expected);
bool AtomicCompareAndSwap(u32 volatile* pointer, u32 value, u32 expected); bool AtomicCompareAndSwap(u32 volatile* pointer, u32 value, u32 expected);
bool AtomicCompareAndSwap(u64 volatile* pointer, u64 value, u64 expected); bool AtomicCompareAndSwap(u64 volatile* pointer, u64 value, u64 expected);

View File

@ -31,21 +31,21 @@ void SetCurrentThreadPriority(ThreadPriority new_priority) {
auto handle = GetCurrentThread(); auto handle = GetCurrentThread();
int windows_priority = 0; int windows_priority = 0;
switch (new_priority) { switch (new_priority) {
case ThreadPriority::Low: case ThreadPriority::Low:
windows_priority = THREAD_PRIORITY_BELOW_NORMAL; windows_priority = THREAD_PRIORITY_BELOW_NORMAL;
break; break;
case ThreadPriority::Normal: case ThreadPriority::Normal:
windows_priority = THREAD_PRIORITY_NORMAL; windows_priority = THREAD_PRIORITY_NORMAL;
break; break;
case ThreadPriority::High: case ThreadPriority::High:
windows_priority = THREAD_PRIORITY_ABOVE_NORMAL; windows_priority = THREAD_PRIORITY_ABOVE_NORMAL;
break; break;
case ThreadPriority::VeryHigh: case ThreadPriority::VeryHigh:
windows_priority = THREAD_PRIORITY_HIGHEST; windows_priority = THREAD_PRIORITY_HIGHEST;
break; break;
default: default:
windows_priority = THREAD_PRIORITY_NORMAL; windows_priority = THREAD_PRIORITY_NORMAL;
break; break;
} }
SetThreadPriority(handle, windows_priority); SetThreadPriority(handle, windows_priority);
} }

View File

@ -63,8 +63,8 @@ static bool UnmappedMemoryHook(uc_engine* uc, uc_mem_type type, u64 addr, int si
return false; return false;
} }
ARM_Unicorn::ARM_Unicorn(System& system, CPUInterrupts& interrupt_handlers, ARM_Unicorn::ARM_Unicorn(System& system, CPUInterrupts& interrupt_handlers, bool uses_wall_clock,
bool uses_wall_clock, Arch architecture, std::size_t core_index) Arch architecture, std::size_t core_index)
: ARM_Interface{system, interrupt_handlers, uses_wall_clock}, core_index{core_index} { : ARM_Interface{system, interrupt_handlers, uses_wall_clock}, core_index{core_index} {
const auto arch = architecture == Arch::AArch32 ? UC_ARCH_ARM : UC_ARCH_ARM64; const auto arch = architecture == Arch::AArch32 ? UC_ARCH_ARM : UC_ARCH_ARM64;
CHECKED(uc_open(arch, UC_MODE_ARM, &uc)); CHECKED(uc_open(arch, UC_MODE_ARM, &uc));

View File

@ -20,8 +20,8 @@ public:
AArch64, // 64-bit ARM AArch64, // 64-bit ARM
}; };
explicit ARM_Unicorn(System& system, CPUInterrupts& interrupt_handlers, explicit ARM_Unicorn(System& system, CPUInterrupts& interrupt_handlers, bool uses_wall_clock,
bool uses_wall_clock, Arch architecture, std::size_t core_index); Arch architecture, std::size_t core_index);
~ARM_Unicorn() override; ~ARM_Unicorn() override;
void SetPC(u64 pc) override; void SetPC(u64 pc) override;

View File

@ -148,8 +148,6 @@ public:
*/ */
ResultStatus Pause(); ResultStatus Pause();
/** /**
* Step the CPU one instruction * Step the CPU one instruction
* @return Result status, indicating whether or not the operation succeeded. * @return Result status, indicating whether or not the operation succeeded.

View File

@ -9,7 +9,6 @@
#include "common/assert.h" #include "common/assert.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/core.h" #include "core/core.h"
#include "core/core.h"
#include "core/hle/kernel/errors.h" #include "core/hle/kernel/errors.h"
#include "core/hle/kernel/handle_table.h" #include "core/hle/kernel/handle_table.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
@ -126,11 +125,11 @@ ResultCode Mutex::TryAcquire(VAddr address, Handle holding_thread_handle,
std::pair<ResultCode, std::shared_ptr<Thread>> Mutex::Unlock(std::shared_ptr<Thread> owner, std::pair<ResultCode, std::shared_ptr<Thread>> Mutex::Unlock(std::shared_ptr<Thread> owner,
VAddr address) { VAddr address) {
// The mutex address must be 4-byte aligned // The mutex address must be 4-byte aligned
if ((address % sizeof(u32)) != 0) { if ((address % sizeof(u32)) != 0) {
LOG_ERROR(Kernel, "Address is not 4-byte aligned! address={:016X}", address); LOG_ERROR(Kernel, "Address is not 4-byte aligned! address={:016X}", address);
return {ERR_INVALID_ADDRESS, nullptr}; return {ERR_INVALID_ADDRESS, nullptr};
} }
auto [new_owner, num_waiters] = GetHighestPriorityMutexWaitingThread(owner, address); auto [new_owner, num_waiters] = GetHighestPriorityMutexWaitingThread(owner, address);
if (new_owner == nullptr) { if (new_owner == nullptr) {

View File

@ -29,7 +29,8 @@ public:
Handle requesting_thread_handle); Handle requesting_thread_handle);
/// Unlocks a mutex for owner at address /// Unlocks a mutex for owner at address
std::pair<ResultCode, std::shared_ptr<Thread>> Unlock(std::shared_ptr<Thread> owner, VAddr address); std::pair<ResultCode, std::shared_ptr<Thread>> Unlock(std::shared_ptr<Thread> owner,
VAddr address);
/// Releases the mutex at the specified address. /// Releases the mutex at the specified address.
ResultCode Release(VAddr address); ResultCode Release(VAddr address);

View File

@ -10,7 +10,7 @@
#include "core/arm/cpu_interrupt_handler.h" #include "core/arm/cpu_interrupt_handler.h"
namespace Common { namespace Common {
class SpinLock; class SpinLock;
} }
namespace Kernel { namespace Kernel {
@ -27,9 +27,8 @@ namespace Kernel {
class PhysicalCore { class PhysicalCore {
public: public:
PhysicalCore(Core::System& system, std::size_t id, PhysicalCore(Core::System& system, std::size_t id, Kernel::Scheduler& scheduler,
Kernel::Scheduler& scheduler, Core::CPUInterruptHandler& interrupt_handler);
Core::CPUInterruptHandler& interrupt_handler);
~PhysicalCore(); ~PhysicalCore();
PhysicalCore(const PhysicalCore&) = delete; PhysicalCore(const PhysicalCore&) = delete;

View File

@ -17,9 +17,9 @@
#include "core/hle/kernel/hle_ipc.h" #include "core/hle/kernel/hle_ipc.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
#include "core/hle/kernel/scheduler.h"
#include "core/hle/kernel/server_session.h" #include "core/hle/kernel/server_session.h"
#include "core/hle/kernel/session.h" #include "core/hle/kernel/session.h"
#include "core/hle/kernel/scheduler.h"
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
#include "core/memory.h" #include "core/memory.h"

View File

@ -71,7 +71,6 @@ void EmuThread::run() {
gpu.ReleaseContext(); gpu.ReleaseContext();
// Holds whether the cpu was running during the last iteration, // Holds whether the cpu was running during the last iteration,
// so that the DebugModeLeft signal can be emitted before the // so that the DebugModeLeft signal can be emitted before the
// next execution step // next execution step

View File

@ -62,7 +62,8 @@ public:
if (!running) { if (!running) {
running_wait.Set(); running_wait.Set();
/// Wait until effectively paused /// Wait until effectively paused
while (running_guard); while (running_guard)
;
} }
} }

View File

@ -127,11 +127,12 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeCallstack::GetChildren() cons
return list; return list;
} }
auto backtrace = Core::ARM_Interface::GetBacktraceFromContext(Core::System::GetInstance(), thread.GetContext64()); auto backtrace = Core::ARM_Interface::GetBacktraceFromContext(Core::System::GetInstance(),
thread.GetContext64());
for (auto& entry : backtrace) { for (auto& entry : backtrace) {
std::string s = fmt::format("{:20}{:016X} {:016X} {:016X} {}", entry.module, entry.address, std::string s = fmt::format("{:20}{:016X} {:016X} {:016X} {}", entry.module, entry.address,
entry.original_address, entry.offset, entry.name); entry.original_address, entry.offset, entry.name);
list.push_back(std::make_unique<WaitTreeText>(QString::fromStdString(s))); list.push_back(std::make_unique<WaitTreeText>(QString::fromStdString(s)));
} }

View File

@ -534,7 +534,8 @@ void GMainWindow::InitializeWidgets() {
if (emulation_running) { if (emulation_running) {
return; return;
} }
bool is_async = !Settings::values.use_asynchronous_gpu_emulation || Settings::values.use_multi_core; bool is_async =
!Settings::values.use_asynchronous_gpu_emulation || Settings::values.use_multi_core;
Settings::values.use_asynchronous_gpu_emulation = is_async; Settings::values.use_asynchronous_gpu_emulation = is_async;
async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation); async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation);
Settings::Apply(); Settings::Apply();
@ -552,7 +553,8 @@ void GMainWindow::InitializeWidgets() {
return; return;
} }
Settings::values.use_multi_core = !Settings::values.use_multi_core; Settings::values.use_multi_core = !Settings::values.use_multi_core;
bool is_async = Settings::values.use_asynchronous_gpu_emulation || Settings::values.use_multi_core; bool is_async =
Settings::values.use_asynchronous_gpu_emulation || Settings::values.use_multi_core;
Settings::values.use_asynchronous_gpu_emulation = is_async; Settings::values.use_asynchronous_gpu_emulation = is_async;
async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation); async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation);
multicore_status_button->setChecked(Settings::values.use_multi_core); multicore_status_button->setChecked(Settings::values.use_multi_core);
@ -1958,7 +1960,8 @@ void GMainWindow::OnConfigure() {
dock_status_button->setChecked(Settings::values.use_docked_mode); dock_status_button->setChecked(Settings::values.use_docked_mode);
multicore_status_button->setChecked(Settings::values.use_multi_core); multicore_status_button->setChecked(Settings::values.use_multi_core);
Settings::values.use_asynchronous_gpu_emulation = Settings::values.use_asynchronous_gpu_emulation || Settings::values.use_multi_core; Settings::values.use_asynchronous_gpu_emulation =
Settings::values.use_asynchronous_gpu_emulation || Settings::values.use_multi_core;
async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation); async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation);
#ifdef HAS_VULKAN #ifdef HAS_VULKAN