[Threading] Implement priority boost on wake
When a thread wakes from a kernel wait, the Xenon scheduler boosts its effective priority by the increment passed to the signaling call (KeSetEvent, KeReleaseSemaphore, KeReleaseMutant). The boost is clamped to the per-thread max_dynamic_priority cap, respects the guest boost_disabled flag, and is drained on the next quantum expiry. Guest KTHREAD priority fields are now initialized from parent process defaults, and the previously unknown fields involved have been renamed to match their identified purpose.
This commit is contained in:
@@ -226,6 +226,12 @@ class XObject {
|
||||
void* native_ptr, int32_t as_type = -1,
|
||||
bool already_locked = false);
|
||||
|
||||
// Priority increment stored by the most recent signal operation
|
||||
// (KeSetEvent, KeReleaseSemaphore, etc.). Read by the waiter on wake
|
||||
// to apply a priority boost matching real Xenon scheduler behavior.
|
||||
uint32_t priority_increment() const { return priority_increment_; }
|
||||
void set_priority_increment(uint32_t inc) { priority_increment_ = inc; }
|
||||
|
||||
protected:
|
||||
bool SaveObject(ByteStream* stream);
|
||||
bool RestoreObject(ByteStream* stream);
|
||||
@@ -253,6 +259,8 @@ class XObject {
|
||||
|
||||
KernelState* kernel_state_;
|
||||
|
||||
uint32_t priority_increment_ = 0;
|
||||
|
||||
// Host objects are persisted through resets/etc.
|
||||
bool host_object_ = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user