www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/05/18:47:49

From: "M. Schulter" <mschulter AT value DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: protected mode
Date: 5 Oct 1997 21:53:39 GMT
Organization: Value Net Internetwork Services Inc.
Lines: 58
Message-ID: <619293$76t$1@vnetnews.value.net>
References: <3426EC42 DOT 61DE AT club-internet DOT fr>
NNTP-Posting-Host: value.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Charles Mennerat <nambi AT club-internet DOT fr> wrote:
: Maybe you will think it's a silly question but how can we
: use "protected mode" in djgpp.Do you have to do something special?
: If you use protected mode does that mean if you have 16mo of ram
: your program can use all the ram?

Before attempting a quick and not so expert answer <grin>, I should refer
you to some more informed sources. The DJGPP FAQ includes lots of material
about protected mode, and address some of the basic problems that users
often get into because they try to use real mode code that breaks the
rules of protected mode.

Also, you might want to take a look at a new resource:

http://www.delorie.com/djgpp/doc/ug/

the DJGPP User's Guide, which includes a simple discussion about protected
mode. There is more documentation in preparation by DJGPP users.

Now for my not-so-expert information <grin>.

First of all, DJGPP programs automatically run in 32-bit protected mode as
DPMI (DOS Protected Mode Interface) clients. This is why you need at least
an i386 or compatible to run these programs, together with some DPMI
server. DJGPP itself includes CWSDPMI, a free DPMI server, and various
utilities and environments such as QEMM (QDPMI), 386Max, Windows
3.x/9x/NT, OS/2, and Linux have their own DPMI providers. With DOS and
QEMM, there's a choice to use either QDMPI or CWSDPMI; I tend to use the
latter when writing C or assembler programs, because it has some extra
bug-detection features.

Next, let me emphasize that the protected mode is indeed automatic: each
DJGPP program includes a 2K stub to enter protected mode. For example, I
can write (and have written) DJGPP assembler programs that produce a
32-bit DOS executable in 3K or less! They compile with GAS, the GNU
assembler; Charles W. Sandmann of CWSDPMI fame recently posted an example
to show us the way.

Similarly, C/C++ programs automatically get compiled to include the code
necessary to run in protected mode, and without the need for a special DOS
extender; you just need a DPMI server present to run the program.

With 32-bit protected mode, you can access up to 4G of RAM; the amount of
virtual memory additionally available (swapping to disk if there's not
enough RAM) varies with the DPMI server, but CWSDPMI normally provides up
to 128M, if I'm correct.

In short, you don't have to do anything with DJGPP to get the benefits of
protected mode, but you may have to _avoid_ doing certain things that work
with at least some real-mode DOS compilers or assemblers. For more
details, please see, for example, Sections 10, 17.4, and 18 of the DJGPP
FAQ. 

Most respectfully,

Margo Schulter
mschulter AT value DOT net

- Raw text -


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