delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2007/10/24/23:00:09

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Rod Pemberton" <do_not_have AT nohavenot DOT cmm>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Using inline asm
Date: Wed, 24 Oct 2007 22:52:23 -0400
Organization: Aioe.org NNTP Server
Lines: 22
Message-ID: <ffp07f$66t$1@aioe.org>
References: <471FEAC8 DOT 5179 DOT 2FAB88DB AT gerritvn DOT gpvno DOT co DOT za> <200710250120 DOT l9P1KEb2032374 AT envy DOT delorie DOT com>
NNTP-Posting-Host: IVw7K97ih4IohxRqyKkqFw.user.aioe.org
Mime-Version: 1.0
X-Complaints-To: abuse AT aioe DOT org
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-Priority: 3
X-MSMail-Priority: Normal
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"DJ Delorie" <dj AT delorie DOT com> wrote in message
news:200710250120 DOT l9P1KEb2032374 AT envy DOT delorie DOT com...
>
> >    int iRet;
> >    asm ("cpuid");
> >    asm ("movl %eax,%0" : "=g" (iRet));
>
> Should be %%eax
>
> This might work better (because know gcc will know that eax is
> clobbered):
>
> >    asm ("cpuid" : "=a" (iRet));

Huh?  I'm sure I missed something...  That takes care of eax for cpuid, but
that ignores ebx, ecx, and edx.  cpuid trashes those four registers whether
he returns them or not, correct?   How does GCC correct the other three?


Rod Pemberton

- Raw text -


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