linux-mips
[Top] [All Lists]

why we use multu to implement udelay

To: Linux MIPS Mailing List <linux-mips@linux-mips.org>
Subject: why we use multu to implement udelay
From: loody <miloody@gmail.com>
Date: Sun, 1 Nov 2009 22:18:14 +0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=Rt2L/ZB+Z17wJIaWyEFr4okbRv6QaYlauMGBX+WpmUw=; b=xtrT4Bfb//mT/CwkehSmSCMzruCCyuxLMFPSSwzjOr5hHPVkmFrJ14V/VDFxOovf6m P6HFMavxM7x1+OW1dR/GYkNR7p+78Tf3hhhDxHkIdnhpMAk4bErP2EV1qH9hr1OZdNiZ wJWXM7g40HnB3X0TniU63nwd56L/7HMxzJHWI=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=yDpl2u+Hj5iLSTRTekjQEW6SsaqOUG91d/zNnPgDMhAk8eDMqi5BXPU8FZfmEs6ggO t2LiTl6Rc+kyT6KvP5FvbqXsW5rQNl5ukgTNUhKJROc/f2XKOaLZqhdFLpUnYIJc/78K J8/atAyYEYjhEFpuah7Huz2eTcYQ9PEWE+7VE=
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
Dear all:
If I search the right place in mip kernel, I find the kernel implement
udelay by multu and bnez looping, in 32-bits mode.
        if (sizeof(long) == 4)
                __asm__("multu\t%2, %3"
                : "=h" (usecs), "=l" (lo)
                : "r" (usecs), "r" (lpj)
                : GCC_REG_ACCUM);
        else if (sizeof(long) == 8)
                __asm__("dmultu\t%2, %3"
                : "=h" (usecs), "=l" (lo)
                : "r" (usecs), "r" (lpj)
                : GCC_REG_ACCUM);

        __delay(usecs);
why we doing so instead of using kernel timer function and the
precision will be incorrect if the cpu runs faster or slower, right?
appreciate your help,
miloody

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