File:  [OS/2 SDKs] / os2sdk / os2doc / devhlp.txt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Thu Aug 9 12:25:13 2018 UTC (7 years, 9 months ago) by root
Branches: msft, MAIN
CVS tags: os2sdk-1987, HEAD
Microsoft OS/2 SDK 12-15-1987

###############

Additional Device Helpers Routines

The following describe additional device helper routines that
are not documented in the MS OS/2 Device Drivers Guide Update.
There are the following additional routines:

        AllocateGDTSelector     2DH
        PhysToGDTSelector       2EH
        RealToProt              2FH
        ProtToReal              30H

Also note that the correct call code for the VerifyAccess
routine is 27H, not 29H as previously listed.

AllocateGDTSelector - Allocate GDT Selectors


Purpose

The AllocateGDTSelector routines allocates one or more GDT selectors,
copying them to the specified array.

Calling Sequence:


MOV            ES, SelectorArrayHigh    ; Pointer to array
MOV            DI, SelectorArrayLow     ;
MOV            CX, Selectors            ;Number of selectors 
MOV            DL, DEVHLP_ALLOCATEGDT
CALL           [Device_Help]

where:


SelectorArrayHigh and SelectorArrayLow are the high- and low-order words of
the address of an array to recieve the allocated selectors.


Selectors specifies the number of selectors to allocate.

Returns:

C - set if error.


AX = Error code:
  o Invalid address


  o Zero selectors requested


  o Not enough selectors available

C -cleared if successful.

See Also:

PhysToGDTSelector




PhysToGDTSelector - Convert Physical Address to GDT Selector


Purpose:

The PhysToGDTSelector routine converts a physical memory address to a
designated GDT selector.  The indicated segment must be locked (either long
or short term) before issuing this request.


Once this call has been issued for a particular selector, that
addressability will remain valid until the device driver changes its
content via a subsequent PhysToGDTSelector request referencing the same GDT
selector.  This call can be made in protect mode only.

Calling Sequence:


MOV            AX, AddressHigh  ; 32-bit physical address
MOV            BX, AddressLow   ;
MOV            CX, Size
MOV            SI, Selector
MOV            DL, DEVHLP_PHYSTOGDT
CALL [Device_Helper]

where:

AddressHigh and AddressLow are the high- and low-order words of the 
current 32-bit physical address.

Size is the 16-bit segment size, not the limit. It is converted to a limit
before editing descriptors. A value of zero indicates 65536 bytes.


Selector identifies the descriptor to be setup.

Returns:

C - set if error.


AX = Error codes:

  o Invalid address
  o Invalid selector


C -cleared if successful.

See Also:




RealToProt

RealToProt - Switch from Real to Protect Mode


Purpose:

The RealToProt routine changes the machine's execution mode from Real to
Protected. This call is used by a device driver which has received control
in Real mode but which has GDT selectors filled in by a PhysToGDTSelector
request it must access.  Callable only at interrupt time.


This routine performs the necessary operations required to switch the
processor from Real to Protect mode.  The ES register will contain zero
upon exit.  The SS register will point to the interrupt stack.

Calling Sequence:


MOV            DS, HeaderHigh   ; Device header
MOV            SI, HeaderLow    ;
MOV            DH, DEVHLP_REALTOPROT
CALL           [Device_Helper]

where:


HeaderHigh and HeaderLow are the high- and low-order words of the address
of the device header of requesting device driver.

Returns:

C -set if processor is already in Protect Mode.


C -cleared if successful. ES set to 0 on success.


CS set to caller's protect mode CS on success.


DS set to caller's protect mode DS on success.


SS set to the interrupt stack on success.

See Also:

ProtToReal



ProtToReal - Switch from Protect to Real Mode


Purpose:

The ProtToReal routine changes the machine's execution mode from Protected
back to Real.  This call is used following device driver processing which
was done in Protected mode as a result of an earlier RealToProt request.
Callable only at interrupt time.


This routine performs the necessary operations required to switch the
processor from Protect to Real mode. This routine should only be called
when the processor is in protect mode.

Calling Sequence:


MOV            DS, HeaderHigh   ;Device header
MOV            SI, HeaderLow    ;
MOV            DH, DEVHLP_PROTTOREAL
CALL           [Device_Helper]

where:


HeaderHigh and HeaderLow are the high- and low-order words of the address
of the device header of requesting device driver.

Returns:

C -set if processor is already in Real Mode.


C -cleared if successful. ES set to caller's real mode DS on success.


CS set to caller's real mode CS on success.


DS set to caller's real mode DS on success.


SS set to the interrupt stack on success.

See Also:

RealToProt

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.