I was having a little trouble with semaphores on my A5000.  The code to decide 
when to wake up other tasks appeared not to be doing the right thing, which 
was causing processes to get stuck forever in __down_failed and similar places.

First I tried changing `orrls' to `orrle' in the implementation of up() which 
seemed to improve things but not actually make everything work.  I've appended 
below the patch that I ended up using which seems to do the trick but isn't 
very optimal.

Has anybody else seen this effect?  The good news is that my A5k is now 
working more reliably with a 2.2 kernel than ever before, including ELF shared 
libraries. :-)

p.

--- include/asm-arm/proc-armo/semaphore.h       Tue May  4 18:52:44 1999
+++ include/asm-arm/proc-armo/semaphore.h       Sat May 15 15:28:44 1999
@@ -94,19 +94,16 @@
        @ atomic up operation
        mov     r0, pc
        orr     lr, r0, #0x08000000
-       and     r0, r0, #0x0c000003
        teqp    lr, #0
        ldr     lr, [%0]
-       adds    lr, lr, #1
+       add     lr, lr, #1
        str     lr, [%0]
-       mov     lr, pc, lsr #28
-       orrls   r0, r0, #0x80000000     @ set N
-       teqp    r0, lr, lsl #28
-       movmi   r0, %0
-       blmi    " SYMBOL_NAME_STR(__up_wakeup)
+       teqp    r0, #0"
                :
                : "r" (sem)
-               : "r0", "lr", "cc");
+               : "r0", "lr");
+       if (atomic_read(&sem->count) <= 0)
+               __up (sem);
 }
 
 #endif


unsubscribe: body of `unsubscribe linux-arm' to [EMAIL PROTECTED]

Reply via email to