delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/20/03:44:07

Date: Sun, 20 Jun 1999 10:39:52 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Michael Stewart <mike AT reggin DOT freeserve DOT co DOT uk>
cc: djgpp AT delorie DOT com
Subject: Re: Selector code
In-Reply-To: <7kai08$f4d$1@taliesin.netcom.net.uk>
Message-ID: <Pine.SUN.3.91.990620103932.16821C-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019