delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2007/10/26/04:01:46

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Martin Steuer <martin AT x DOT invalid>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Using inline asm
Date: Fri, 26 Oct 2007 09:51:04 +0200
Lines: 19
Message-ID: <5odkjbFm2rdnU1@mid.dfncis.de>
References: <471FEAC8 DOT 5179 DOT 2FAB88DB AT gerritvn DOT gpvno DOT co DOT za>, <ffpkhp$p9o$1 AT aioe DOT org> <47207D00 DOT 5963 DOT 31E6A13C AT gerritvn DOT gpvno DOT co DOT za>
Mime-Version: 1.0
X-Trace: news.dfncis.de 3AffOWOjkOsb8eDuXcbBQAaqK1/RyL4txwBmpgghNlilcGBcKbkGCUFfkO
Cancel-Lock: sha1:l4hRYxkscXecKzBJc8lfidZ1anU=
User-Agent: IceDove 1.5.0.14pre (X11/20071018)
In-Reply-To: <47207D00.5963.31E6A13C@gerritvn.gpvno.co.za>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Gerrit van Niekerk schrieb:
>>>    asm ("cpuid" : "=a" (iRet) : : "ebx", "ecx", "edx");
>> Thanks.  Okay, it doesn't, so correct the code...  I wasn't sure if the asm
>> directive inserted a pusha; popa combination into the stackframe, say
>> instead of push ebp; pop ebp, or used some other method.  That might mess up
>> returns...
> 
> Thanks DJ and RP - you put me on the right track.
> My example was just a simplified version to show my main problem. For other people who 
> battle with the same problem, here is my full code. The stack frame and saving of registers 
> are taken care of by GCC - I checked with GDB and the code runs without crashing :)
> 

Just a hint, for checking the generated code you may also let gcc output
the assembler source via:

gcc -S input.c -o output.S

Martin

- Raw text -


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