Date: Sun, 20 Jun 1999 10:39:52 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Michael Stewart cc: djgpp AT delorie DOT com Subject: Re: Selector code In-Reply-To: <7kai08$f4d$1@taliesin.netcom.net.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Thu, 17 Jun 1999, Michael Stewart wrote: > limit--; > /* Check for the limit being over 1MB */ > if (limit > 1024 * 1024) limit |= 0xfff; Sorry, I failed to mention one subtle aspect of the limit. If the segment is to be larger than 1MB, the limit should be set in 4KB pages, not in bytes. So instead of setting the lower 12 bits, you need to shift the limit 12 bits to the right (after rounding it up to an integral multiple of 4KB). Then the problem with lower 12 bits doesn't come up at all (it is only relevant for a call to __dpmi_set_segment_limit, which accepts the limit in bytes). Note that if you don't convert the limit to pages, "limit >> 16" might overflow the 4-bit field in byte 6 that is allotted to the high part of the limit. Sorry for the confusion.