delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/02/05:02:58

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: <ranla.141.0007BEE0@post.tau.ac.il>
References: <ranla DOT 132 DOT 00089E39 AT post DOT tau DOT ac DOT il> <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

- Raw text -


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