linux-mips
[Top] [All Lists]

Re: [FIX] sysmips(MIPS_ATMIC_SET, ...) ret_from_sys_call vs. o32_ret_fro

To: Ralf Baechle <ralf@oss.sgi.com>
Subject: Re: [FIX] sysmips(MIPS_ATMIC_SET, ...) ret_from_sys_call vs. o32_ret_from_sys_call
From: Joe deBlaquiere <jadb@redhat.com>
Date: Thu, 25 Jan 2001 18:53:44 -0600
Cc: Florian Lohoff <flo@rfc822.org>, linux-mips@oss.sgi.com
Organization: Red Hat, Inc.
References: <20010124163048.B15348@paradigm.rfc822.org> <20010124165919.C15348@paradigm.rfc822.org> <20010125165530.B12576@paradigm.rfc822.org> <3A70705C.5020600@redhat.com> <3A707FFB.60802@redhat.com> <20010125141952.C2311@bacchus.dhis.org>
Sender: owner-linux-mips@oss.sgi.com
User-agent: Mozilla/5.0 (X11; U; Linux 2.2.16-22 i686; en-US; m18) Gecko/20001107 Netscape6/6.0
Ralf,
Thanks for the help. I generally consider myself a pseudo-expert on Linux, but at the same time I'm amazed by how much I learn on a daily basis.

So I've got the following code which seems to work... (I can't use the ll/sc ops on the Vr41xx since they are not implemeted!)

#ifdef CONFIG_CPU_VR41XX
        /* this version is inherently single processor! */
        
        case MIPS_ATOMIC_SET: {
                unsigned int tmp;
                unsigned long flags;

                p = (int *) arg1;
                errno = verify_area(VERIFY_WRITE, p, sizeof(*p));
                if (errno)
                        return errno;
                errno = 0;

                /* the Vr processors can't be SMP, so just lock ints */
                save_and_cli(flags);
                tmp = *p ;
                *p = arg2 ;
                restore_flags(flags);
                return tmp;

        }
#endif

The trailer in the normal call is like :

                /* We're skipping error handling etc.  */
                if (current->ptrace & PT_TRACESYS)
                        syscall_trace();

                __asm__ __volatile__(
                        "move\t$29, %0\n\t"
                        "j\tret_from_sys_call"
                        : /* No outputs */
                        : "r" (&cmd));
                /* Unreached */

Which says "no outputs" although sysmips is specified as

extern int sysmips __P ((__const cmd, __const int arg1,
                         __const int arg2, __const int arg3));

and the usage of this call in glibc pthreads implies that there should be a return value. Should I be bypassing the scheduler to return also?

The end goal of this is to make pthreads work on the Vr4181...it's certainly an interesting task so far...

Ralf Baechle wrote:

On Thu, Jan 25, 2001 at 01:35:23PM -0600, Joe deBlaquiere wrote:


sysmips(MIPS_ATOMIC_SET,ptr,val)
{
         *ptr = val ;
        val 0 ;
}

but it is an atomic operation

if this correct in a pseudo-code sense?


It's more:

sysmips(MIPS_ATOMIC_SET, ptr, val)
{
        result = *ptr;
        *ptr = val;

        return result;
}

   Ralf


--
Joe deBlaquiere
Red Hat, Inc.
307 Wynn Drive
Huntsville AL, 35805
voice : (256)-704-9200
fax   : (256)-837-3839


<Prev in Thread] Current Thread [Next in Thread>