From: ranla AT post DOT tau DOT ac DOT il (Tal Lavi) Newsgroups: comp.os.msdos.djgpp Subject: Extended ASM (Was: misc questions) Date: Wed, 2 Dec 1998 10:59:01 LOCAL Organization: Tel-Aviv University Computation Center Lines: 40 Message-ID: References: <36634667 DOT C344DF85 AT cartsys DOT com> NNTP-Posting-Host: slip-108.tau.ac.il X-Newsreader: Trumpet for Windows [Version 1.0 Rev B final beta #4] To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com >Tal Lavi wrote: >> >> Just a couple of misc questions, thanks in advance: >> >> 1)Can I define an extended asm command as a macro, >> with one of the outputs value returned? >You can, using GCC's statement-expressions extension. Example: >#define TEST_BIT(n, b) ({ \ > char c; \ > asm("btl %1, %2; " \ > "setcb %0" \ > : "=rm" (c) \ > : "rI" (b), "rm" (n)); \ > c; \ >}) I'm sorry, but that's not really that clear. I checked the info's, but I'm still not that sure what "rI", "rm" does I *think* that rI is a register which holds an integer value, but what does "rm" do? Even more vague is the extended ASM used in sys/farptr.h: { __asm__ __volatile__ ("movw %w0,%%fs \n" " .byte 0x64 \n" " movw %w1,(%k2)" : : "rm" (selector), "ri" (value), "r" (offset)); } Can anyone tell me what does %w0 , %w1, %k2 & .byte 0x64 means? Is there a complete extended asm giude somewhere? The ones I found, explains only the basics. Tal Lavi ranla AT post DOT tau DOT ac DOT il