www.digitalmars.com         C & C++   DMDScript  

c++ - weird ebx register behaviour

reply mjs NOSPAM.gmx.de (Mark Junker) writes:
Hi,

while I wrote a module using inline assembler, I saw that DMC assumes that  
EBX will never change. Are there any other registers that must not be altered  
while compiling with -mn?

Best regards,
Mark Junker
Jun 16 2003
parent reply roland <--rv ronetech.com> writes:
Mark Junker wrote:

 Hi,
 
 while I wrote a module using inline assembler, I saw that DMC assumes that  
 EBX will never change. Are there any other registers that must not be altered  
 while compiling with -mn?
 
 Best regards,
 Mark Junker
 
 

16 bit models: must preserve si,di,bp,sp,ss,cs,ds direction flag (df) must stay forward 32 bit models: must preserve ebx,esi,edi,ebp,esp,ss,fs,gs,cs,ds direction flag (df) must stay forward direction flag (df) must stay forward roland
Jun 17 2003
parent reply Heinz Saathoff <hsaat bre.ipnet.de> writes:
roland schrieb...
 32 bit models:
 
 must preserve ebx,esi,edi,ebp,esp,ss,fs,gs,cs,ds
 direction flag (df) must stay forward

Are fs dn gs used at all by the compiler (or RTL)? - Heinz
Jun 18 2003
next sibling parent reply roland <--rv ronetech.com> writes:
Heinz Saathoff wrote:

 roland schrieb...
 
32 bit models:

must preserve ebx,esi,edi,ebp,esp,ss,fs,gs,cs,ds
direction flag (df) must stay forward

Are fs dn gs used at all by the compiler (or RTL)? - Heinz

That is on my Symantec old docs. ( yes paper doc ! ) Never seen fs dn gs used when i disassembled. May be Walter kept them at harm lenght just in case .. by roland
Jun 18 2003
parent Heinz Saathoff <hsaat bre.ipnet.de> writes:
roland schrieb...
 Never seen fs dn gs used when i disassembled.
 May be Walter kept them at harm lenght just in case ..

That's what I also discovered. But I am not sure about the RTL where some support functions are written in assembler. - Heinz
Jun 18 2003
prev sibling parent reply "Walter" <walter digitalmars.com> writes:
"Heinz Saathoff" <hsaat bre.ipnet.de> wrote in message
news:MPG.195a519c170ac08c9896c5 news.digitalmars.com...
 roland schrieb...
 32 bit models:

 must preserve ebx,esi,edi,ebp,esp,ss,fs,gs,cs,ds
 direction flag (df) must stay forward

Are fs dn gs used at all by the compiler (or RTL)?

FS is used by the Win32 operating system for thread-specific data, and is generated by the compiler for SEH stack frames. DS, of course, points to the data segment. I don't know what GS is used for.
Jun 18 2003
parent reply Heinz Saathoff <hsaat bre.ipnet.de> writes:
Walter schrieb...
 FS is used by the Win32 operating system for thread-specific data, and is
 generated by the compiler for SEH stack frames.

What is a SEH stack frame? Has it to do with exception handlers (EH)? - Heinz
Jun 19 2003
parent "Walter" <walter digitalmars.com> writes:
"Heinz Saathoff" <hsaat bre.ipnet.de> wrote in message
news:MPG.195ccc6abe340d149896c7 news.digitalmars.com...
 Walter schrieb...
 FS is used by the Win32 operating system for thread-specific data, and


 generated by the compiler for SEH stack frames.


Structured Exception Handling.
 Has it to do with exception handlers (EH)?

Yup. Compile some code with exceptions enabled, put some classes with destructors on the stack, and OBJ2ASM it.
Jun 20 2003