Date: Fri, 14 Nov 1997 23:18:12 +0000 ( ) From: "Gurunandan R. Bhat" To: Ove Kaaven Cc: djgpp AT delorie DOT com Subject: Re: Bug in NASM (possibly old) In-Reply-To: <346d8df5.363768329@news.arcticnet.no> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Sat, 15 Nov 1997, Ove Kaaven wrote: > "Gurunandan R. Bhat" 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.....