DevHelp PhysToGDTSelector

From EDM2
Jump to: navigation, search

This service converts a 32-bit address to a Global Descriptor Table (GDT) selector-offset pair.

Syntax

C

USHORT APIENTRY DevHelp_PhysToGDTSelector( ULONG  PhysAddr,
                                           USHORT Count,
                                           SEL    Selector)

Assembler

MOV   AX,address_high         ; 32-bit physical address
MOV   BX,address_low          ;
MOV   CX,length               ; Length of segment
MOV   SI,selector             ; Selector to be set up
MOV   DL,DevHlp_PhysToGDTSelector

CALL  [Device_Help]

Parameters

C

PhysAddr (ULONG) 
32-bit physical address that the GDT selector is to be mapped to.
Count (USHORT)
Length of segment.
Selector (SEL) 
GDT selector (allocated using AllocateGDTSelector)

Assembler

MOV   AX,address_high         ; 32-bit physical address
MOV   BX,address_low          ;
MOV   CX,length               ; Length of segment
MOV   SI,selector             ; Selector to be set up

Return Code

C

Success Indicator: 0

Possible errors:

              ERROR_INVALID_ADDRESS   (487)
              ERROR_INVALID_SELECTOR  (490)

Assembler

   'C' Clear if successful.

   'C' Set if error.
       AX = Error code.
            Possible errors:
               ERROR_INVALID_ADDRESS   (487)
               ERROR_INVALID_SELECTOR  (490)

Remarks

This function is used to provide addressability through a GDT selector to data. The addressability of the GDT selector remains valid and unchanged until another call to PhysToGDTSelector is made for the same selector.

The DevHlp_Alloc is used at initialization (INIT) time to allocate the GDT selectors that the physical device driver can use with PhysToGDTSelector.

PhysToGDTSelector creates selector:offset addressability for a 32-bit physical address. The selector created, however, does not represent a normal memory segment, such as those usually managed by the operating system, and is more of a fabricated segment for private use by the physical device driver. Such a segment cannot be passed on system calls, and can be used by the physical device driver only to fetch data.

Example Code

C

#include  "dhcalls.h"

USHORT APIENTRY DevHelp_PhysToGDTSelector( ULONG  PhysAddr,
                                           USHORT Count,
                                           SEL    Selector)

Related Functions