git.ucc.asn.au
/
tpg
/
acess2.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
RunQemu - Add AHCI support
[tpg/acess2.git]
/
Notes
/
Spinlocks.txt
1
SHORTLOCK()
2
cli; lock cmpxchg
3
SHORTREL()
4
lock and ; sti
5
6
7
LONGLOCK()
8
mov eax, 1
9
lock cmpxchg lock.lock, eax
10
if(eax) {
11
SHORTLOCK(lock.listLock)
12
// add to list (linked list, 4 static entries)
13
SHORTREL(lock.listLock)
14
for(;;)
15
{
16
check owner
17
mov eax, 1
18
lock cmpxchg lock.lock, eax
19
if(!eax) break; // got lock
20
Threads_Sleep();
21
}
22
}
23
24
LONGREL()
25
lock and lock.lock, 0
26
pop off front of list, free entry, wake thread
UCC
git Repository :: git.ucc.asn.au