Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Dec 2004 12:23:02 -0800
From:      John-Mark Gurney <gurney_j@resnet.uoregon.edu>
To:        Sean McNeil <sean@mcneil.com>
Cc:        amd64@freebsd.org
Subject:   Re: what is the proper asm spec for xchg
Message-ID:  <20041223202302.GG19624@funkthat.com>
In-Reply-To: <1103830283.53421.3.camel@server.mcneil.com>
References:  <1103830283.53421.3.camel@server.mcneil.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Sean McNeil wrote this message on Thu, Dec 23, 2004 at 11:31 -0800:
> I'm looking at why audio/sdl_mixer will not compile and I see that
> devel/sdl12 has an include with
> 
> #elif defined(__GNUC__) && defined(__x86_64__)
> static __inline__ Uint16 SDL_Swap16(Uint16 x)
> {
>         __asm__("xchgb %b0,%h0" : "=q" (x) :  "0" (x));
>         return x;
> }
> 
> This appears to be incorrect as it is giving errors when compiled.  Does
> anyone more conversant with asm directives for amd64 have an idea what
> this should be?

well, from amd64/include/endian.h:
#define __byte_swap_word_var(x) \
__extension__ ({ register __uint16_t __X = (x); \
   __asm ("xchgb %h0, %b0" : "+Q" (__X)); \
   __X; })

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041223202302.GG19624>