Date: Sun, 28 Jul 1996 10:58:27 -0400 (EDT) From: David M Barrett To: j DOT aldrich6 AT genie DOT com cc: djgpp AT delorie DOT com Subject: Re: Flat Memory Questions In-Reply-To: <199607271545.AA278222309@relay1.geis.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Wow, thanks a lot. I to malloc a meg and it worked just fine. But, when I tried to defind a static array (ie- char Array[1024 * 1024]) I got a wierd runtime error Exiting due to signal SIGSEGV Stack fault at ... eax=... ebp=... Call from traceback EIPs: 0x000015b9 (the ...'s should be replaced with a ton of numbers and info). I tried to allocate the array on the first line of the main function. The rest of the program is simply printf statements (except for a line that sets one of the array values to 5, but it never gets that far). Is there something wrong with allocating a buffer this way? Thanks a lot for all of your help! -David :) ----------------------------------------------------------------------------- David M. Barrett :) | University of Michigan / CAEN Hotline dbarrett AT engin DOT umich DOT edu | http://www-personal.engin.umich.edu/~dbarrett ----------------------------------------------------------------------------- On Sat, 27 Jul 1996 j DOT aldrich6 AT genie DOT com wrote: > Reply to message 2198889 from DBARRETT AT SRVR on 07/26/96 3:14PM > > > >Ok, I admit it: I've just recently started experimented with DJGPP. But, > >I have searched long and hard for documentation describing how to set the > >computer into Protected Mode with the Flat Memory option but have been > >unsuccessful. Could someone please point me to a tutorial or something > >(or describe the process) to do this: > > > >1. Set the computer into PM with Flat addressing > >2. Allocate a simple "char Array[1024*1024]" (for example) > >3. Dynamically allocate memory in large chunks. > > This is all done automatically for you by the DJGPP startup code. You > don't have to touch a thing; you can just begin programming and allocating > however much memory you want as soon as you get DJGPP. Since > DJGPP _only_ runs in protected mode, I can't see any circumstance > where you'd need to make the switch yourself. Switching back to real > mode to handle DOS calls and interrupts is also handled transparently > by the DJGPP code, via __dpmi_int(), int86(), and other library functions. > > The great thing to remember about protected mode is that YOU, the > programmer, never have to worry about segments, limits on memory > allocation, far/near pointers, interrupt handling, low-level i/o calls, > virtual memory, memory management, or ANY of the various aspects > of protected-mode operation unless you want or need to interface > with these directly for the purposes of the programs you're writing. > (wow, what a sentence! :O) > > >I've looked around a bit through the DPMI functions, but I don't > >understand the difference between them. Could someone please explain > >them to me? Thanks! > > Each DPMI function is simply a wrapper for a DPMI interrupt call. For > an exact description of DPMI functions, download and read the DPMI > 0.9 spec, pointers to which can be found in the FAQ (faq201b.zip). For > the differences between the _go32_dpmi_ * functions and the __dpmi_* > functions, read the section of the FAQ detailing these differences. > > If you _really_ want to know how to switch into and out of pmode manually, > you can examine the stub.asm code (djgpp/src/stub/stub.asm), as well as > the sources for cwsdpmi (csdpmi2s.zip), the free DPMI host provided with > DJGPP. Another possible place for information would be the library source > code for __dpmi_int() and the other __dpmi_ functions (download djlsr200.zip). > The DPMI spec also covers this topic, but it's far too complex an issue to > explain in a brief post. > > John >