linux-mips
[Top] [All Lists]

quick question on 64-bit values with 32-bit inline assembly

To: linux-mips@linux-mips.org
Subject: quick question on 64-bit values with 32-bit inline assembly
From: "Chris Friesen" <cfriesen@nortel.com>
Date: Mon, 21 Jan 2008 12:09:37 -0600
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla Thunderbird 1.0.2-6 (X11/20050513)
Hi all,

We're running a 64-bit kernel and 32-bit userspace. We've got some code that is trying to get a 64-bit timestamp in userspace.

The following code seems to work fine in the kernel but in userspace it appears to be swapping the two words in the result.

gethrtime(void)
{
   unsigned long long result;

   asm volatile ("rdhwr %0,$31" : "=r" (result));
   return result;
}

Do I need to do something special because userspace is 32-bit? If so, can someone point me to a reference?

Thanks,

Chris Friesen

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