mirror of
https://github.com/xenia-project/xenia.git
synced 2025-12-06 07:12:03 +01:00
[Kernel] Implement KeTryToAcquireSpinLockAtRaisedIrql. Maybe correctly.
This commit is contained in:
parent
68017eadea
commit
1ebf7bb484
|
|
@ -922,6 +922,17 @@ void KeAcquireSpinLockAtRaisedIrql(lpdword_t lock_ptr) {
|
||||||
DECLARE_XBOXKRNL_EXPORT3(KeAcquireSpinLockAtRaisedIrql, kThreading,
|
DECLARE_XBOXKRNL_EXPORT3(KeAcquireSpinLockAtRaisedIrql, kThreading,
|
||||||
kImplemented, kBlocking, kHighFrequency);
|
kImplemented, kBlocking, kHighFrequency);
|
||||||
|
|
||||||
|
dword_t KeTryToAcquireSpinLockAtRaisedIrql(lpdword_t lock_ptr) {
|
||||||
|
// Lock.
|
||||||
|
auto lock = reinterpret_cast<uint32_t*>(lock_ptr.host_address());
|
||||||
|
if (!xe::atomic_cas(0, 1, lock)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
DECLARE_XBOXKRNL_EXPORT4(KeTryToAcquireSpinLockAtRaisedIrql, kThreading,
|
||||||
|
kImplemented, kBlocking, kHighFrequency, kSketchy);
|
||||||
|
|
||||||
void KeReleaseSpinLockFromRaisedIrql(lpdword_t lock_ptr) {
|
void KeReleaseSpinLockFromRaisedIrql(lpdword_t lock_ptr) {
|
||||||
// Unlock.
|
// Unlock.
|
||||||
auto lock = reinterpret_cast<uint32_t*>(lock_ptr.host_address());
|
auto lock = reinterpret_cast<uint32_t*>(lock_ptr.host_address());
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue