Jump to content

DevHelp AllocGDTSelector: Difference between revisions

From EDM2
Line 18: Line 18:
==Parameters==
==Parameters==
===C===
===C===
<PRE>
; Selectors (PSEL)- input - 16:16 address of GDT selector array
Selectors (PSEL) - input - 16:16 address of GDT selector array


Count (USHORT)   - input - Number of selectors requested
; Count (USHORT):    - input - Number of selectors requested
</PRE>


===Assembler===
===Assembler===

Revision as of 16:51, 20 June 2017

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)

Related Functions