DANGER DANGER. Switching to global critical region.

This changes almost all locks held by guest threads to use a single global
critical region. This emulates the behavior on the PPC of disabling
interrupts (by calls like KeRaiseIrqlToDpcLevel or masking interrupts),
and prevents deadlocks from occuring when threads are suspended or
otherwise blocked.
This has performance implications and a pass is needed to ensure the
locking is as granular as possible. It could also break everything
because it's fundamentally unsound. We'll see.
This commit is contained in:
Ben Vanik
2015-09-06 09:30:54 -07:00
parent 33270cd2a0
commit 3c96b6fa0a
50 changed files with 271 additions and 219 deletions

View File

@@ -86,7 +86,6 @@ class Processor {
uint64_t ExecuteInterrupt(ThreadState* thread_state, uint32_t address,
uint64_t args[], size_t arg_count);
xe::recursive_mutex* global_mutex() { return &global_mutex_; }
Irql RaiseIrql(Irql new_value);
void LowerIrql(Irql old_value);
@@ -104,13 +103,12 @@ class Processor {
ExportResolver* export_resolver_ = nullptr;
EntryTable entry_table_;
xe::mutex modules_lock_;
xe::global_critical_region global_critical_region_;
std::vector<std::unique_ptr<Module>> modules_;
Module* builtin_module_ = nullptr;
uint32_t next_builtin_address_ = 0xFFFF0000u;
Irql irql_;
xe::recursive_mutex global_mutex_;
};
} // namespace cpu