Mail Archives: djgpp/2003/07/23/20:15:34
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 -