5 * first argument (l) is in r3 at entry.
6 * r3 contains return value upon return.
13 * this __asm__ works with gcc 2.95.2 (mac os x 10.1).
14 * this assembly language destroys r0 (0), some other register (v),
15 * r4 (x) and r5 (temp).
19 " mr r4,%1 /* &l->val */\n"
20 " lis r5,0xdead /* assemble constant 0xdeaddead */\n"
21 " ori r5,r5,0xdead /* \" */\n"
23 " dcbf r4,r0 /* cache flush; \"fix for 603x bug\" */\n"
24 " lwarx %0,r4,r0 /* v = l->val with reservation */\n"
25 " cmp cr0,0,%0,r0 /* v == 0 */\n"
27 " stwcx. r5,r4,r0 /* if (l->val same) l->val = 0xdeaddead */\n"
34 : "cc", "memory", "r0", "r4", "r5"
38 case 0xdeaddead: return 1;
39 default: fprint(2, "tas: corrupted 0x%lux\n", v);