zircon/kernel/arch/x86/mmu.cc
/**
 * @brief  check if the virtual address is canonical
 */
@brief  check if the virtual address is canonical
@brief check if the virtual address is canonical
bool x86_is_vaddr_canonical(vaddr_t vaddr) {
  uint64_t max_vaddr_lohalf, min_vaddr_hihalf;
  max_vaddr_lohalf = ((uint64_t)1ull << (g_vaddr_width - 1)) - 1;
  min_vaddr_hihalf = ~max_vaddr_lohalf;
  if ((vaddr > max_vaddr_lohalf) && (vaddr < min_vaddr_hihalf))
    return false;
  return true;
}
bool x86_is_vaddr_canonical ( vaddr_t vaddr ) { uint64_t max_vaddr_lohalf , min_vaddr_hihalf ; max_vaddr_lohalf = ( ( uint64_t ) 1ull << ( g_vaddr_width - 1 ) ) - 1 ; min_vaddr_hihalf = ~ max_vaddr_lohalf ; if ( ( vaddr > max_vaddr_lohalf ) && ( vaddr < min_vaddr_hihalf ) ) return false ; return true ; }
@brief  check if the virtual address is canonical
@brief check if the virtual address is canonical
/* get max address in lower-half canonical addr space */ /* e.g. if width is 48, then 0x00007FFF_FFFFFFFF */ /* get min address in higher-half canonical addr space */ /* e.g. if width is 48, then 0xFFFF8000_00000000*/ /* Check to see if the address in a canonical address */