delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/17/03:16:18

Date: 15 Nov 1997 13:23:00 +0100
From: mjs AT prg DOT hannover DOT sgh-net DOT de (Mark Junker)
Newsgroups: comp.os.msdos.djgpp
Message-ID: <6huJRA4O8gB@prg.hannover.sgh-net.de>
References: <Pine DOT LNX DOT 3 DOT 91 DOT 971113115915 DOT 3133A-100000 AT aditya DOT unigoa DOT ernet DOT in>
Subject: Re: Bug in NASM (possibly old)
Lines: 27
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Prev. Author: grbhat AT unigoa DOT ernet DOT in
      Date:   13.11.97
      Subject:"Bug in NASM (possibly old)"

> 	When I push a segment register
> 	push cs
> 	the stack pointer gets decremented by 4 instead of 2.
This is *not* a bug when you're in 32 bit mode! When you have a RETF it will  
at least remove 8(!) bytes (instead of 6) from the stack. Pls. take a look at  
Intels 386+ documentation ...

BTW: "mov eax,cs" works in 32bit PM too! Faster than a "mov ax,cs // movzx  
eax,ax"!

> 	If any NASM watcher/user has a patch for this, I
> 	would be grateful for pointers.
Perhaps: o16 push cs
.. or:   db 66h
         push cs

The "o16 push cs" is the 'more compatible' form that allows easy switching of  
the caller from 16bit to 32bit PM because the 66h prefix will only be  
generated when in 32bit mode.

Regards, MJS
Use it: _PB3.2 & PREP_ / _ASM & PREASM_

- Raw text -


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