Subversion Repositories Kolibri OS

Rev

Rev 4872 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. void __mutex_lock(volatile int *val)
  2. {
  3.     int tmp;
  4.  
  5.     __asm__ __volatile__ (
  6. "0:\n\t"
  7.     "mov %0, %1\n\t"
  8.     "testl %1, %1\n\t"
  9.     "jz 1f\n\t"
  10.  
  11.     "movl $68, %%eax\n\t"
  12.     "movl $1,  %%ebx\n\t"
  13.     "int  $0x40\n\t"
  14.     "jmp 0b\n\t"
  15. "1:\n\t"
  16.     "incl %1\n\t"
  17.     "xchgl %0, %1\n\t"
  18.     "testl %1, %1\n\t"
  19.     "jnz 0b\n"
  20.     : "+m" (*val), "=&r"(tmp)
  21.     ::"eax","ebx" );
  22. }
  23.  
  24.