Mail Archives: djgpp/1997/04/27/21:07:21
Guy Rauscher (rauscher AT netvision DOT net DOT il) wrote:
> Hi!
> I'm fairly new to DJGPP and 32bit programming so I have several questions
> regarding memory management in DJGPP:
> What's volatile?
This is not specific to DJGPP or 32bit programming and should have been
discussed wherever you learned C from. Basically, the volatile flag tells
the compiler that the variable may change in ways other than what is
obviously seen in the source. The best example is a variable used by an
interrupt function. Your program will never call your interrupt function
directly, so gcc assumes that the value of your variable never changes.
It will cache it in a register and you will never see the true value.
> What is memory locking, and when and why should I use it?
Memory locking prevents memory from being swapped out even when it isn't
being used. It is only required in programs that hook interrupt vectors.
> A lot of DJGPP programs that I've come across crach sometimes due to
> page faults, etc.; Are there measures that could be taken to prevent
> this from happening such as changing CWSDMPI's parameters or something
> like that? Since Quake uses DJGPP and I guess that they can't afford to
> crash all the time, there must be something to do about this.
Yes. These measures are called careful debugging. ;) Page faults are
caused by incorrect pointers, or having some code page out (swap out)
when it is still potentially in use. The -only- way to prevent page
faults is to debug, debug, debug, and debug some more. You can turn off
NULL pointer protection to stop crashes, but this is akin to turning off
the smoke alarm when there's a fire in the kitchen.
--
Beautiful Savior Evangelical Lutheran Church - av568 AT rgfn DOT epcc DOT edu
We have what you need-- A Savior!
- Raw text -