Message-Id: <199709250833.SAA20910@rabble.uow.edu.au> Subject: Re: Using "far" pointers To: firewind AT metroid DOT dyn DOT ml DOT org (firewind) Date: Thu, 25 Sep 1997 18:33:15 +1000 (EST) Cc: djgpp AT delorie DOT com (DJGPP) In-Reply-To: from firewind at "Sep 24, 97 10:06:30 pm" From: Brett Porter MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk > At this point, it is valid to write the following: > > indos = _farpeekb(_dos_ds, es*16+bx); > > 'es' (the real mode selector, AFAIK) must be multiplied by 16 to be valid > (I don't know why, but the info page for _far* says so, so I do it :), and > then the offset ('bx') is added to that, resulting in a valid address in > the _dos_ds segment. > No, it's alright. I understand this now, I just got a little confused. The es:bx returned by __dpmi_int are a valid address in the segment `pointed to' by _dos_ds. > My question was not weather InDOS can be accessed like this; I know it can > and have written some ISRs that in fact do it. My question was, if the > _far* functions perform some sort of memory protection, what is the result > when 'es' and 'bx' are garbage? Based on what you said, I now believe it > would be a SIGSEGV. > Actually, I don't think so anymore. If es and bx are garbage, es*16+bx will still be within the 1Mb segment, so it should be valid to do a a _far* call. But the answer you get will be rubbish. > > Could you please tell me what this InDOS flag is and how it works? I have > > heard it mentioned a couple of times. > > The InDOS flag is part of the internal DOS data structures. Whenever a DOS > function is entered (INT 0x21, other DOS interrupts) this flag is > incremented. While this flag is nonzero, you -CANNOT- call any DOS > function, since DOS in non-reentrant; doing so will cause Bad Things(tm). > Therefore, whenever a properly-written, DOS-calling ISR enters, it checks > the InDOS flag, and if it is nonzero, does not do anything. > > I recommend Ralf Brown's Interrupt List for more information. > Thanks I've meant to read through that, but it's just soooo big! I'm getting there though... Brett -- "Give me ambiguity or give me something else" -- Brett Porter bporter AT rabble DOT uow DOT edu DOT au http://www.geocities.com/CollegePark/Union/3596 Humour, Programming, and more.