Jump to content

DevHelp GetDescInfo: Difference between revisions

From EDM2
Created page with "This service obtains information about the contents of a descriptor. ==Syntax== ===C=== <PRE> DevHelp_GetDescInfo(SEL Selector, PBYTE SelInfo ); </PRE> ===Assembler=== <P..."
 
Ak120 (talk | contribs)
mNo edit summary
Line 1: Line 1:
This service obtains information about the contents of a descriptor.  
This service obtains information about the contents of a descriptor.


==Syntax==
==Syntax==
===C===
;C
<PRE>
DevHelp_GetDescInfo(SEL Selector, PBYTE SelInfo)
DevHelp_GetDescInfo(SEL   Selector, PBYTE SelInfo );
;Assembler
</PRE>
MOV  AX,Selector                  ; The selector referring to the descriptor
 
MOV  DL,DevHlp_GetDescInfo
===Assembler===
<PRE>
CALL  [Device_Help]
MOV  AX,Selector                  ; The selector referring to the descriptor
MOV  DL,DevHlp_GetDescInfo


CALL  [Device_Help]
</PRE>
==Parameters==
==Parameters==
===C===
;Selector (SEL): The selector referring to the descriptor
; Selector (SEL): The selector referring to the descriptor
;SelInfo (PBYTE) : Pointer to the selector information to be returned. See _SELDESCINFO and _GATEDESCINFO for information returned.
 
Typedef struct _SELDESCINFO{
; SelInfo (PBYTE) : Pointer to the selector information to be returned. See _SELDESCINFO and _GATEDESCINFO for information returned.
          UCHAR  Type;
 
          UCHAR  Granularity;
                  Typedef struct _SELDESCINFO{
          LIN    BaseAddr
                          UCHAR  Type;
          ULONG  Limit
                          UCHAR  Granularity;
          } SELDESCINFO;
                          LIN    BaseAddr
                          ULONG  Limit
                          } SELDESCINFO;


                  Typedef struct _GATEDESCINFO{
Typedef struct _GATEDESCINFO{
                          UCHAR  Type;
          UCHAR  Type;
                          UCHAR  ParmCount;
          UCHAR  ParmCount;
                          SEL    Selector;
          SEL    Selector;
                          USHORT Reserved_1;
          USHORT Reserved_1;
                          ULONG  Offset;
          ULONG  Offset;
                          } GATEDESCINFO;
          } GATEDESCINFO;


===Assembler===
<PRE>
MOV  AX,Selector                  ; The selector referring to the descriptor
</PRE>


==Return Code==
==Return Code==
===C===
===C===
;Success Indicator: 0
;Success Indicator: 0
 
:If the descriptor is a callgate, the number of parameters is returned in 'desc_attr'; the selector is returned in the 'desc_laddr' and the offset is returned to the 'desc_cb'.
If the descriptor is a callgate, the number of parameters is returned in 'desc_attr'; the selector is returned in the 'desc_laddr' and the offset is returned to the 'desc_cb'.
;Possible errors: Descriptor invalid
 
:where:
; Possible errors: Descriptor invalid
 
where:
   desc  = descriptor
   desc  = descriptor
   attr  = attributes    (read/write/current protection level)
   attr  = attributes    (read/write/current protection level)
Line 56: Line 42:
===Assembler===
===Assembler===
<PRE>
<PRE>
   'C' Clear if successful.
   'C' Clear if successful.
       AL  = Descriptor's access byte.
       AL  = Descriptor's access byte.
Line 76: Line 61:
             Possible errors:
             Possible errors:
               Descriptor invalid
               Descriptor invalid
</PRE>
</PRE>


==Remarks==
==Remarks==
When called for a Local Descriptor Table (LDT) descriptor, GetDescInfo can block other threads from executing. Therefore, at interrupt time, this routine can be called only for Global Descriptor Table (GDT) descriptors. The routine can be called with either type of descriptor at initialization or task time.  
When called for a Local Descriptor Table (LDT) descriptor, GetDescInfo can block other threads from executing. Therefore, at interrupt time, this routine can be called only for Global Descriptor Table (GDT) descriptors. The routine can be called with either type of descriptor at initialization or task time.


==Example Code==
==Example Code==
===C===
;C
<PRE>
<PRE>
#include  "dhcalls.h"
#include  "dhcalls.h"
Line 89: Line 73:
USHORT APIENTRY DevHelp_GetDescInfo(SEL  Selector, PBYTE SelInfo );
USHORT APIENTRY DevHelp_GetDescInfo(SEL  Selector, PBYTE SelInfo );
</PRE>
</PRE>
==Related Functions==


[[Category:DevHlps]]
[[Category:DevHlps]]

Revision as of 10:56, 5 April 2025

This service obtains information about the contents of a descriptor.

Syntax

C
DevHelp_GetDescInfo(SEL Selector, PBYTE SelInfo)
Assembler
MOV   AX,Selector                  ; The selector referring to the descriptor
MOV   DL,DevHlp_GetDescInfo

CALL  [Device_Help]

Parameters

Selector (SEL)
The selector referring to the descriptor
SelInfo (PBYTE)
Pointer to the selector information to be returned. See _SELDESCINFO and _GATEDESCINFO for information returned.
Typedef struct _SELDESCINFO{
         UCHAR  Type;
         UCHAR  Granularity;
         LIN    BaseAddr
         ULONG  Limit
         } SELDESCINFO;
Typedef struct _GATEDESCINFO{
         UCHAR  Type;
         UCHAR  ParmCount;
         SEL    Selector;
         USHORT Reserved_1;
         ULONG  Offset;
         } GATEDESCINFO;


Return Code

C

Success Indicator
0
If the descriptor is a callgate, the number of parameters is returned in 'desc_attr'; the selector is returned in the 'desc_laddr' and the offset is returned to the 'desc_cb'.
Possible errors
Descriptor invalid
where:
 desc  = descriptor
 attr  = attributes     (read/write/current protection level)
 laddr = linear address (physical memory start)
 cb    = count of bytes (length)

Assembler

   'C' Clear if successful.
       AL  = Descriptor's access byte.
       AH  = If the descriptor is not a call gate,
             AH = The Big and Granularity fields of attribute byte.
             If the descriptor is a call gate,
             AH = The number of parameters.
       ECX = If the descriptor is not a call gate,
             ECX = 32-bit linear address stored in descriptor.
             If the descriptor is a call gate,
             CX = Selector.
       EDX = If the descriptor is not a call gate,
             EDX = The 32-bit, byte-granular size of descriptor (=0 if 4 GB).
             If the descriptor is a call gate,
             EDX = 32-bit offset (0:32 addressing).

   'C' Set if error.
       EAX = Error code.
            Possible errors:
               Descriptor invalid

Remarks

When called for a Local Descriptor Table (LDT) descriptor, GetDescInfo can block other threads from executing. Therefore, at interrupt time, this routine can be called only for Global Descriptor Table (GDT) descriptors. The routine can be called with either type of descriptor at initialization or task time.

Example Code

C
#include  "dhcalls.h"

USHORT APIENTRY DevHelp_GetDescInfo(SEL   Selector, PBYTE SelInfo );