 |
Upgrading Privileged-Code Applications on OpenVMS Alpha and
OpenVMS I64 Systems
7.6.4 Pointer to SYI PFN Memory Map
If your code references the following data cell, you must modify your code
on I64 to reference the new cell:
Alpha cell (32 Bits) |
New Alpha and I64 Cell |
MMG$GL_SYI_PFN_MEMORY_MAP |
MMG$GL_SYI_PFN_MEMORY_MAP_64 |
The Alpha cell is the address of an array of PMM structures that describes
physical memory. The new cell, MMG$GL_SYI_PFN_MEMORY_MAP_64, is the address
of an array of PMM64 structures that describe physical memory. See Section
7.4.3 for a description of the PMM64 structure.
You must change your code to refer to the PMM64 array.
Existing Code
extern int *mmg$gl_syi_pfn_memory_map; PMM * syi_pmm; unsigned int pfn; unsigned int count; int pmm_count = mmg$gl_syi_pfn_memory_map[0]; syi_pmm = &mmg$gl_syi_pfn_memory_map[1]; for (i=0; i<pmm_count; i++) { pfn = syi_pmm[i].pmm$l_start_pfn; count = syi_pmm[i].pmm$l_pfn_count; printf ("PFN %08X COUNT %08X \n", pfn, count); }
|
New Code
extern unsigned __int64 *mmg$gl_syi_pfn_memory_map_64; PMM64 * syi_pmm; unsigned __int64 pfn; unsigned __int64 count; int pmm_count = mmg$gl_syi_pfn_memory_map[0]; syi_pmm = &mmg$gl_syi_pfn_memory_map_64[1]; for (i=0; i<pmm_count; i++) { pfn = syi_pmm[i].pmm64$q_start_pfn; count = syi_pmm[i].pmm64$q_pfn_count; printf ("PFN %016LX COUNT %016LX \n", pfn, count); }
|
7.6.5 Shared L2 Page Table PFN
If your code references the following data cell, you must modify your I64
code.
Alpha cell (32 Bits) |
New Alpha and I64 Cell (64 Bits) |
MMG$GL_SHARED_L2PT_PFN |
MMG$GQ_SHARED_L2PT_PFN |
7.6.6 Black Hole PFN Data Cell
If your code references the following data cell, you must modify your code
on I64.
Alpha cell (32 Bits) |
New Alpha and I64 cell (64 Bits) |
EXE$GL_BLAKHOLE |
EXE$GQ_BLAKHOLE |
You must examine all variables and code that reference the black hole PFN
so that 64-bit PFNs are maintained.
Existing Code
MOVL EXE$GL_BLAKHOLE,R0 ; Get the PFN of the black hole page ASSUME PTE$V_PFN EQ 32 MOVLR0,4(R3) ; Map black hole page
|
New Code
EVAX_LDQ R0,EXE$GQ_BLAKHOLE ; Get the 64-bit PFN of the black hole page INSV R0,- ; Map black hole page #PTE$V_PFN,#PTE$S_PFN,(R3)
|
7.6.7 MMG Window PFN Pointer Data Cells
If your code references any of the following data cells, you must modify your
code on I64.
Alpha Cell |
New Alpha and I64 Cell |
MMG$GQ_WINDOW_PTE_PFN |
MMG$GQ_WINDOW_PTE |
MMG$GQ_WINDOW2_PTE_PFN |
MMG$GQ_WINDOW2_PTE |
The new fields point to the entire PTE, not just to the PFN field. This is
because the PFN field in the PTE is no longer on a naturally aligned boundary.
Therefore, you must reference the PTE as a structure instead of referencing
the PFN field directly.
Existing Code
extern VOID_PQ const mmg$gq_window_va; extern INT_PQ const mmg$gq_window_pte_pfn; int pfn; *mmg$gq_window_pte_pfn = pfn; /* Store PFN into window PTE */ tbi_data_64 (mmg$gq_window_va, THIS_CPU_ONLY, ((PCB *)0));
|
New Code
#include <lib_types.h> extern VOID_PQ const mmg$gq_window_va; extern PTE_PQ const mmg$gq_window_pte; PFN_T pfn; mmg$gq_window_pte->pte$v_pfn = pfn; /* Store PFN into window PTE */ tbi_data_64 (mmg$gq_window_va, THIS_CPU_ONLY, ((PCB *)0));
|
7.7 System Routines
Some system routines in SYS$BASE_IMAGE.EXE pass PFNs by reference or as function
return values. These routines are removed on I64. New system routines are being
added to Alpha and I64. These routines are described in the following sections.
The following new routines are available on Alpha and I64. The C prototypes
are listed here for easy reference.
PFN_T ioc$ptetopfn_64 (PTE_PQ pte); PFN_T mmg$allocate_pfn (uint32 flags, int color, uint64 byte_align); PFN_T mmg$allocate_contig_pfns (uint64 page_count, uint32 flags, int color, uint64 byte_align, PFN_T low_pfn, PFN_T high_pfn, UINT64_PQ largest_chunk); int mmg$allocate_sva_and_pfns (uint64 page_count, uint32 flags, int color, int system_region, int proto_pte, int refcnt, VOID_PPQ ret_sva); int mmg$allocate_pfn_map (uint64 page_count, uint32 flags, int color, PFN_T low_pfn, PFN_T high_pfn, VOID_PQ sva, int proto_pte, int refcnt);
|
The following sections describe the old and new routines more completely.
7.7.1 Converting from PTE Address to PFN
If your code calls either of the following routines, you must modify your
code on I64 to call the new routines:
Alpha Routine |
Alpha and I64 Routine |
ioc$ptetopfn (JSB routine) |
ioc$ptetopfn_64 |
ioc_std$ptetopfn |
ioc$ptetopfn_64 |
Prototype
PFN_T ioc$ptetopfn_64 (PTE_PQ pte);
|
This routine returns a 32-bit PFN on Alpha and a 64-bit PFN on I64. After
the function call, the resulting PFN must be handled as a 64-bit value on I64.
Existing Code
.SET_REGISTERS READ=<R3>,WRITTEN=<R3> JSB IOC$PTETOPFN ; Convert PTE to PFN MOVL R3,R7 ; Copy PFN
|
New Code
$SETUP_CALL64 1 $PUSH_ARG64 R3 ; Pass PTE address $CALL64 IOC$PTETOPFN_64 ; Convert PTE to PFN EVAX_OR R0,R31,R7 ; Copy PFN
|
If your code invokes the following macro from Macro-32, you must modify your
code on I64:
Alpha Macro |
New Alpha and I64 Macro |
CALL_PTETOPFN |
CALL_PTETOPFN_64 |
This macro returns a 32-bit PFN on Alpha and a 64-bit PFN on I64. After the
macro invocation, the resulting PFN must be handled as a 64-bit value.
Existing Code
.SET_REGISTERS READ=<R3>, WRITTEN=<R0,R1,R3> CALL_PTETOPFN SAVE_R0R1=NO ; R3 = PFN = IOC_STD$PTETOPFN (PTE IN R3) MOVL R3,R0 ; R0 = PFN
|
New Code
.SET_REGISTERS READ=<R3>, WRITTEN=<R0,R1,R3> CALL_PTETOPFN_64 SAVE_R0R1=NO ; R3 = PFN = IOC$PTETOPFN_64 (PTE IN R3) EVAX_OR R3,R31,R0 ; R0 = PFN
|
7.7.2 PFN Allocation Routines
Routines and macros that allocate, map, and return PFNs are replaced with
new routines and macros. The new routines and macros are now available on Alpha
and I64.
At this time, only specific combinations of flags and parameters are supported
for the new routines. Use the tables below to map your current routine call
to a call that is supported for 64-bit PFNs. To request a specific alignment,
specify a byte alignment rather than a page number for the new routines.
Alpha Macro-32 Macro |
New Alpha and I64 Macro-32 Macro |
allocpfn [va] [vpn] [rad]
returns pfn in R0, pfndb entry in R15 |
allocpfn_64 [va] [vpn] [rad]
returns pfn in R0, pfndb entry in R15 |
alloc_zero_pfn [va] [vpn] [rad]
returns pfn in R0, pfndb entry in R15 |
alloc_zero_pfn_64 [va] [vpn] [rad]
returns pfn in R0, pfndb entry in R15 |
Alpha Routine |
New Alpha and I64 Routine:
mmg$allocate_pfn |
#include <pfn_macros.h>
pfn = allocpfn (&pfndb_entry, 0, vpn); |
byte_align = vpn<<mmg$gq_bwp_width;
pfn = mmg$allocate_pfn (
0, // flags
MMG$K_NO_RAD,
byte_align); // byte_align
pfndb_entry = pfn_to_entry (pfn); |
|
|
#include <pfn_macros.h>
pfn = alloc_zero_pfn (&pfndb_entry, 0, vpn); |
byte_align = vpn<<mmg$gq_bwp_width;
pfn = mmg$allocate_pfn (
MMG$M_ZEROED,
MMG$K_NO_RAD,
byte_align); // byte_align
pfndb_entry = pfn_to_entry (pfn); |
|
|
pfn = mmg_std$alloc_pfn_64 (
&pfndb_entry); |
pfn = mmg$allocate_pfn (
0, // flags
MMG$K_NO_RAD,
0); // byte_align
pfndb_entry = pfn_to_entry (pfn); |
|
|
pfn = mmg_std$alloc_zero_pfn_64 (
&pfndb_entry); |
pfn = mmg$allocate_pfn (
MMG$M_ZEROED,
MMG$K_NO_RAD,
0);
pfndb_entry = pfn_to_entry (pfn); |
|
|
pfn = mmg$alloc_zero_algnd_64 (
vpn,
&pfndb_entry); |
byte_align = vpn<<mmg$gq_bwp_width;
pfn = mmg$allocate_pfn (
MMG$M_ZEROED,
MMG$K_NO_RAD,
byte_align);
pfndb_entry = pfn_to_entry (pfn); |
|
|
pfn = mmg$alloc_pfn_color_64 (
color_flags,
vpn,
rad,
&pfndb_entry); |
byte_align = vpn<<mmg$gq_bwp_width;
pfn = mmg$allocate_pfn (
color_flags,
color,
byte_align);
pfndb_entry = pfn_to_entry (pfn); |
|
|
pfn = mmg$alloc_zero_color_64 (
color_flags,
vpn,
rad,
&pfndb_entry); |
byte_align =vpn<<mmg$gq_bwp_width;
pfn = mmg$allocate_pfn (
color_flags | MMG$M_ZEROED,
color,
byte_align);
pfndb_entry = pfn_to_entry (pfn); |
|