• Bug#257513: Patch for this bug

    From Thiemo Seufer@1:229/2 to All on Fri Aug 20 01:30:15 2004
    From: [email protected]

    Hello All,

    the appended patch adds mutex support for mips/mipsel (Regenerating the
    config files of this build system is a PITA).

    Steve, you tagged this bug as sarge-ignore, is this really still
    relevant?


    Thiemo


    --- dbinc/mutex.h.old 2003-09-20 23:40:49.000000000 +0200
    +++ dbinc/mutex.h 2004-08-19 21:26:16.000000000 +0200
    @@ -487,6 +487,48 @@ typedef unsigned char tsl_t;
    #endif

    /*********************************************************************
    + * MIPS/gcc assembly.
    + *********************************************************************/ +#ifdef HAVE_MUTEX_MIPS_GCC_ASSEMBLY
    +typedef u_int32_t tsl_t;
    +
    +#ifndef MUTEX_ALIGN
    +#define MUTEX_ALIGN 4
    +#endif
    +
    +#ifdef LOAD_ACTUAL_MUTEX_CODE
    +/*
    + * For gcc/mips. Should return 0 if could not acquire the lock, 1 if
    + * lock was acquired properly.
    + */
    +static inline int
    +MUTEX_SET(tsl_t *tsl) {
    + register tsl_t *__l = tsl;
    + register tsl_t __r;
    + asm volatile(
    + " .set push \n"
    + " .set mips2 \n"
    + " .set noreorder \n"
    + "1: ll %0, %1 \n"
    + " bnez %0, 1f \n"
    + " nop \n"
    + " addu %0, 1 \n"
    + " sc %0, %1 \n"
    + " beqz %0, 1b \n"
    + " move %0, $0 \n"
    + " sync \n"
    + "1: .set pop \n"
    + : "=&r" (__r), "+m" (*__l)
    + : :