New to djgpp. Questions about protected mode, etc.

New to djgpp. Questions about protected mode, etc.

Post by Teec » Thu, 24 Jul 2003 01:34:52



Please bear with me since I am not all that sure about how to ask the questions that I have.

I have an application that I want to develop for the PC with special hardware that will run on the PCI bus. I will need to send data from the program directly to the hardware. It is not necessary that I use a sophisticated operating system like XP or even any version of Windows. Therefore I can avoid the difficulty of writing Windows device drivers for the new hardware, etc.

I suppose that I could go a couple of ways. One way would be to use good old DOS, which does not run in protected mode, and use DJGPP (or VC1.52, I think) to obtain an executable.  Since DOS does not know about protected mode I would not cause a segmentation fault when I directly access the PCI hardware. Is this correct?

I was reading in the DJGPP documentation that DJGPP has a DOS extender. This was described as a layer of software that "traps the call, switches the CPU to real mode, reissues the call, waits for the service to do its thing, then switches the CPU back into protected mode, and returns to the application code that called the real-mode service".

Does Windows have a DOS extender? Is it not possible to run old DOS programs on XP in what passes for a DOS emulator?

Does Linux have a DOS extender? Will an executable made with DJGPP run on Linux?

Thank You
Tom

 
 
 

New to djgpp. Questions about protected mode, etc.

Post by Ben Peddel » Thu, 24 Jul 2003 01:52:57



> Please bear with me since I am not all that sure about how to ask the
> questions that I have.

> I have an application that I want to develop for the PC with special
> hardware that will run on the PCI bus. I will need to send data from the
> program directly to the hardware. It is not necessary that I use a
> sophisticated operating system like XP or even any version of Windows.
> Therefore I can avoid the difficulty of writing Windows device drivers
> for the new hardware, etc.

> I suppose that I could go a couple of ways. One way would be to use good
> old DOS, which does not run in protected mode, and use DJGPP (or VC1.52,
> I think) to obtain an executable.  Since DOS does not know about
> protected mode I would not cause a segmentation fault when I directly
> access the PCI hardware. Is this correct?

Yes.
You can also use the PCI BIOS in real mode or protected mode.
You can read and write PCI Configuration Registers using the PCI BIOS,
then do direct I/O to the memory and ports of the device.

Quote:> I was reading in the DJGPP documentation that DJGPP has a DOS extender.
> This was described as a layer of software that "traps the call, switches
> the CPU to real mode, reissues the call, waits for the service to do its
> thing, then switches the CPU back into protected mode, and returns to
> the application code that called the real-mode service".

Actually, DJGPP uses DPMI. It only switches to V86 mode when it needs to
issue a real-mode call (such as Disk I/O), or an interrupt which is not
fully handled by the program.

Quote:> Does Windows have a DOS extender? Is it not possible to run old DOS
> programs on XP in what passes for a DOS emulator?

Windows has DPMI. Alas, Windows NT/2k/XP do not permit direct port I/O
without being severly hampered ("helped").

Quote:> Does Linux have a DOS extender? Will an executable made with DJGPP run
> on Linux?

A compiled DJGPP executable will not run natively on Linux.
However, a DJGPP program can be easily ported to Linux (provided you
don't use too much DJGPP-specific stuff).

You'd need to make a kernel module to access the ports of the device.

 
 
 

New to djgpp. Questions about protected mode, etc.

Post by Teec » Thu, 24 Jul 2003 03:27:30


Ben,

Thank you for the reply.

One other question:

I went to the DJGPP download site and they wanted to know what operating
system I wanted to use. I think that they are assuming that the compiler
will be run on the same operating system that the executables will run on.
Well, the answer is that I want to use the compiler/assembler on WinXP or
Win2K (or even Win98). But I want to run the executables under MSDOS. What
should I say when downloading DJGPP? My expectation is that the compiler
will run on any of the operating systems but the executable determines if
there is a DOS extender needed, so my guess is that if I want to run the
executables on DOS then that is the version that I download.

Thank You for your help



> > Please bear with me since I am not all that sure about how to ask the
> > questions that I have.

> > I have an application that I want to develop for the PC with special
> > hardware that will run on the PCI bus. I will need to send data from the
> > program directly to the hardware. It is not necessary that I use a
> > sophisticated operating system like XP or even any version of Windows.
> > Therefore I can avoid the difficulty of writing Windows device drivers
> > for the new hardware, etc.

> > I suppose that I could go a couple of ways. One way would be to use good
> > old DOS, which does not run in protected mode, and use DJGPP (or VC1.52,
> > I think) to obtain an executable.  Since DOS does not know about
> > protected mode I would not cause a segmentation fault when I directly
> > access the PCI hardware. Is this correct?

> Yes.
> You can also use the PCI BIOS in real mode or protected mode.
> You can read and write PCI Configuration Registers using the PCI BIOS,
> then do direct I/O to the memory and ports of the device.

> > I was reading in the DJGPP documentation that DJGPP has a DOS extender.
> > This was described as a layer of software that "traps the call, switches
> > the CPU to real mode, reissues the call, waits for the service to do its
> > thing, then switches the CPU back into protected mode, and returns to
> > the application code that called the real-mode service".

> Actually, DJGPP uses DPMI. It only switches to V86 mode when it needs to
> issue a real-mode call (such as Disk I/O), or an interrupt which is not
> fully handled by the program.

> > Does Windows have a DOS extender? Is it not possible to run old DOS
> > programs on XP in what passes for a DOS emulator?

> Windows has DPMI. Alas, Windows NT/2k/XP do not permit direct port I/O
> without being severly hampered ("helped").

> > Does Linux have a DOS extender? Will an executable made with DJGPP run
> > on Linux?

> A compiled DJGPP executable will not run natively on Linux.
> However, a DJGPP program can be easily ported to Linux (provided you
> don't use too much DJGPP-specific stuff).

> You'd need to make a kernel module to access the ports of the device.

 
 
 

New to djgpp. Questions about protected mode, etc.

Post by DJ Delori » Thu, 24 Jul 2003 04:23:35


Quote:> I went to the DJGPP download site and they wanted to know what
> operating system I wanted to use. I think that they are assuming
> that the compiler will be run on the same operating system that the
> executables will run on.

Mostly.

Quote:> Well, the answer is that I want to use the compiler/assembler on
> WinXP or Win2K (or even Win98). But I want to run the executables
> under MSDOS. What should I say when downloading DJGPP?

Say XP until after you have it installed and running.  Then go back
and say MS-DOS to get anything else you might need (It's just
cwsdpmi).  The installation instructions are customized according to
the OS, so you really want to specify the machine you're running the
compiler on.  The only packages picked according to OS are: cwsdpmi
for DOS runtime, and unzip32.exe for non-dos installs.

Quote:> My expectation is that the compiler will run on any of the operating
> systems but the executable determines if there is a DOS extender
> needed, so my guess is that if I want to run the executables on DOS
> then that is the version that I download.

There is only one compiler, so you won't be downloading different
versions of some files.
 
 
 

New to djgpp. Questions about protected mode, etc.

Post by Paul Cousouli » Thu, 24 Jul 2003 11:28:41


Hi Teece,

I just did a similiar project to test some hardware. I ran DJGPP on a
WIN98 platform. The biggest problem is setting a DMA buffer. The XMS
does not work in WIN98. I had to write a VDS driver to create a buffer
and the buffer size is extremely limited. If you use DOS you don't have
these problems. I stuck with WIN98 because, I like using TextPad to edit
my code, rebooting in dos is time consuming and my real purpose was to
test an FPGA.

Paul


> Please bear with me since I am not all that sure about how to ask the
> questions that I have.

> I have an application that I want to develop for the PC with special
> hardware that will run on the PCI bus. I will need to send data from
> the program directly to the hardware. It is not necessary that I use a
> sophisticated operating system like XP or even any version of Windows.
> Therefore I can avoid the difficulty of writing Windows device drivers
> for the new hardware, etc.

> I suppose that I could go a couple of ways. One way would be to use
> good old DOS, which does not run in protected mode, and use DJGPP (or
> VC1.52, I think) to obtain an executable.  Since DOS does not know
> about protected mode I would not cause a segmentation fault when I
> directly access the PCI hardware. Is this correct?

> I was reading in the DJGPP documentation that DJGPP has a DOS
> extender. This was described as a layer of software that "traps the
> call, switches the CPU to real mode, reissues the call, waits for the
> service to do its thing, then switches the CPU back into protected
> mode, and returns to the application code that called the real-mode
> service".

> Does Windows have a DOS extender? Is it not possible to run old DOS
> programs on XP in what passes for a DOS emulator?

> Does Linux have a DOS extender? Will an executable made with DJGPP run
> on Linux?

> Thank You
> Tom


 
 
 

1. DOS extenders, DPMI, protected/real mode, etc.

Can anyone point me towards some documentation on these subjects.  I'm not the
one writing the code, but I need some more info regarding what is/is not
possible when using these.

Thanks

\-----------------------------------------------------------------\

/-----------------------------------------------------------------/

2. Wintune95

3. To UCALC users (new: TSR mode 6K, etc...)

4. Do I need all of these Win 95 network components installed?

5. Question : Conversion to Protected-Mode

6. FREE Sharp Hardware and Manual

7. questions on protected mode&ISR

8. Installing Warp II

9. Questions about protected mode interrupt handler

10. Protected Mode Questions

11. TV & Protected mode ( a foolish question ?)

12. protected mode IDT question

13. Protected mode Question