Mail Archives: djgpp-workers/1999/06/03/02:48:49
On Wed, 2 Jun 1999, Charles Sandmann wrote:
> > Won't that cause crashes and other trouble? The DPMI host will see
> > the value of ECX and copy that many words onto the RM stack. Are we
> > sure there will be enough stack space to push twice the amount of
> > data? The DPMI spec seems to ensure only 30 words of stack provided
> > by the DPMI host, and recommends to put non-zero values into the RM
> > SS:SP beyond that.
>
> My point is that if anyone is actually using this feature, they
> probably have coded it up so that it works... and it's silly for
> us to request "bytes" when the spec specifies "words" and will
> copy only an even number anyway. So, I say we fix the documentation
> to match the current code.
I don't see how the docs alone can be changed to fix this.
The problem is that the code does copy the values to the PM stack as
bytes (it uses "REP MOVSB"), but then it sticks the same number of bytes
into ECX, where the DPMI function expects the number of words. This will
cause some of the RM stack to use twice as large space, and to have garbage
in some of it.
So to fix this, we need to right-shift the argument before putting it in
ECX. Then the docs could be left alone. Alternatively, we could change
the docs to say "words" and change the code to use MOVSW instead of MOVSB
when copying to the PM stack.
- Raw text -