Home‎ > ‎2012讀書會‎ > ‎

2012-05-29


2012-05-29
第11次星系統社群小聚:MIT OSE 讀書會: 複習Lab3 與預習Lab4背景知識
 
System call overview
 
Preparation for Lab 4 overview
 
 
lock:                        ; The lock variable. 1 = locked, 0 = unlocked.
     dd      0
 
spin_lock:
     mov     eax, 1         
     xchg    eax, [lock]   ; Atomically swap EAX register with lock variable.
     test      eax, eax    
     jnz       spin_lock  
     ret
 
spin_unlock:
     mov     eax, 0          ; Set the EAX register to 0.
     xchg    eax, [lock]   ; Atomically swap EAX register with lock variable.
     ret                            ; The lock has been released.
 
 
xchg --> cmpxchgl ??
 
lock cmpxchgl %edx, (%eax)



Comments