|
Last change
on this file was
2,
checked in by phkim, 11 years ago
|
|
1.phkim
- revision copy newcon3sk r27
|
-
Property svn:executable set to
*
|
|
File size:
526 bytes
|
| Line | |
|---|
| 1 | .text |
|---|
| 2 | .set noreorder |
|---|
| 3 | # Atomic compare and swap. Atomicaly reads unsigned value at addr, compares it |
|---|
| 4 | # with compare value and if matches replaces value at addr with swap. |
|---|
| 5 | # returns 1 if successfuly swapped value 0 if not. |
|---|
| 6 | # extern prototype |
|---|
| 7 | # unsigned CAS(unsigned * addr, unsigned compare, unsigned swap) |
|---|
| 8 | .globl CAS |
|---|
| 9 | CAS: |
|---|
| 10 | ll $8, 0($4) |
|---|
| 11 | bne $8, $5, exit |
|---|
| 12 | or $2, $0, $0 |
|---|
| 13 | sc $6, 0($4) |
|---|
| 14 | or $2, $6, $0 |
|---|
| 15 | exit: |
|---|
| 16 | j $31 |
|---|
| 17 | nop |
|---|
| 18 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.