DevHelp AllocGDTSelector: Difference between revisions
Created page with "This service allocates a set of Global Descriptor Table (GDT) selectors for a physical device driver to use. This allocation is performed at device driver INIT (initialization..." |
|||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
This service allocates a set of Global Descriptor Table (GDT) selectors for a physical device driver to use. This allocation is performed at device driver INIT (initialization) time. | {{DISPLAYTITLE:DevHelp_AllocGDTSelector}} | ||
This service allocates a set of Global Descriptor Table (GDT) selectors for a physical device driver to use. This allocation is performed at device driver INIT (initialization) time. | |||
==Syntax== | ==Syntax== | ||
===C=== | ===C=== | ||
DevHelp_AllocGDTSelector (PSEL Selectors, USHORT Count) | |||
DevHelp_AllocGDTSelector (PSEL Selectors, USHORT Count) | |||
===Assembler=== | ===Assembler=== | ||
Line 16: | Line 15: | ||
CALL [Device_Help] | CALL [Device_Help] | ||
</PRE> | </PRE> | ||
==Parameters== | ==Parameters== | ||
===C=== | ===C=== | ||
;''Selectors'' (P[[SEL]]) - input : 16:16 address of GDT selector array | |||
Selectors ( | ;''Count'' ([[USHORT]]) - input : Number of selectors requested | ||
Count (USHORT) - input | |||
===Assembler=== | ===Assembler=== | ||
<PRE> | <PRE> | ||
MOV ES,address_high ; 16:16 address of GDT selector array | |||
MOV DI,address_low ; | |||
MOV CX,number ; Number of selectors requested | |||
MOV DL,DevHlp_AllocGDTSelector | |||
CALL [Device_Help] | |||
</PRE> | </PRE> | ||
Line 34: | Line 36: | ||
* Possible errors: | * Possible errors: | ||
** ERROR_INVALID_ADDRESS | ** ERROR_INVALID_ADDRESS (487) | ||
** ERROR_ZERO_SELECTORS_REQUESTED | ** ERROR_ZERO_SELECTORS_REQUESTED (488) | ||
** ERROR_NOT_ENOUGH_SELECTORS_AVA | ** ERROR_NOT_ENOUGH_SELECTORS_AVA (489) | ||
===Assembler=== | ===Assembler=== | ||
Line 52: | Line 53: | ||
==Remarks== | ==Remarks== | ||
AllocGDTSelector allocates a set of GDT selectors for a physical device driver to use for task-time and interrupt-time operations. The address passed in ES:DI gives the location of an array of words to be filled in with the GDT selectors allocated. The value of CX specifies the number of selectors to be allocated. Note that the selector values returned might not be contiguous values. The interrupt handler of a physical device driver must be able to address data buffers, regardless of the context of the current process. (The current LDT does not necessarily address the data space that contains the data buffer that the interrupt handler needs to access.) PhysToGDTSel establishes the addressability of a GDT selector, and the GDT selector's addressability remains valid and unchanged until another call to PhysToGDTSel is made for the same selector. | AllocGDTSelector allocates a set of GDT selectors for a physical device driver to use for task-time and interrupt-time operations. The address passed in ES:DI gives the location of an array of words to be filled in with the GDT selectors allocated. The value of CX specifies the number of selectors to be allocated. Note that the selector values returned might not be contiguous values. The interrupt handler of a physical device driver must be able to address data buffers, regardless of the context of the current process. (The current LDT does not necessarily address the data space that contains the data buffer that the interrupt handler needs to access.) PhysToGDTSel establishes the addressability of a GDT selector, and the GDT selector's addressability remains valid and unchanged until another call to PhysToGDTSel is made for the same selector. | ||
==Example Code== | ==Example Code== | ||
Line 62: | Line 63: | ||
</PRE> | </PRE> | ||
[[Category:DevHlps]] | [[Category:DevHlps]] |
Latest revision as of 15:15, 27 May 2025
This service allocates a set of Global Descriptor Table (GDT) selectors for a physical device driver to use. This allocation is performed at device driver INIT (initialization) time.
Syntax
C
DevHelp_AllocGDTSelector (PSEL Selectors, USHORT Count)
Assembler
MOV ES,address_high ; 16:16 address of GDT selector array MOV DI,address_low ; MOV CX,number ; Number of selectors requested MOV DL,DevHlp_AllocGDTSelector CALL [Device_Help]
Parameters
C
- Selectors (PSEL) - input
- 16:16 address of GDT selector array
- Count (USHORT) - input
- Number of selectors requested
Assembler
MOV ES,address_high ; 16:16 address of GDT selector array MOV DI,address_low ; MOV CX,number ; Number of selectors requested MOV DL,DevHlp_AllocGDTSelector CALL [Device_Help]
Return Code
C
- Success Indicator: 0
- Possible errors:
- ERROR_INVALID_ADDRESS (487)
- ERROR_ZERO_SELECTORS_REQUESTED (488)
- ERROR_NOT_ENOUGH_SELECTORS_AVA (489)
Assembler
'C' Clear if successful. 'C' Set if error. AX = Error code. Possible errors: ERROR_INVALID_ADDRESS (487) ERROR_ZERO_SELECTORS_REQUESTED (488) ERROR_NOT_ENOUGH_SELECTORS_AV (489)
Remarks
AllocGDTSelector allocates a set of GDT selectors for a physical device driver to use for task-time and interrupt-time operations. The address passed in ES:DI gives the location of an array of words to be filled in with the GDT selectors allocated. The value of CX specifies the number of selectors to be allocated. Note that the selector values returned might not be contiguous values. The interrupt handler of a physical device driver must be able to address data buffers, regardless of the context of the current process. (The current LDT does not necessarily address the data space that contains the data buffer that the interrupt handler needs to access.) PhysToGDTSel establishes the addressability of a GDT selector, and the GDT selector's addressability remains valid and unchanged until another call to PhysToGDTSel is made for the same selector.
Example Code
C
#include "dhcalls.h" USHORT APIENTRY DevHelp_AllocGDTSelector (PSEL Selectors, USHORT Count)