/* IDENT X-3 */ /**************************************************************************** * Copyright 2002 Compaq Information Technologies Group, L.P. * * Compaq and the Compaq logo are trademarks of Compaq Information * Technologies Group, L.P. in the U.S. and/or other countries. * * Confidential computer software. Valid license from Compaq required for * possession, use or copying. Consistent with FAR 12.211 and 12.212, * Commercial Computer Software, Computer Software Documentation, and * Technical Data for Commercial Items are licensed to the U.S. Government * under vendor's standard commercial license. *****************************************************************************/ /* *++ * FACILITY: * * VMS Executive (LIB) * * ABSTRACT: * * This header file provides the basic set of C inline functions for * accessing PTEs. * * AUTHOR: * * Karen L. Noel * * CREATION DATE: 28-Mar-2000 * * MODIFICATION HISTORY: * * X-3 KLN3025 Karen L. Noel 26-Feb-2002 * o Port PT space to IA64. * o Remove inline pragmas. We trust the compiler now. * * X-2 KLN2200 Karen L. Noel 15-Nov-2000 * Fix nested comments. *-- */ /* Include any header files we need to make these functions work */ #ifndef __PTE_FUNCTIONS_LOADED #define __PTE_FUNCTIONS_LOADED 1 #ifdef __INITIAL_POINTER_SIZE /* Defined whenever ptr size pragmas supported */ #pragma __required_pointer_size __save /* Save the previously-defined required ptr size */ #pragma __required_pointer_size __short /* And set ptr size default to 32-bit pointers */ #endif #include #include #include #include #include #include /* *++ * $read_pte - Read a PTE * * This function reads a PTE. * * With VIRBND and SYSPTBR enabled, the level 1 page table page cannot be referenced * safely in a virtual manner. This function references the level 1 page table * physically when necessary. * * Input: pte_address - Address of PTE to read * Output: contents_p - Address to store the contents of the PTE *-- */ static void $read_pte (PTE_PQ pte_address, PTE_PQ contents_p) { extern PTE mmg$read_l1pte (PTE_PQ pte_address); extern PTE_PQ const mmg$gq_l1_base[VA$C_VRNX_COUNT]; extern uint64 const mmg$gq_page_size; extern uint64 const mmg$gq_bwp_width; extern uint64 const mmg$gq_bwp_mask; extern HWRPB * exe$gpq_hwrpb; /* If this system doesn't support system space page tables */ /* or, if this isn't a L1 PTE address, just read the PTE */ /* Note for IA64, hwprb$v_virbnd == 0 */ if ((exe$gpq_hwrpb->hwrpb$v_virbnd == 0) || ((uint64)pte_address < (uint64)mmg$gq_l1_base[VA$C_VRNX_SYSTEM]) || ((uint64)pte_address >= (uint64)mmg$gq_l1_base[VA$C_VRNX_SYSTEM]+mmg$gq_page_size)) { *contents_p = *pte_address; return; } /* Call a macro-32 routine to read the L1PTE physically */ *contents_p = mmg$read_l1pte(pte_address); return; } /*+++ * $write_pte - Write to a PTE. * * This function write to a PTE. * * With VIRBND and SYSPTBR enabled, the level 1 page table page cannot be referenced * safely in a virtual manner. This function references the level 1 page table * physically when necessary. * * Input: pte_address - Address of PTE to write * contents - The contents to write to the PTE * *--- */ static void $write_pte (PTE_PQ pte_address, PTE contents) { extern uint64 mmg$write_l1pte (PTE_PQ pte_address, PTE contents); extern PTE_PQ const mmg$gq_l1_base[VA$C_VRNX_COUNT]; extern uint64 const mmg$gq_page_size; extern uint64 const mmg$gq_bwp_width; extern uint64 const mmg$gq_bwp_mask; extern HWRPB * exe$gpq_hwrpb; /* If this system doesn't support system space page tables */ /* or, if this isn't a L1 PTE address, just write the PTE */ /* Note for IA64, hwprb$v_virbnd == 0 */ if ((exe$gpq_hwrpb->hwrpb$v_virbnd == 0) || ((uint64)pte_address < (uint64)mmg$gq_l1_base[VA$C_VRNX_SYSTEM]) || ((uint64)pte_address >= (uint64)mmg$gq_l1_base[VA$C_VRNX_SYSTEM]+mmg$gq_page_size)) { *pte_address = contents; return; } /* Call a macro-32 routine to write the L1PTE physically */ mmg$write_l1pte(pte_address,contents); return; } #ifdef __INITIAL_POINTER_SIZE /* Defined whenever ptr size pragmas supported */ #pragma __required_pointer_size __restore /* Restore the previously-defined required ptr size */ #endif #endif /* __PTE_FUNCTIONS_LOADED */