Add constant folding for LVR when 16 aligned, clean up prior commit by removing dead test code for LVR/LVL/STVL/STVR opcodes and legacy hir sequence

Delay using mm_pause in KeAcquireSpinLockAtRaisedIrql_entry, a huge amount of time is spent spinning in halo3
This commit is contained in:
chss95cs@gmail.com
2022-09-04 11:44:29 -07:00
parent c6010bd4b1
commit 2e5c4937fd
4 changed files with 22 additions and 408 deletions

View File

@@ -952,11 +952,17 @@ void KfReleaseSpinLock_entry(lpdword_t lock_ptr, dword_t old_irql) {
}
DECLARE_XBOXKRNL_EXPORT2(KfReleaseSpinLock, kThreading, kImplemented,
kHighFrequency);
// todo: this is not accurate
void KeAcquireSpinLockAtRaisedIrql_entry(lpdword_t lock_ptr) {
// Lock.
auto lock = reinterpret_cast<uint32_t*>(lock_ptr.host_address());
while (!xe::atomic_cas(0, 1, lock)) {
#if XE_ARCH_AMD64 == 1
// todo: this is just a nop if they don't have SMT, which is not great
// either...
_mm_pause();
#endif
// Spin!
// TODO(benvanik): error on deadlock?
}