Mail Archives: djgpp/1997/11/15/22:59:48
On Sat, 15 Nov 1997, Ove Kaaven wrote:
> "Gurunandan R. Bhat" <grbhat AT unigoa DOT ernet DOT in> wrote:
>
> > When I push a segment register
> > push cs
> > the stack pointer gets decremented by 4 instead of 2.
>
> I don't use NASM myself, but this is not a bug. This is correct
> behaviour. When you are working in 32-bit protected mode, all
> quantities pushed onto the stack must be 32-bit (4 bytes) to avoid
> misaligning the stack.
Thank you for pointing this out. What I should have added is that while
"push cs" pushes a 4-byte quantity, "pop cx" pops a 2-byte one. I would
have expected the behaviour to be consistent, especially since cs cannot
be extended :)
> Using 16-bit push/pops on a 32-bit stack is
> generally not acceptable. I suggest fixing your GAS equivalent to read
>
> pushl %cs
>
Will remember that. Though I have seen pushw's in the DJGPP sources. The
good news is that the authors of NASM have released 0.96 yesterday with
extensive documentation and a mention of the fact that "push sreg"
pushes 4 bytes while "push reg16" pushes 2-bytes. They have rferred to
this (feature) behaviour as "slightly odd" :)
Must be exasperating for them to have their feautures reported as bugs.
Must call up to say sorry.....
- Raw text -