6 External Pager Protocol
6.1 Overview
The following chapters describe the general pager protocol.
In L3 there is a standard pager which is part of the kernel and
handles all data spaces ([here]). But if there is a
need for the handling of external filesystems like a UNIX file system,
rather use an external pager.
The task of an external pager is to provide an external memory or a
part of an external memory as one or more linear addressed data
spaces, which can be mapped into the address space of other users.
It is possible to use different external pagers. One of the pagers can
handle a hard disk and provide it as data space, one can handle a
floppy disk, and the next can provide files as data spaces, which can
be mapped into the address spaces of som e UNIX users.
But all pagers use the same protocol, called the general pager
protocol, which is described in the following chapters.
The pager distinguishes between services, used
- by the users of the pager
- by the kernel.
To distinguish the origin of the message there are two protocols:
- the PageFaultProtocol
- the General Pager Protocol
The messages sent to the pager are of the following form:
typedef struct {
TMsgDope size;
TMsgDope msg;
DWord codeword1;
DWord codeword2;
}
In some cases there can be one or more additional parameters.
The results are given back by the pager with the two code words. 6.2 Page Fault Protocol
The service used by the kernel is the handling of some page faults,
which the kernel ascertains. The kernel recognizes which pager is the
owner of a page or a data space when a page fault occurs. In this
case the kernel sends a message to the pager fourcing it to provide
the page where the page fault occurs. The pager answers with the
address of this page inside its own address space.
The page fault protocol has a special protocol identifier, like every
L3 protocol. It is defined like follows:
#define pfp 0x30000000
The ix86 distinguishes between two kinds of access, read access and
write access. Therefor the page fault procol knows about two access
modes:
- ReadAccess
- forces the pager to provide the page, where the page
fault occured, the requested page is given back for read access. The
pager can decide, whether the page is given back for write access, if
the page was modified earlier.
- WriteAccess
- the same with write access
To supply the necessary information to resolve the page fault the
kernel sends two dwords describing the page fault.
- dword 1
- PFP + data space id
- dword 2
- pfaddress + access (pfaddress & ~31)
The pager tries to find the necessary pages and sends a reply
consisting of two dwords and one or more flex pages. The dwords are
the same like in the page fault message. The pager simply replace the
access with the result of its own operation.
- result code word 1
- pfp + data space id
- result code word 2
- pfaddress + result (pfaddress & ~31)
- 0x00000 - ACK
- 0x00001 - illegal data space id
- 0x00010 - illegal address
- 0x100rw - illegal access (rw proposed)
There is a header file named pagefault.h which defines some structures
and constants necessary to implement the external pager protocol. 6.3 General Pager Protocol
All other services of the pager indicated by the 2 in the code word
are used by applications of the pager. These are in general the same
services as the standard pager provides (see section [here]).
The use of the functions is a bit different, that's why they will be
explained in the following chapter.
The external pagers provide named and unnamed data spaces. Data spaces
are created by copying an existing data space. By this the user will
get an identifier of the data space. This is a 32 bit long identifier,
which holds the task identifier of the called pager, the task
number of the calling thread and an index, which is processed by
the pager.
An existing data space can be named by the user by an operation of the
pager. An already named data space can be renamed in the same way. The
name of an existing data space can be determined by another operation.
Other operations are similiar to the operations of the standard pager
like
#define GPP 0x20000000
Functions
- 1 CopyDataSpace
- 2 DataSpace
- 3 SetDSName
- 4 GetDSName
- 5 Pages
- 6 Type
- 7 Storage
- 8 Delete
- 9 NextPage
- A DeletePages
- B CopyPages
The code words are formed as follows:
- code word 1
- GPP + data space identifier
- code word 2
- function + additional info
The additional information and parameters depend on the function. It
is described below.
Description of Functionsions
- CopyDataSpace
- copies a data space from source to destination.
- code word 1
- GPP + data space identifier of the source data
space. If this is 0, a new data space is created.
- code word 2
- CopyDataSpace
- result code word 1
- 0 - ok + data space id
- 1 - illegal data space id
- DataSpace
- provides the data space identifier of the data space
associated with the given name
- code word 1
- GPP
- code word 2
- DataSpaces
- additional
- StrDopeT name of the data space
- result code word 1
- 0 (ok) + data space identifier
- 1 - illegal name
- SetDSName
- sets the specified name to the given data space.
- code word 1
- GPP + data space identifier
- code word 2
- SetDSName
- additional
- StrDopeT name of the data space
- result code word 1
- 0 (ok)
- 1 - illegal name
- 2 - illegal data space id
- GetDSName
- determines the specified name to the given data space.
- code word 1
- GPP + data space identifier
- code word 2
- GetDSName
- result code word 1
- 0 (ok) - Name is stored at the given address
- 1 - illegal data space id
- additional
- StrDopeT name of the data space
- DeleteDataSpace
- deletes the data space with the given identifier
- code word 1
- GPP + data space identifier
- code word 2
- DeleteDataSpace
- result code word 1
- 0 - ok
- 1 - illegal data space id
- Pages
- determines the total number of the used pages of the data
space with the given identifier
- code word 1
- GPP + data space identifier
- code word 2
- Pages
- result code word 1
- 0 - ok
- 1 - illegal data space id
- result code word 2
- total number of pages
- Index
- provides the number of the data space specified by the given
identifier inside the data spaces sequence provided by the external
pager
- code word 1
- GPP + data space identifier
- code word 2
- Index
- result code word 1
- 0 - ok
- 1 - illegal data space identifier
- result code word 2
- index of the data space
- DeletePages
- deletes the specified pages of the data space
- code word 1
- GPP + data space identifier
- code word 2
- Delete Pages + number of the pages to be deleted
- additional parameter> from page , to page
-
- result code word 1
- 0 - ok
- 1 - illegal data space id
- 2 - illegal pages
- 3 - illegal access
- CopyPages
- copies the specified pages of the given data space to
the given pages of the destination data space. The pages are copied in
it's indata space sequence. If the number of pages of both intervalls
isn't identical, the number of pages of the source data space is
copied.
- code word 1
- GPP + source data space identifier
- code word 2
- CopyPages + destination data space identifier
- additional parameter
- DWord from_page, to page inside the source
- additional parameter
- DWord from_page, to_page inside the destination
- result code word 1
- 0 - ok
- 1 - illegal data space id
- 2 - illegal pages
- 3 - illegal access
- NextPage
- provides the number of the page following the page with
the given number inside the data space
- code word 1
- GPP + data space identifier
- code word 2
- NextPage + number of the page whose follower should
be provided, if this is -1, the first used page should be provided
- result code word 1
- 0 - ok
- 1 - illegal data space id
- 2 - illegal page
- result code word 2
- number of the next used page, it is -1,if
there are no more pages
6.4 C - Library
The functions of the gpp are provided in a library.
- CopyDataSpace
void PCopyDataSpace(DataSpaceId source, DataSpaceIdT *dest)
Parameter:
- source
- This parameter specifies the data space to copy. If this
is 0, a new data space is created.
- dest
- This parameter specifies the identifier of the new created
data space.
- DataSpace
DtaSpaceIdT PDataSpace(char * name)
Parameter:
- name
- This parameter is the name of the data space.
- result
- The result of this function is either the data space
identifier, if the the data space associated with name exists, or 0,
if it doesn't exist.
- SetDSName
void PSetDSName(DataSpaceId ds, char *name)
Parameter:
- ds
- This parameter specifies the data space to be named.
- name
- This parameter specifies the name, which is given to the
data space.
- GetDSName
void PSetDSName(DataSpaceId ds, char *name)
Parameter:
- ds
- This parameter specifies the data space, whose name should be traced.
- name
- This parameter holds the name after the operation. If the
data space was unnamed, it is NIL.
- Pages
int PPages(DataSpaceId ds)
Parameter:
- ds
- This parameter specifies the data space, whose number of pages
should be provided.
- result
- The result of this function is either the number of the
used pages of the given data space or -1, if the data space doesn't
exist.
- Type
int PType(DataSpaceId ds)
Parameter:
- ds
- This parameter specifies the data space, whose type is traced.
- result
- The result of the function is either the type of the data
space or -1 if the data space doesn't exist.
- Storage
int PStorage(DataSpaceId ds)
Parameter:
- ds
- This parameter specifies the data space, whose storage size
has to be provided.
- result
- The result of this function is either the size of the used
storage of the data space or -1 if the dat space doesn't exist.
- Delete
void PDelete(DataSpaceId ds)
Parameter:
- ds
- This parameter specifies the data space to be deleted.
- NextPage
int PNextPage(DataSpaceId ds, int start_page)
Parameter:
- ds
- This parameter specifies the data space.
- start_page
- This parameter specifies the number of the page, whose
follower should be provided. Is this -1, the first used page of the
data space is provided.
- result
- The result of the function is either the number of the
next used page or -1 if there are no more used pages.
- DeletePages
void PDeletePages(DataSpaceId ds, int from_page, int to_page, int pages)
Parameter:
- ds
- This parameter specifies the data space, whose pages have to
be deleted.
- from_page
- This parameter specifies the first page to be deleted.
- to_page
- This parameter specifies the last page to be deleted.
- pages
- This parameter specifies the total number of pages to be deleted.
- CopyPages
void PCopyPages(DataSpaceId source, DataSpaceIdT dest, int from_page,
int to_page, int pages)
Parameter:
- source
- This parameter specifies the data space, whose pages have
to be copied.
- dest
- This parameter specifies the identifier of the data space,
where the pages are copied to.
- from_page
- This parameter specifies the first page to be copied.
- to_page
- This parameter specifies the last page to be copied.
- pages
- This parameter specifies the total number of pages to be copied.
Marion Schalm, Jean Wolter, Michael Hohmuth
26.12.1995 (unfinished)