| delorie.com/archives/browse.cgi | search |
| X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
| From: | RayeR <glaux AT centrum DOT cz> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Using inline asm |
| Date: | Sun, 28 Oct 2007 19:46:23 -0700 |
| Organization: | http://groups.google.com |
| Lines: | 24 |
| Message-ID: | <1193625983.368281.325560@57g2000hsv.googlegroups.com> |
| References: | <471FEAC8 DOT 5179 DOT 2FAB88DB AT gerritvn DOT gpvno DOT co DOT za> |
| <200710250120 DOT l9P1KEb2032374 AT envy DOT delorie DOT com> | |
| <1193303455 DOT 688747 DOT 180190 AT 50g2000hsm DOT googlegroups DOT com> | |
| <200710251524 DOT l9PFOeNi022585 AT envy DOT delorie DOT com> | |
| NNTP-Posting-Host: | 89.176.103.47 |
| Mime-Version: | 1.0 |
| X-Trace: | posting.google.com 1193625983 17849 127.0.0.1 (29 Oct 2007 02:46:23 GMT) |
| X-Complaints-To: | groups-abuse AT google DOT com |
| NNTP-Posting-Date: | Mon, 29 Oct 2007 02:46:23 +0000 (UTC) |
| In-Reply-To: | <200710251524.l9PFOeNi022585@envy.delorie.com> |
| User-Agent: | G2/1.0 |
| X-HTTP-UserAgent: | Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1.6) Gecko/20070802 SeaMonkey/1.1.4,gzip(gfe),gzip(gfe) |
| Complaints-To: | groups-abuse AT google DOT com |
| Injection-Info: | 57g2000hsv.googlegroups.com; posting-host=89.176.103.47; |
| posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 | |
| 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 |
> In the case of gcc, it means "changes in a way that is not known to
> gcc". GCC will make no assumptions about the contents of the register
> after the asm.
Thanks all for explanation, so if I understand well, the example by
Peter show it right:
>asm("cpuid" : "=a" (eax) : "a" (level) : "ebx", "ecx", "edx");
The last part of asm block lists the "clobbered" registers which was
changed by CPUID
and we need to tell GCC to restore them automatically - so no push/pop
needed around.
eax is excluded because it is input/output parameter so GCC knows it
was changed because
it had to put the value from a variable to eax.
When I needed some inline asm i looked for examples on the internet
and not all of it
was using the clobber list so it was confusing. I'll have to check my
src if I not
forget it somewhere but I think I was paranoic and used push/pop
instead..
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |