/* Version X-3 */ /***************************************************************************** * * * COPYRIGHT (c) 1994 BY * * DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. * * ALL RIGHTS RESERVED. * * * * THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * * ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * * INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * * COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * * OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * * TRANSFERRED. * * * * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * * AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * * CORPORATION. * * * * DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * * SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL. * * * *****************************************************************************/ /* *++ * FACILITY: * * Open/VMS AXP (STARLET) * * ABSTRACT: * * This header file will provide big page macros equivalent to * the STARLET big page macros which exist for BLISS and Macro. * * AUTHOR: * * Karen Noel * * CREATION DATE: 8-Sep-1994 * * MODIFICATION HISTORY: * * X-3 KLN1329 Karen L. Noel 2-Nov-1994 * Work around problem with C in $is_32bits. * * X-2 KLN1322 Karen L. Noel 19-Sep-1994 * 64-bit Project: Internal programming * Fix $is_p2_va and $is_process_va to be < not <= * Define roundup argument. *-- */ /* *++ * $start_of_page - Calculate the starting address of the page. * * Inputs: * source_va - source address * page_size - Application supplied page size * * Returns: * The address of the first byte within the page specified by source_va. *-- */ #define $start_of_page(source_va, page_size) \ (VOID_PQ)((unsigned __int64)source_va & ~(unsigned __int64)(page_size-1)) /* *++ * $next_page - Calculate the address of the next page. * * Inputs: * source_va - source address * clearbwp - If 1, masks the bwp portion of the VA. * page_size - Application specified page size. * * Returns: * The address of one page after the source address. If clearbwp is 1, * the address will be rounded down to be the start of the next page. * *-- */ #define $next_page(source_va, clearbwp, page_size) \ (VOID_PQ)(((unsigned __int64)source_va + \ (unsigned __int64)page_size) & \ ~(clearbwp * ((unsigned __int64)page_size-1)) ) /* *++ * $previous_page - Calculate the address of the previous page. * * Inputs: * source_va - source address * clearbwp - If 1, masks the bwp portion of the VA. * page_size - Application specified page size. * * Returns: * The address of one page before the source address. If clearbwp is 1, * the address will be rounded down to be the start of the previous page. * *-- */ #define $previous_page(source_va, clearbwp, page_size) \ (VOID_PQ)(((unsigned __int64)source_va - \ (unsigned __int64)page_size) & \ ~(clearbwp * ((unsigned __int64)page_size-1)) ) /* *++ * $pages_to_bytes - Convert pages to bytes * * Inputs: * page_count - Page count * page_size - Application specified page size. * * Returns: * Return the number of bytes in source_pagcnt. * *-- */ #define $pages_to_bytes(page_count, page_size) (page_count * page_size) /* *++ * $bytes_to_pages - Convert bytes to pages * * Inputs: * byte_count - Byte count * page_size - Application specified page size. * roundup = 1 if round up byte_count before calculating page count * = 0 if no rounding required. * * Returns: * Return the number of pages in source_pagcnt. * *-- */ #define $bytes_to_pages(byte_count, page_size, roundup) \ ((byte_count + (roundup*(page_size-1))) / page_size) /* *++ * $is_32bits - Test if quadword is 32-bit sign-extended * * Input: arg * * Output: 1 if arg is 32-bit sign-extended * 0 if arg is not 32-bit sign-extended * *-- */ #define $is_32bits(arg) \ ((((__int64)(arg)<<32)>>32) == (unsigned __int64)(arg)) /* *++ * $is_p0_va - Test if quadword is P0 space address * * Input: arg - 64-bit address * * Output: 1 if arg is P0 space address * 0 if arg is not P0 space address * *-- */ #define $is_p0_va(arg) \ ($is_32bits(arg) && \ !((unsigned int)arg & VA$M_SYSTEM) && \ !((unsigned int)arg & VA$M_P1)) /* *++ * $is_p1_va - Test if quadword is P1 space address * * Input: arg - 64-bit address * * Output: 1 if arg is P1 space address * 0 if arg is not P1 space address * *-- */ #define $is_p1_va(arg) \ ($is_32bits(arg) && \ !((unsigned int)arg & VA$M_SYSTEM) && \ ((unsigned int)arg & VA$M_P1)) /* *++ * $is_p2_va - Test if quadword is P2 space address * * Inputs: arg - 64-bit address * proc_limit - upper limit on process space, obtained from $GETSYI * * Output: 1 if arg is P2 space address * 0 if arg is not P2 space address * *-- */ #define $is_p2_va(arg,proc_limit) \ (((unsigned __int64)(arg) >= (unsigned __int64)0x80000000) && \ ((unsigned __int64)(arg) < (unsigned __int64)(proc_limit))) /* *++ * $is_process_va - Test if quadword is a process space address * * Inputs: arg - 64-bit address * proc_limit - upper limit on process space, obtained from $GETSYI * * Output: 1 if arg is process space address * 0 if arg is not process space address * *-- */ #define $is_process_va(arg,proc_limit) \ ((unsigned __int64)(arg) < (unsigned __int64)(proc_limit)) /* *++ * $is_system_va - Test if quadword is a system space address * * Inputs: arg - 64-bit address * system_base - Base address of system space, obtained from $GETSYI * * Output: 1 if arg is system space address * 0 if arg is not system space address * *-- */ #define $is_system_va(arg,system_base) \ ((unsigned __int64)(arg) >= (unsigned __int64)(system_base)) /* *++ * $is_s0s1_va - Test if quadword is an s0s1 address * * Inputs: arg - 64-bit address * * Output: 1 if arg is s0s1 address * 0 if arg is not s0s1 address * *-- */ #define $is_s0s1_va(arg) \ ($is_32bits(arg) && \ ((unsigned int)arg & VA$M_SYSTEM)) /* *++ * $is_s2_va - Test if quadword is an s2 address * * Inputs: arg - 64-bit address * * Output: 1 if arg is s2 address * 0 if arg is not s2 address * *-- */ #define $is_s2_va(arg,system_base) \ (((unsigned __int64)(arg) >= (unsigned __int64)(system_base)) && \ ((unsigned __int64)(arg) < (unsigned __int64)(int)0x80000000))