www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/15/22:59:48

Date: Fri, 14 Nov 1997 23:18:12 +0000 ( )
From: "Gurunandan R. Bhat" <grbhat AT unigoa DOT ernet DOT in>
To: Ove Kaaven <ovek AT arcticnet DOT no>
Cc: djgpp AT delorie DOT com
Subject: Re: Bug in NASM (possibly old)
In-Reply-To: <346d8df5.363768329@news.arcticnet.no>
Message-Id: <Pine.LNX.3.91.971114231102.1415A-100000@aditya.unigoa.ernet.in>
Mime-Version: 1.0


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 -


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