Jump to content

DevHelp_LinToPageList

From EDM2
Revision as of 05:38, 11 May 2025 by Martini (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This service translates a linear address range to an array of _PageList structures that describes the physical pages to be mapped.

Syntax

C

USHORT APIENTRY DevHelp_LinToPageList (LIN    LinearAddr,
                                       ULONG  Size,
                                       LIN    pPageList,
                                       PULONG PageListCount)

The linear address range is translated into an array of _PAGELIST structures. Each _PAGELIST structure describes a single physically contiguous subregion of the physical memory that is mapped by the linear range. The format of the _PAGELIST structure is:

        typedef struct _PageList {
               ULONG  PhysAddr;
               Ulong Size;
               }PageList;


Assembler

MOV   EAX,LAddr                 ; Starting linear address of the range to be
                                ;  translated into a PageList array
MOV   ECX,cbSize                ; Size of the range to translate in bytes;
                                ;  must be less than or equal to 64KB
MOV   EDI,OFFSET pPageList      ; Flat pointer to the array or PageList
                                ;  structures that will be filled in
                                ;  by the call
MOV   DL,DevHlp_LinToPageList

CALL  [Device_Help]

The linear address range is translated into an array of _PAGELIST structures. Each _PAGELIST structure describes a single physically contiguous subregion of the physical memory that is mapped by the linear range. The format of the _PAGELIST structure is:

                        PAGELIST STRUC
                        DHPL_PhysAddr DD ?
                        DHPL_Size  DD ?
                        PAGELIST ENDS

Parameters

C

LinearAddr (LIN)
Starting linear address of the range to be translated into a PageList array
Size (ULONG)
Size of the range to translate in bytes; must be less than or equal to 64KB.
pPageList (PULONG)
Flat pointer to the array or PageList_s structures that will be filled by the call.
PageListCount (PULONG)
Number of PageList arrays returned.

Assembler

MOV   EAX,LAddr                 ; Starting linear address of the range to be
                                ;  translated into a PageList array
MOV   ECX,cbSize                ; Size of the range to translate in bytes;
                                ;  must be less than or equal to 64KB
MOV   EDI,OFFSET pPageList      ; Flat pointer to the array or PageList
                                ;  structures that will be filled in
                                ;  by the call
MOV   DL,DevHlp_LinToPageList

Return Code

C

Success Indicator
0 - _PageList will contain the physical mapping of the range. Number of elements in the PageList array is returned in PageListCount.

Assembler

   'C' Clear if successful.
       pPageList will contain the physical mapping of the range.
       EAX = Number of elements in PageList array.

   'C' Set if error.

Remarks

The physical pages that are mapped by the linear range must be fixed or locked prior to this call. It is the responsibility of the device driver to ensure that enough entries have been reserved for the range of memory being translated (possibly one entry per page in the range plus one more, if the region does not begin on a page boundary).

Example Code

C

#include  "dhcalls.h"

USHORT APIENTRY DevHelp_LinToPageList (LIN    LinearAddr,
                                       ULONG  Size,
                                       LIN    pPageList,
                                       PULONG PageListCount)

Related Functions