www.delorie.com/djgpp/faq/running/dpmi-crash.html   search  
When I run my program under Windows or another DPMI server, it crashes, but not outside of Windows, or when I add ``nodpmi'' to the GO32 environment variable.

You may have used the -fomit-frame-pointer option to gcc. This tells gcc that it can use ebp as a general register. However, the selector used for the stack is protected against access outside of calculated stack range, and ebp causes the stack selector to be used. If you use this to access memory in the regular data area, you get a protection fault. This mechanism is present to prevent you from using so much stack that you begin corrupting data. Outside of Windows, or in non-DPMI mode, a different method is used to detect stack overrun, so you don't see this fault.

As a general rule, don't use -fomit-frame-pointer when compiling djgpp programs. If you must, you will have to tweak crt0.s to produce a custom crt0.o which under DPMI sets ss=ds.

Also, some programmers take advantage of the features that go32 can only provide when not under DPMI, like graphics, floating point emulation, or the dos memory map at 0xe0000000.


  webmaster     delorie software   privacy  
  Copyright © 1995     Updated Feb 1995