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

@@ -12,7 +12,6 @@
#include <atomic>
#include <memory>
#include <mutex>
#include <string>
#include <utility>
#include <vector>
@@ -91,9 +90,9 @@ class X64CodeCache : public CodeCache {
std::wstring file_name_;
xe::memory::FileMappingHandle mapping_ = nullptr;
// Must be held when manipulating the offsets or counts of anything, to keep
// the tables consistent and ordered.
xe::mutex allocation_mutex_;
// NOTE: the global critical region must be held when manipulating the offsets
// or counts of anything, to keep the tables consistent and ordered.
xe::global_critical_region global_critical_region_;
// Value that the indirection table will be initialized with upon commit.
uint32_t indirection_default_value_ = 0xFEEDF00D;