delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/07/23/20:15:34

From: jbs30000 AT aol DOT com (Joel)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Quick and Easy DJGPP extended inline assembly question.
Date: 23 Jul 2003 17:12:54 -0700
Organization: http://groups.google.com/
Lines: 31
Message-ID: <84e4e2a9.0307231612.61275b4e@posting.google.com>
References: <84e4e2a9 DOT 0307211839 DOT 3b86f7d0 AT posting DOT google DOT com> <200307221324 DOT h6MDOhLl019991 AT envy DOT delorie DOT com> <84e4e2a9 DOT 0307222057 DOT 2b678b5d AT posting DOT google DOT com> <200307231241 DOT h6NCfbvk000773 AT envy DOT delorie DOT com>
NNTP-Posting-Host: 152.163.252.163
X-Trace: posting.google.com 1059005575 12874 127.0.0.1 (24 Jul 2003 00:12:55 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: 24 Jul 2003 00:12:55 GMT
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:<200307231241 DOT h6NCfbvk000773 AT envy DOT delorie DOT com>...
> > __asm__ __volatile__(
> > "movw %w0, %%fs\n"
> > ".byte 0x64 \n"
> > "movb %b1, (%k2)"
> > :
> > : "rm" (selector), "qi" (value), "r" (offset));
> > }
>  
> > Looking at the "rm" (selector) and "movw %w0, %%fs" parts, I assume
> > that this allows selector to be placed directly into the fs register,
> > right?
> 
> Yes.  It can be copied from a register ("r") or an immediate value can
> be used ("i").
> 
> > Also, "qi" (value) moves value directly into al?
> 
> "value" gets put into either al, bl, cl, dl ("q"), or an immediate
> value can be used ("i").
> 
> "offset" is put into any 16-bit register (ax, bx, si, etc) ("r").
> 
> In both cases, the compiler will use whatever selection is optimal for
> the program.
> 
> The "b" in "%b1" means it's a byte.  The "k" in "%k2" means it's a
> dword (4 bytes).
Yeah, I knew about the "b" and "k" but I didn't know about combining
constraints, like ri and qi to allow an either/or situation.  That's a
good thing to know, thanks.

- Raw text -


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