[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:
Herman S.
2026-04-11 17:05:05 +09:00
parent b3d8a21b72
commit 65b74819aa
9 changed files with 127 additions and 47 deletions

View File

@@ -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;