Subversion Repositories HelenOS

Rev

Rev 3162 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3162 Rev 3794
Line 57... Line 57...
57
    long tmp, v;
57
    long tmp, v;
58
 
58
 
59
    asm volatile (
59
    asm volatile (
60
        "1:\n"
60
        "1:\n"
61
        "   ll %0, %1\n"
61
        "   ll %0, %1\n"
62
        "   addiu %0, %0, %3\n" /* same as addi, but never traps on overflow */
62
        "   addu %0, %0, %3\n"  /* same as add, but never traps on overflow */
63
        "       move %2, %0\n"
63
        "       move %2, %0\n"
64
        "   sc %0, %1\n"
64
        "   sc %0, %1\n"
65
        "   beq %0, %4, 1b\n"   /* if the atomic operation failed, try again */
65
        "   beq %0, %4, 1b\n"   /* if the atomic operation failed, try again */
66
        /*  nop */      /* nop is inserted automatically by compiler */
66
        /*  nop */      /* nop is inserted automatically by compiler */
-
 
67
        "   nop\n"
67
        : "=&r" (tmp), "+m" (val->count), "=&r" (v)
68
        : "=&r" (tmp), "+m" (val->count), "=&r" (v)
68
        : "i" (i), "i" (0)
69
        : "r" (i), "i" (0)
69
        );
70
        );
70
 
71
 
71
    return v;
72
    return v;
72
}
73
}
73
 
74