hp.com home products and services support and drivers solutions how to buy
cd-rom home
End of Jump to page title
HP OpenVMS systems
documentation

Jump to content


Upgrading Privileged-Code Applications on OpenVMS Alpha and OpenVMS I64 Systems

Upgrading Privileged-Code Applications on OpenVMS Alpha and OpenVMS I64 Systems


Previous Contents Index

7.3 Bliss Programming

This section contains instructions for Bliss programmers.

In general, Hewlett-Packard recommends that if your Bliss-32 code references PTEs and/or PFNs, that you first convert the modules or routines to Bliss-64. The rest of this section assumes your Bliss modules are compiled by the Bliss-64 compilers for Alpha and I64.

7.3.1 PTE Field References in Bliss-64

The PTE$V_PFN macro is used to reference the PFN stored in a valid or transition PTE.

The PTE$V_PFN, PTE$S_PFN, and PTE$M_PFN macros are defined in LIB.L64. The following table shows the macro definitions on Alpha and I64:
Macro Name Alpha Definition I64 Definition
PTE$V_PFN 4,0,32,0 % 0,24,40,0%
PTE$S_PFN 32 40
PTE$M_PFN %X'FFFFFFFF00000000' %X'FFFFFFFFFF000000'

In Bliss-64, PFNs can be referenced using the PTE$V_PFN macro.

Good Example


    Local Pfn, 
          Pte: ref bblock; 
    Pfn = .Pte[pte$v_pfn]; 
    Pte[pte$v_pfn] = .Pfn; 

These references work as common code on Alpha and I64.

PFNs are sometimes extracted from PTEs using a hard-coded 32-bit shift.

Bad Example


    Local Pfn, 
          Pte_quad; 
    Pfn = .Pte_quad ^ -32; 

This code must be changed to use the PTE$V_PFN macro as shown in the Good Example above.

7.3.2 PFN References in Bliss-64

PFNs are often treated as longwords in existing Bliss code. For I64, you must ensure that the high order 32-bits are not truncated or sign extended.

Existing Code


   Local 
        Pfn: long unsigned; 

New Code


    Local 
        Pfn: unsigned; 

In the new code, all references to the Pfn variable in Bliss-64 are treated as 64-bit values. If you want to use 32-bit PFNs on Alpha and 64-bit PFNs on I64, you can use conditionals.

New Code


    %if ALPHA %then 
    Local Pfn: long unsigned; 
    %fi 
 
    %if IA64 %then 
    Local Pfn: unsigned; 
    %fi 

7.4 System Services

This section describes the changes to system services for 50-bit physical addressing.

The system services used to PFN-map memory are described in Section 7.4.1. There are two item codes to SYS$GETSYI affected by the 50-Bit physical addressing project. These are described in Section 7.4.2 and Section 7.4.3.

7.4.1 PFN-Map System Services

If your code calls any of the following services, you must modify it for OpenVMS I64 Version 8.2:

Start by finding all locations that reference the PFN passed to the service. Modify the code to reference a 64-bit PFN. See previous sections that describe language specific changes you must make.

If your code calls SYS$CRMPSC with the flag SEC$M_PFNMAP, you must change your code to call one of the 64-bit services. The 32-bit interface no longer allows PFN-mapping on I64.

When calling one of the 64-bit PFN-mapping system services, set the flag SEC$M_ARGS64 to indicate that 64-bit arguments are being passed to the service.

Existing Code


     unsigned int pfn_to_map;            
     /* Existing call to sys$crmpsc_gpfn_64 */ 
     status = sys$crmpsc_gpfn_64 (&gs_name, &ident, PRT$C_UW, pfn_to_map, 
             page_count, &region_id, 0, 0, SEC$M_EXPREG, &mapped_va, 
             &mapped_length); 

New Code


     unsigned __int64 pfn_to_map; 
     /* Call with new flag, SEC$M_ARGS64 */ 
     status = sys$crmpsc_gpfn_64 (&gs_name, &ident, PRT$C_UW, pfn_to_map, 
             page_count, &region_id, 0, 0, SEC$M_EXPREG | SEC$M_ARGS64, 
             &mapped_va, &mapped_length); 

7.4.2 SYI$_MAX_PFN

If your code calls SYS$GETSYI[W] with the item code SYI$_MAX_PFN, you must modify your code. The new item code, SYI$_MAX_PFN_64 is also available on Alpha so you can maintain common code.

To modify your code, do the following:

  1. Change your local max PFN variable to 64-bits.
  2. Change the item list entry size to 8 bytes.
  3. Change the item code from SYI$_MAX_PFN to SYI$_MAX_PFN_64.
  4. Modify all other references to the max PFN variable so that 64 bits are maintained.

Existing Code


    ILE3 item_list[2]; 
    unsigned int max_pfn; 
 
    item_list[0].ile3$w_length   = sizeof (unsigned int); 
    item_list[0].ile3$w_code     = SYI$_MAX_PFN; 
    item_list[0].ile3$ps_bufaddr = &max_pfn; 
 
    status = sys$getsyiw (EFN$C_ENF, 0, 0, &item_list, &iosb, 0, 0); 

Modified Code


    ILE3 item_list[2];              
    unsigned __int64 max_pfn; /* 64-bit max PFN */ 
 
    item_list[0].ile$w_length    = sizeof (unsigned __int64); 
    item_list[0].ile3$w_code     = SYI$_MAX_PFN_64; 
    item_list[0].ile3$ps_bufaddr = &max_pfn; 
 
    status = sys$getsyiw (EFN$C_ENF, 0, 0, &item_list, &iosb, 0, 0); 

7.4.3 PMM Structure

The PMM structure has been replaced by the PMM64 structure on I64. If your code references any of the PMM structure fields, you must modify your code on I64 to reference the new structure and the new field names.

The new PMM64 structure has been added to Alpha so that the 32-bit PMM array and 64-bit PMM64 exist on Alpha. Only the 64-bit PMM64 structure exists on I64.
PMM Field Name PMM64 Field Name Description
PMM$W_LENGTH PMM64$W_LENGTH Size of a PMM64 structure
(3 quads = 24 bytes)
PMM$W_FLAGS PMM64$W_FLAGS Console, openvms, available,
base, galaxy_shared
PMM$L_START_PFN PMM64$Q_START_PFN First PFN in this cluster
PMM$L_PFN_COUNT PMM64$Q_PFN_COUNT Number of PFNs in this cluster

7.4.4 SYI$_PFN_MEMORY_MAP

If your code calls SYS$GETSYI[W] with the item code SYI$_PFN_MEMORY_MAP, you must modify your code. The new item code, SYI$_PFN_MEMORY_MAP_64 is also available on Alpha so you can maintain common code.

To modify your code, do the following:

  1. Change the PMM structure to a PMM64 structure.
  2. Change all references to the PMM structure fields to the corresponding PMM64 structure fields.
  3. Change all variables and code that reference PFNs to use 64-bits.
  4. Change the call to SYS$GETSYI[W] to use the SYI$_PFN_MEMORY_MAP_64 item code.

Existing Code


    ILE3        item_list[2]; 
    int         pmd_count; 
    int          buflen; 
    PMM *        pmm_ptr; 
    unsigned int pfn; 
    unsigned int pages; 
 
    buflen  = sizeof(PMM)*pmd_count; 
    pmm_ptr = malloc (buflen); 
 
    item_list[0].ile3$w_length   = buflen; 
    item_list[0].ile3$w_code     = SYI$_PFN_MEMORY_MAP; 
    item_list[0].ile3$ps_bufaddr = pmm_ptr; 
 
    status = sys$getsyiw (EFN$C_ENF, 0, 0, &item_list, &iosb, 0, 0); 
    pfn   = pmm_ptr->pmm$l_start_pfn; 
    pages = pmm_ptr->pmm$l_pfn_count; 

Modified Code


    ILE3             item_list[2]; 
    int              pmd_count; 
    int     buflen; 
    PMM64 *          pmm_ptr;  
    unsigned __int64 pfn;    
    unsigned __int64 pages;         
 
    buflen  = sizeof(PMM64)*pmd_count; 
    pmm_ptr = malloc (buflen); 
 
    item_list[0].ile3$w_length   = buflen; 
    item_list[0].ile3$w_code     = SYI$_PFN_MEMORY_MAP64; 
    item_list[0].ile3$ps_bufaddr = pmm_ptr; 
 
    status = sys$getsyiw (EFN$C_ENF, 0, 0, &item_list, &iosb, 0, 0); 
    pfn   = pmm_ptr->pmm64$q_start_pfn; 
    pages = pmm_ptr->pmm64$q_pfn_count;     


Previous Next Contents Index