www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - weird ebx register behaviour

↑ ↓ ← 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
↑ ↓ 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
↑ ↓ 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
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
↑ ↓ → 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
"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
↑ ↓ 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
↑ ↓ → "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