delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/11/20:00:00

From: moskewicz AT MEM DOT po DOT com
Date: Sat, 11 May 1996 19:57:02 -0400
Message-Id: <9605112357.AA18465@mercury>
To: djgpp AT delorie DOT com
Subject: Loading Selectors

	I've been using extended asm for a while, and read the info info, as
well as Brennan's guide (though by the time it was avalible, I'd had to
piece things together myself). I've noticed that there are no
constraints for the segment (selector) registers. Is this beacuse they
must be loaded via another register anyway? If I want to have my
selector loads done automatically, why can't I use "a" each time? In
other words, why doesn't this work:
asm("
    push  %%ds
    push  %%es
    movw %3, %%es
    movw %4, %%ds
1:
    movl %%es:(,%0,1),%%eax
    add  $0x4, %0
    movl %%eax,%%ds:(,%1,1)
    add  $0x4, %1
    decl %2
    jnz  1b
    pop  %%es
    pop  %%ds
    "
    : // no outputs
    :"D"(gr_offset_offset),"S"(true_gr_offset),"c"(mode.WinSize*256)
     ,"a"(gr_selector),"a"(true_gr_selector) <-- this gives trouble, GCC
complains that "asm requires too many reloads"
    :"%eax"
    );
I know it works if I use:
	,"b"(gr_selector),"a"(true_gr_selector)
or some varient thereof, but why should I have to?
BTW: these variables are public data members, and this code sits in a
member function.
----
moskewicz AT mem DOT po DOT com

- Raw text -


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