www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/07/31/09:38:29

From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Inline Assembly and return value of a function
Date: 31 Jul 2002 07:50:42 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 18
Message-ID: <ai84si$g8b$1@nets3.rz.RWTH-Aachen.DE>
References: <5 DOT 0 DOT 2 DOT 1 DOT 2 DOT 20020730223902 DOT 009e37d0 AT pop DOT gmx DOT net>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 1028101842 16651 137.226.32.75 (31 Jul 2002 07:50:42 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 31 Jul 2002 07:50:42 GMT
Originator: broeker@
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Martin Steuer <martinSteuer AT gmx DOT de> wrote:
>     __asm__ __volatile(
>             "bswapl %1\n"
>             : "=r"(swapped)
>             : "r"(v)
>             );

> Now the problem: the return statement doesnt move the result of bswap() 
> into eax, thus some garbage is returned.

You're not telling GCC that 'swapped' is supposed to be in the same
register as 'v'.  I think you had best get rid of 'swapped'
altogether.  Either that, or do as the Linux code snippet posted by
DJ: reference the input register in the output specification, so GCC
knows these two registers are supposed to be the same.
-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019