mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-10 14:08:54 +02:00
fix?
This commit is contained in:
parent
c370b18c81
commit
967af80be6
5 changed files with 18 additions and 28 deletions
|
|
@ -104,12 +104,10 @@ void CpuManager::MultiCoreRunGuestThread() {
|
|||
kernel.CurrentScheduler()->OnThreadStart();
|
||||
|
||||
while (true) {
|
||||
auto* physical_core = &kernel.CurrentPhysicalCore();
|
||||
while (!physical_core->IsInterrupted()) {
|
||||
physical_core->RunThread(thread);
|
||||
physical_core = &kernel.CurrentPhysicalCore();
|
||||
auto& physical_core = kernel.CurrentPhysicalCore();
|
||||
while (!physical_core.IsInterrupted()) {
|
||||
physical_core.RunThread(thread);
|
||||
}
|
||||
|
||||
HandleInterrupt();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -355,19 +355,8 @@ struct KernelCore::Impl {
|
|||
application_process->Open();
|
||||
}
|
||||
|
||||
/// Sets the host thread ID for the caller.
|
||||
u32 SetHostThreadId(std::size_t core_id) {
|
||||
// This should only be called during core init.
|
||||
ASSERT(tls_data.host_thread_id == UINT8_MAX);
|
||||
|
||||
// The first four slots are reserved for CPU core threads
|
||||
ASSERT(core_id < Core::Hardware::NUM_CPU_CORES);
|
||||
tls_data.host_thread_id = u8(core_id);
|
||||
return tls_data.host_thread_id;
|
||||
}
|
||||
|
||||
/// Gets the host thread ID for the caller
|
||||
u32 GetHostThreadId() const {
|
||||
[[nodiscard]] inline u32 GetHostThreadId() const noexcept {
|
||||
return tls_data.host_thread_id;
|
||||
}
|
||||
|
||||
|
|
@ -386,9 +375,12 @@ struct KernelCore::Impl {
|
|||
}
|
||||
|
||||
/// Registers a CPU core thread by allocating a host thread ID for it
|
||||
void RegisterCoreThread(std::size_t core_id) {
|
||||
void RegisterCoreThread(std::size_t core_id) noexcept {
|
||||
// This should only be called during core init.
|
||||
ASSERT(tls_data.host_thread_id == UINT8_MAX);
|
||||
// The first four slots are reserved for CPU core threads
|
||||
ASSERT(core_id < Core::Hardware::NUM_CPU_CORES);
|
||||
const auto this_id = SetHostThreadId(core_id);
|
||||
const auto this_id = tls_data.host_thread_id = u8(core_id);
|
||||
if (!is_multicore)
|
||||
single_core_thread_id = this_id;
|
||||
}
|
||||
|
|
@ -398,7 +390,7 @@ struct KernelCore::Impl {
|
|||
(void)GetHostDummyThread(existing_thread);
|
||||
}
|
||||
|
||||
[[nodiscard]] u32 GetCurrentHostThreadID() {
|
||||
[[nodiscard]] inline u32 GetCurrentHostThreadID() noexcept {
|
||||
auto const this_id = GetHostThreadId();
|
||||
if (!is_multicore && single_core_thread_id == this_id)
|
||||
return u32(system.GetCpuManager().CurrentCore());
|
||||
|
|
@ -930,11 +922,7 @@ const Kernel::PhysicalCore& KernelCore::PhysicalCore(std::size_t id) const {
|
|||
}
|
||||
|
||||
size_t KernelCore::CurrentPhysicalCoreIndex() const {
|
||||
const u32 core_id = impl->GetCurrentHostThreadID();
|
||||
if (core_id >= Core::Hardware::NUM_CPU_CORES) {
|
||||
return Core::Hardware::NUM_CPU_CORES - 1;
|
||||
}
|
||||
return core_id;
|
||||
return impl->GetCurrentHostThreadID();
|
||||
}
|
||||
|
||||
Kernel::PhysicalCore& KernelCore::CurrentPhysicalCore() {
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ void PhysicalCore::Idle() {
|
|||
m_on_interrupt.wait(lk, [this] { return m_is_interrupted; });
|
||||
}
|
||||
|
||||
bool PhysicalCore::IsInterrupted() const {
|
||||
[[noinline]] bool PhysicalCore::IsInterrupted() const {
|
||||
return m_is_interrupted;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -120,11 +120,13 @@ struct Jit::Impl {
|
|||
}
|
||||
|
||||
void HaltExecution(HaltReason hr) {
|
||||
Atomic::Or(&jit_state.halt_reason, static_cast<u32>(hr));
|
||||
Atomic::Or(&jit_state.halt_reason, u32(hr));
|
||||
Atomic::Barrier();
|
||||
}
|
||||
|
||||
void ClearHalt(HaltReason hr) {
|
||||
Atomic::And(&jit_state.halt_reason, ~static_cast<u32>(hr));
|
||||
Atomic::And(&jit_state.halt_reason, ~u32(hr));
|
||||
Atomic::Barrier();
|
||||
}
|
||||
|
||||
void ClearExclusiveState() {
|
||||
|
|
|
|||
|
|
@ -122,10 +122,12 @@ public:
|
|||
|
||||
void HaltExecution(HaltReason hr) {
|
||||
Atomic::Or(&jit_state.halt_reason, u32(hr));
|
||||
Atomic::Barrier();
|
||||
}
|
||||
|
||||
void ClearHalt(HaltReason hr) {
|
||||
Atomic::And(&jit_state.halt_reason, ~u32(hr));
|
||||
Atomic::Barrier();
|
||||
}
|
||||
|
||||
u64 GetSP() const {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue