DOS/32 Advanced DOS Extender - Programmer's Reference

2.07 - DPMI function 0008h - Set Segment Limit

Sets the limit field in the descriptor table for the specified segment.


In: AX = 0008h
BX = selector
CX:DX = 32-bit segment limit

if successful:
CF clear

if failed:
CF set
AX = error code

8021h - invalid value (the limit is greater than 1 MB but the low 12 bits are not set)
8022h - invalid selector
8025h - invalid linear address (changing the limit would cause the descriptor to reference a linear address range outside that allowed for DPMI clients.)


a) The value supplied to the function in CX:DX is the byte length of the segment-1 (ie, the value returned by the LSL instruction).

b) Segment limits greater than or equal to 1 MB must be page-aligned. That is, limits greater than 1 MB must have the low 12 bits set.

c) This function has an implicit effect on the "G" (granularity) bit in an 80386+ descriptor's extended access rights/type byte; ie, it is the host's responsibility to set the "G" bit correctly.

d) Client programs must use the LSL instruction to query the limit for a descriptor. Note that on 80386 machines, the client must use the 32-bit form of LSL if the segment size is greater than 64 KB.

e) DOS/32 Advanced DPMI and DPMI 1.0 hosts will reload any segment registers which contain the selector specified in register BX.


Copyright Supernar Systems, Ltd. 1996-2005
All Rights Reserved.