www.delorie.com/djgpp/v2faq/faq17_3.html   search  
Node:ASM GPF, Next:, Previous:Converting ASM, Up:Converting

17.3 Converted code GP Faults!

Q: OK, I've succeeded in converting and compiling my assembly-language program, but when I run it, I get "Segmentation Violation" and "General Protection Fault". This program works when compiled with MASM, so how can this be?

A: In DJGPP, your program runs in protected mode. There are certain things you can't do in protected-mode programs (that's why it is called protected mode). This issue is too complex to describe here, so only a few of the more important aspects will be briefly mentioned. If you are serious about writing assembly language protected-mode code, or have a large body of existing code to convert to protected mode, you should read any of the available books about protected-mode programming with 80x86 processors.

Here is a short list of some of the techniques found in many real-mode programs, which will trigger protection violation or erratic behavior in protected mode:

If your code uses one or more of these techniques, refer to low-level programming chapter, which describes the DJGPP facilities that will allow you to rewrite your code.

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2001   by Eli Zaretskii     Updated Apr 2001