X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: "Carey Evans" Newsgroups: comp.os.msdos.djgpp Subject: Re: inline asm Date: 3 Jul 2005 19:03:59 -0700 Organization: http://groups.google.com Lines: 29 Message-ID: <1120442639.225239.207870@g47g2000cwa.googlegroups.com> References: NNTP-Posting-Host: 210.54.0.162 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1120442644 24811 127.0.0.1 (4 Jul 2005 02:04:04 GMT) X-Complaints-To: groups-abuse AT google DOT com NNTP-Posting-Date: Mon, 4 Jul 2005 02:04:04 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse AT google DOT com Injection-Info: g47g2000cwa.googlegroups.com; posting-host=210.54.0.162; posting-account=a2Dz9g0AAAAQI7DN4N6e935Thq5XWCRh To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com GNU_man wrote: > Has anyone successfuly using inline asm in DJGPP C programs? I'm using the _far* functions quite a bit, and they're written as inline assembly in include/sys/farptr.h. I've also written my own assembly like the examples below without any problems: static void cpuid( unsigned arg, unsigned *a, unsigned *b, unsigned *c, unsigned *d) { asm("cpuid" : "=a" (*a), "=b" (*b), "=c" (*c), "=d" (*d) : "0" (arg)); } static int bsf(unsigned long val) { int bit, tmp; asm("xorl %0,%0\n\t" "bsfl %2,%1\n\t" "jz 1f\n\t" "leal 1(%1),%0\n" "1:" : "=&q" (bit), "=q" (tmp) : "X" (val) : "cc"); return bit; } -- Carey Evans