Mail Archives: djgpp/1998/02/25/21:13:58
At 08:10 2/25/1998 -0300, Lisandro Puzzolo wrote:
>Hello. My name is Lisandro Puzzolo and I'm working in a research in my
college >(UNR - Rosario - Argentina) that needs some information about
DJGPP. I will be >very glad if you send me some information about the way
DJGPP links 16bit code >with the other code (32bit). My teachers insist that
DJGPP can link 16bit dlls >whith normal 32 bit code.
I think they are wrong. The only ways to link 16-bit code with DJGPP's
32-bit code are described in sections 17.5 and 17.6 of the FAQ, and they are
neither easy nor likely to work well.
> Another thing I need to know, is how DJGPP does the conversion between
32bit >code, that it gererates and the 16bit operating system (DOS) where it
runs. I >know it uses coff2exe, but I need to know how it does it
internallly. Whatever >you send me, it will be gold, because I can't find
anything about this theme.
The short answer is DPMI. This is an interface which provides protected-mode
services to programs. The program which does this is the DPMI server, and
the most common ones are CWSDPMI and Windows.
As for the actual mechanics. When DOS executes a DJGPP program, the first
thing it sees is the EXE stub, a 2K block of code prepended to the COFF
image generated by the linker. This has a valid EXE header, so DOS loads it
like an EXE. The stub is written in assembly and starts out as real-mode
code. It loads the DPMI server if necessary, switches to protected mode, and
loads the COFF image into memory. It then jumps into the 32-bit startup code
from crt0.o. This sets up the stack and various other things, parses the
command line, and then calls `main'.
DOS functions are used via DPMI. DPMI provides services to call real-mode
interrupts, like the DOS ones.
The best way to learn all of this is to read the source. The `djlsr201.zip'
package contains all the source for the DJGPP library and loader.
A few nettiquite issues: Your mailer is not breaking lines. Each paragraph
comes out as one long line. For me, my mailer displays it correctly but
doesn't mark it right when I reply. Also, a copy of your message is being
included in HTML. This is annoying and wasteful of bandwidth. Please see if
you can fix these.
Nate Eldredge
eldredge AT ap DOT net
- Raw text -