This DPMI 0.9 Specification is hosted by Tenberry Software, Inc.
8. Descriptor Management Services, Continued
[Next Section] *
[Previous Section] *
[DPMI Index]
[Tenberry Home]
* [Software Quality]
* [DOS/4G]
* [DOS/4GW]
* [DOS/16M]
8.8 Set Segment Limit
This function sets the limit for the specified segment.
To Call
AX = 0008h
BX = Selector
CX:DX = 32-bit segment limit
Returns
If function was successful:
Carry flag is clear.
If function was not successful:
Carry flag is set.
Programmer's Notes
- Since this function involves descriptor management,
it will be rarely needed in 32-bit programs.
- This function will fail if the selector specified
in BX is invalid or the specified limit could not
be set. 16-bit DPMI implementations can not set
segment limits greater than 0FFFFh (64K) so CX
must be zero when calling this function under
these implementations of DPMI.
- Segment limits greater than 1 meg must be page
aligned. That is, limits greater than one
megabyte must have the low 12 bits set.
- Your program should only modify descriptors that
were allocated through the Allocate Descriptors function.
- To get the limit of a segment you should use the
instruction lsl (load segment limit) which is
supported on 80286 and ia32 (32-bit) machines. Note that
on ia32 (32-bit) machines you will need to use the 32-bit
form of lsl if the segment has a limit greater
than 64K.
Code Sample:
The following function compiles with Watcom C/C++ version 11.0 or later,
and Microsoft Visual C/C++ version 4.0 or later:
// Sets 32-bit limit (length) descriptor for selector
int dpmiSetSegmentLimit(dpmiSelector sel, // selector to set base address of
unsigned long limit) // new limit
{
int result; // zero if int 31h succeeds
unsigned short errorCode; // error code from DPMI host
__asm {
mov bx, sel // the selector to get base address of
mov ecx, limit // put new limit into cx:dx
mov dx, dx
shr ecx, 16
mov eax, 0x008 // call dpmi host to do setting
int 0x31
mov errorCode, ax // save error code from DPMI, if any
sbb eax, eax // record success/failure flag
mov result, eax
}
// if the dpmi call failed, return the dpmi error code
if (result != 0)
return errorCode;
// indicate success
return 0;
}
[Next Section] *
[Previous Section] *
[DPMI Index]
[Tenberry Home]
* [Software Quality]
* [DOS/4G]
* [DOS/4GW]
* [DOS/16M]
This HTML edition of the DPMI 0.9 Specification is hosted by
Tenberry Software, Inc.,
makers of the
DOS/16M and
the DOS/4G
family of DOS extenders.
Page last modified 2003.1.28,
<webmaster@tenberry.com>