PowerPC function returning long long

Bob Doyle doyle at primenet.com
Thu Oct 14 14:12:30 EST 1999


Michael Meissner wrote:
> 
> On Wed, Oct 13, 1999 at 10:06:02AM +0200, Gabriel Paubert wrote:
> >
> > On Wed, 13 Oct 1999, Bob Doyle wrote:
> >

[snip]

> The above doesn't work with -mreg-names and/or -pedantic.  Instead you should
> write:
> 
> unsigned long long get_timebase(void) {
>         unsigned long long retval;
>         unsigned long junk;
>         __asm__ __volatile__ ("\n\
> 1:      mftbu   %1\n\
>         mftb    %L0\n\
>         mftbu   %0\n\
>         cmpw    %0,%1\n\
>         bne     1b"
>         : "=r" (retval), "=r" (junk));
>         return retval;
> }

Thanks, thats just what I was looking for... 

I've found several tutorials on x86 GNU inline asm but none on the
PowerPC.
If I were to write a HOWTO would anyone volunteer to proof read
and/or contribute code examples?  I suspect I'm not the only one 
struggling through this.

Bob Doyle
doyle at primenet.com

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-dev mailing list