Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Extended addressing with data spaces

&pagelevel(4)&pagelevel

Macro

Brief description

ALESRV

Sets up and clears a connection between a program and a data space

ALINF

Provides information on the access lists with which data spaces and their connections
are managed

DSPSRV

Creates, extends and deletes virtual address space for data addressing (data space),
provides information on a data space and releases a data space.

The extended address space principle

The extended addressing mode is available on all BS2000 servers.

In the extended addressing mode new address spaces for data are available in addition to the address space provided in previous versions. Since some of the characteristics of these new virtual address spaces differ from those of conventional virtual address space, the following new terminology has been introduced:

  • program space for conventional virtual address space

  • data space for the new virtual address spaces

The following list summarizes the characteristics of a data space:

  • address space for data only, i.e. addressed program code cannot be executed

  • may be used in 24-bit and 31-bit addressing mode

  • size of between 4K and 16Mb/2Gb, depending on addressing mode

  • homogeneous address space, i.e. no memory classes, same page attributes

  • contains no reserved system address areas

  • may be shareable (similar to memory pools)

  • data may be partitioned

Advantages of data spaces for the user:

  • A considerable increase in the total volume of addressable data

  • Data spaces enable the address space to be structured more easily, allowing the separation of program code and data and partitioning of data relevant to security or other critical data

  • A larger program space is available to the user since user data can be stored in a data space.

Program space and data space

Figure 7: Extending the virtual address space with data spaces

The program space corresponds to the virtual address space provided in previous BS2000 versions. It therefore begins at virtual address X'00' and has a maximum size of 2Gb. Within the program space, it is possible to address both executable programs and pure data.

A data space is a contiguous virtual address space with a size of between 4K and 2Gb.
A data space begins at virtual address 0. It is available to the user in its entirety since, unlike the program space, it does not contain any areas reserved for the system.
Within a data space, it is possible to address only data or programs that have been stored as data, i.e. program code addressed in a data space cannot be executed. A user sets up a data space by specifying type, name, scope and desired size. The user who sets up the data space becomes its owner.

A data space is implemented as a homogeneous address space, i.e. all pages are assigned the same attributes as soon as they are requested. These attributes are defined on creation of a data space. The attributes specified when a data space is created remain valid throughout the lifetime of the data space. All participants joining a data space must accept these attributes.
The scope determines which tasks can join the data space and access the data it contains. The name of a data space is unique only within its scope. The requested data space is identified throughout the session by means of the SPID (space identification). The SPID is assigned by the system.

Data space types

The data space type determines the type of memory allocation/deallocation within the data space. It is determined at generation time.

The following data space types exist:

  • STACK
    A data space of the type STACK is an allocated area that is contiguous in virtual terms, starting with address 0 and going up to the current size. Functions are available for extending and reducing the current size (EXTEND/REDUCE) and for deleting the content of an area within the current size (CLEAR).

  • HEAP
    A data space of the type HEAP is a virtual address space in which areas of any required size can be allocated dynamically up to the maximum size of the data space. The allocation functions available are GETAREA and RETAREA.

The size is indicated in units of 4 KB.

Addressing data space contents

Access lists
Before a program can access data in a data space, it must establish a connection to this data space.
Each task has its own access list (AL) containing all the current connections between a program and data spaces. Access lists are located in the privileged memory area and are managed by the system. When a program sets up or clears connections, entries (access list entries, ALE) are added to or deleted from the task-specific access list.

ALET and SPID
On connection setup, the program receives a value (the access list entry token or ALET) that points to the new entry in the access list.
Whereas the SPID (assigned by the system when the data space was created) is used by the software to identify the data space throughout the system, the ALET is used to address the data space on a hardware basis. The value of the ALET is task-specific:
if several tasks set up a connection to one and the same data space, they are each assigned a different ALET, since the ALET identifies an entry in the task-specific access list.

Access registers
Data spaces are accessed via an additional set of registers consisting of 16 access registers (ARs). The 16 access registers are assigned unambiguously to the 16 general registers. The general registers used for address calculation can be base or index registers.If only an index register and no base register is used for address calculation, the program space is always addressed.
If, however, a base register is (also) used for address calculation and the ALET of the corresponding access register is not zero, the corresponding data space is addressed. This makes it possible to assign a separate data space to each address that is referenced by a base register. Since general register 0 may not be used as the base register, AR0 may not be used to address a data space.
Loading the corresponding access register with the ALET that identifies a connection to a data space allows address conversion for data access to be performed via the address conversion tables of the data space.
Just as a different area within the program space can be addressed by reloading the base register with the start address of this area, a different data space can be addressed by reloading the access register with a different ALET from the access list. The access list thus represents the set of data spaces that a program can access at a particular time.
The mechanism for accessing a data space via the access list is effective only for operand access to data. In the case of branch instructions, operand access always takes place in the program space. This prevents program code in a data space from being executed.

AR mode
To make use of the extended address space option, a program must be instructed to work with the additional set of registers, i.e. to run in AR mode (access register mode).
If AR mode is not activated, virtual addresses of the program space are addressed.
The assembler instruction SAC activates and deactivates AR mode.

SAC

SAC

512

0

* set address space control

*

activate AR mode *

deactivate AR mode *

If AR mode is not activated, therefore, program code and data is accessed in the program space whereas, in AR mode, data is accessed in data spaces which are indexed via access registers.
When AR mode is activated, a real address is calculated as before by converting the virtual address in two stages (index register + base register + displacement), but taking into account the access register. If the access register that corresponds to the base
register != 0, it refers to a data space and the virtual address of this data space is converted. If the access register = 0, a virtual address of the program space is converted.
If a program is running in AR mode and uses a general register as the base register for addressing data, the corresponding access register must be assigned a valid ALET, otherwise the program is aborted.
A special ALET value is available for addressing data in the program space. The value ALET = 0 always addresses the program space.

A number of new Assembler instructions have been introduced for working with access registers (see the “Assembler Instructions (BS2000)” manual [1 (Related publications)]).

LAM

Load Access Multiple

STAM

STore Access Multiple

LAE

Load Address Extended

SAR

Set Access Register

CPYA

CoPY Access register

EAR

Extract Access Register

TAR

Test Access Register

SAC

Set Address space Control

IAC

Insert Address space Control

How to make a data space addressable

  1. Create a data space (DSPSRV macro, FCT=CREATE)
    or
    supply the identification (SPID) of an existing, shareable data space (DSPSRV macro, FCT=INFORM).

  2. Establish a connection to this data space
    (ALESRV macro, FCT=CONNECT). An ALET is returned.

  3. Load the ALET into the access register whose corresponding general register is used as the base register for addressing the data in the data space
    (instruction LAM ARx,ARx,alet, if ARx EQU x is defined).

  4. Activate AR mode (instruction SAC 512).

If more than one task is authorized to access the same data space and the data space has been made addressable via the access list, correct user serialization must be ensured.
The maximum number of data spaces that can be set up per task is 32. However, each task can access many more data spaces (already set up by other tasks). A maximum of
125 ALETs can be managed per task,i.e. a connection can be established to 125 data spaces.
All access registers are initialized with zero when the program is started.

Access registers and AR mode should be used only on a procedure-local basis, since the linkage routines are not executable in AR mode and do not save the access registers when subroutines are called.

Figure 8: Selecting an address space

(1)

The address calculated during address conversion refers to the program space if

  • AR mode is not activated or

  • the ALET in the access register (corresponding to the base register) is zero.

(2)

The address calculated during address conversion refers to a data space. An access list entry (ALE) is addressed via the ALET of the corresponding access register. This ALE in turn points to an entry in the data space table via which the data space is identified.

(3)

A data space can also be addressed via the SPID assigned by the system. The SPID identifies the data space throughout the session.

Macros for using data spaces

Three macros are available to nonprivileged users for working with extended virtual address space.
The DSPSRV macro can be used to request or release a data space. The user can request and release (additional) memory pages to an existing data space.
The ALESRV macro manages the entries in the access list. It connects a task to a data space and can also clear this connection. If the ALET is specified, the macro outputs the SPID associated with the data space.
The ALINF macro tells the user which entries in the access list refer to which data spaces.

Example

The following example illustrates the use of a type STACK data space. (@ expressions are predefined macros of the ASSEMBH assembler.) Only those sections of the full program relating to data space usage are shown.

DATASPAC START
         PRINT NOGEN
*        :
DSPMFD   DSPSRV MF=D
ALEMFD   ALESRV MF=D
*
DATASPAC @ENTR TYP=M
*        :
CREATE   LA    1,DSPPL ————————————————————————————————————————————————  (1) 
         @DATA DSECT=DSPMFD,BASE=1
         MVC   DSPPL(NVDD#),DSPMFL
         DSPSRV MF=M,FCT=CREATE,INISIZE=25
         DSPSRV MF=E,PARAM=(1)
         DSPSRV MF=R,SPID=DSPSPID
*
CONNECT  LA    1,ALEPL ————————————————————————————————————————————————  (2) 
         @DATA DSECT=ALEMFD,BASE=1
         MVC   ALEPL(NVDA#),ALEMFL
         ALESRV MF=M,SPID=DSPSPID
         ALESRV MF=E,PARAM=(1)
         ALESRV MF=R,ALET=DSPALET
*
         SAC   512 ————————————————————————————————————————————————————  (3) 
*
WRITEDS  LAM   8,8,DSPALET ————————————————————————————————————————————  (4) 
         SR    8,8
         MVC   0(100,8),DATA
*
         SAC   0 ——————————————————————————————————————————————————————  (5) 
*
INFORM   LA    1,DSPPL ————————————————————————————————————————————————  (6) 
         @DATA DSECT=DSPMFD,BASE=1
         MVC   DSPPL(NVDD#),DSPMFL
         DSPSRV MF=M,FCT=INFORM,IDENT=NAME,NAME='SHARED#DS',           C
                SCOPE=GLOBAL
         DSPSRV MF=E,PARAM=(1)
         DSPSRV MF=R,SPID=DSPSPID2
*
CONNECT2 LA    1,ALEPL ————————————————————————————————————————————————  (7) 
         @DATA DSECT=ALEMFD,BASE=1
         MVC   ALEPL(NVDA#),ALEMFL
         ALESRV MF=M,SPID=DSPSPID2
         ALESRV MF=E,PARAM=(1)
         ALESRV MF=R,ALET=DSPALET2
*
         SAC   512 ————————————————————————————————————————————————————  (8) 
*
COPYDS   LAM   7,7,DSPALET2 ———————————————————————————————————————————  (9) 
         SR    7,7
         MVC   0(100,7),0(8)
*
         SAC   0 —————————————————————————————————————————————————————— (10) 
*
CLEAR    LA    1,DSPPL ———————————————————————————————————————————————— (11) 
         @DATA DSECT=DSPMFD,BASE=1
         DSPSRV MF=M,FCT=CLEAR,SPID=DSPSPID2,AREA=1000,SIZE=100
         DSPSRV MF=E,PARAM=(1)
*
EXTEND   DSPSRV MF=M,FCT=EXTEND,SPID=DSPSPID,SIZE=1000 ———————————————— (12) 
         DSPSRV MF=E,PARAM=(1)
         DSPSRV MF=R,EXTADDR=DSPEXTND
*
*** Further access to the extended data space (read, write, etc.) ***
*
DISCONN  LA    1,ALEPL ———————————————————————————————————————————————— (13) 
         @DATA DSECT=ALEMFD,BASE=1
         MVC   ALEPL(NVDA#),ALEMFL
         ALESRV MF=M,FCT=DISCONN,ALET=DSPALET
         ALESRV MF=E,PARAM=(1)
         ALESRV MF=M,FCT=DISCONN,ALET=DSPALET2
         ALESRV MF=E,PARAM=(1)
*
DESTROY  LA    1,DSPPL ———————————————————————————————————————————————— (14) 
         @DATA DSECT=DSPMFD,BASE=1
         DSPSRV MF=M,FCT=DESTROY,SPID=DSPSPID
         DSPSRV MF=E,PARAM=(1)
         @EXIT
*
*** Definitions ***
*
DSPMFL   DSPSRV MF=L,NAME='SPACE1',MAXSIZE=2000
ALEMFL   ALESRV MF=L,FCT=CONNECT
*
DSPSPID  DS    D                  * SPID of data space created by
*                                 * program
DSPALET  DS    F                  * ALET of this data space
DSPSPID2 DS    D                  * SPID of another program's
*                                 * data space
DSPALET2 DS    F                  * ALET of this data space
DSPEXTND DS    A                  * Extension address
DSPPL    DS    XL(NVDD#)          * Dynamic data area for DSPSRV
ALEPL    DS    XL(NVDA#)          * Dynamic data area for ALESRV
DATA     DS    XL100              * Data to be transferred
         @END

(1)

A data space with a size of 100 Kbytes is created:The address of the parameter list for the DSPSRV macro is loaded into register R1 (LA), then the DSECT is placed over the parameter list (@DATA) and the parameter list is initialized (MVC). The data space is created by means of the DSPSRV macros. The DSPSPID field is to contain the SPID assigned by the system.

(2)

The program connects itself to the data space:the address of the parameter list for the ALESRV macro is loaded into register R1 (LA), then the DSECT is placed over the parameter list (@DATA) and the parameter list is initialized (MVC). The program connects itself to the data space via the ALESRV macros, specifying the SPID. The DSPALET field is to contain the corresponding ALET.

(3)

AR mode is activated. An access register is now assigned unambiguously to each general register.

(4)

Data is written to the data space:the base register is register R8. Access register 8 is loaded with the ALET of the data space (LAM).The base register is then deleted (SR).100 bytes of data from the DATA field are written to the start of the data space (MVC).

(5)

AR mode is deactivated:AR mode should always be deactivated as soon as possible in order to avoid unintentional access to the data space (particularly when branching to subprograms).

(6)

The SPID of another program's shareable data space is queried:the DSPSRV macros address this data space via its name and scope. The SPID of this data space is to be entered in the DSPSPID2 field.

(7)

The program sets up a connection to the other program's data space:the program connects itself to this data space via the ALESRV macros, specifying the SPID of the data space. The corresponding ALET is to be stored in the DSPALET2 field.

(8)

AR mode is activated. An access register is now assigned unambiguously to each general register.

(9)

Data is copied from one data space to another:access register 7 is loaded with the ALET of the other program's data space (LAM).100 bytes are written to the start of the other program's data space from the program's own data space, represented by access register 8.

(10)

AR mode is deactivated (see (5)).

(11)

Data is deleted from the other program's data space:the DSPSRV macros delete 400 Kb from this data space by overwriting them with binary zeros, starting at address X'1000'.

(12)

A data space is extended:the DSPSRV macros extend the program's own data space by 4000 Kb.

(13)

The connection to both data spaces is cleared down:the program clears down the connection to both data spaces via the ALESRV macros, specifying the appropriate ALETs.

(14)

The data space created by the program is destroyed. The corresponding entry in the access list is deleted.