Message-ID: <001101be4ba4$90094940$90f9c6c3@johans-dator> From: "Johan Henriksson" To: Subject: Re: paradox! Date: Fri, 29 Jan 1999 17:29:35 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.1 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Reply-To: djgpp AT delorie DOT com from Johan Henriksson, Sweden HTTP://come.to/jhewok | Primary mail: johan DOT he AT telia DOT com #UIN 12035895 Second: jhe75 AT hotmail DOT com Third: johan_he AT yahoo DOT com Leadprogrammer and FX-specialist at Real software http://come.to/real_software ************************************************************************* -----Original Message----- From: DJ Delorie To: djgpp AT delorie DOT com Date: Friday, January 29, 1999 4:22 PM Subject: Re: paradox! > >> 1) what is _djgpp_conventional_base? > >This is the amount you have to add to pointers to make them point to >physical addresses instead of logical addresses, when using nearptr.h. >For example, to point to the VGA memory you'd use this: > > (char *)(0xa0000+_djgpp_conventional_base) > >> the 386 has some models of operation. of which i am only interested in >> two, the segmented model, and the flat model. I have understood that the >> flat model is the same as the segmented but with all segments set to the >> same values (i.e. they all point to the same descriptor). they all begin >> at 0 and span 4gb, right? > >No. The 386 has three modes of operation: real, protected, and V86. Hey! Haven't heard of V86! Where can I read more about it? >We're only interested in protected. Protected mode programs, like >*all* 386 programs, are always segmented. "flat model" only means >that CS=DS=ES=SS and that, for the most part, programs may simply >ignore the fact of segments. > >Flat mode does not mean that the base address is zero and that the >segments are 4Gb large. In fact, with DJGPP's flat model, neither of >these are true. Using nearptr.h makes the segments 4G each, but does >not make them start at physical address 0. > >> a) is there any kind of protection when using the flat mode? how comes? > >Yes. You are still running in protected mode. > >> all the memory is available and i can write to anywhere without causing >> an exception! > >Wrong! > >> b) I assume djgpp runs in flat model! right? > >Yes. However, your definition of "flat model" is incorrect. Think of >Borland's "tiny model" instead, but with 32 bits of space instead of >16. > >> >Programs compiled with DJGPP can access all the physical memory on your >> >machine > >That doesn't mean you can scribble all over existing programs or the >OS. They will let you use all available physical memory, but they >will protect themselves against corruption. > >> great... now all the memory is available! why do i get a SIGSEGV fault >> when i executed a very simple CLS function? >> mov edi,0xa0000 >> mov ecx,16000 >> mov eax,0 >> rep stosd > >Because you are asking to write to memory that you haven't correctly >referenced. You made a mistake, and the OS will stop you rather than >let you crash the system. > >Since DJGPP segments don't start at physical address 0, you can't just >make up linear addresses like that and expect them to point to >physical devices. > >> 3) where can i find info about pages, page table... etc... i have read >> intel reference, but i couldn't understand any thing!! :-( > >The Intel "system programmer's guide" is the best reference I know for >all that, but it is a complicated thing to learn. Fortunately, unless >you're writing an operating system, you won't need to know anything >about it. >