* page table on a different vCPU, the following registers would need to be
* loaded: TCR_EL1, TTBR0_EL1, TTBR1_EL1, and SCTLR_EL1.
*/
-static int guest_walk_sd(const struct vcpu *v,
- vaddr_t gva, paddr_t *ipa,
- unsigned int *perms)
+static bool guest_walk_sd(const struct vcpu *v,
+ vaddr_t gva, paddr_t *ipa,
+ unsigned int *perms)
{
int ret;
bool disabled = true;
}
if ( disabled )
- return -EFAULT;
+ return false;
/*
* The address of the L1 descriptor for the initial lookup has the
/* Access the guest's memory to read only one PTE. */
ret = access_guest_memory_by_ipa(d, paddr, &pte, sizeof(short_desc_t), false);
if ( ret )
- return -EINVAL;
+ return false;
switch ( pte.walk.dt )
{
case L1DESC_INVALID:
- return -EFAULT;
+ return false;
case L1DESC_PAGE_TABLE:
/*
/* Access the guest's memory to read only one PTE. */
ret = access_guest_memory_by_ipa(d, paddr, &pte, sizeof(short_desc_t), false);
if ( ret )
- return -EINVAL;
+ return false;
if ( pte.walk.dt == L2DESC_INVALID )
- return -EFAULT;
+ return false;
if ( pte.pg.page ) /* Small page. */
{
*perms |= GV2M_EXEC;
}
- return 0;
+ return true;
}
/*
* page table on a different vCPU, the following registers would need to be
* loaded: TCR_EL1, TTBR0_EL1, TTBR1_EL1, and SCTLR_EL1.
*/
-static int guest_walk_ld(const struct vcpu *v,
- vaddr_t gva, paddr_t *ipa,
- unsigned int *perms)
+static bool guest_walk_ld(const struct vcpu *v,
+ vaddr_t gva, paddr_t *ipa,
+ unsigned int *perms)
{
int ret;
bool disabled = true;
*/
if ( (input_size > TCR_EL1_IPS_48_BIT_VAL) ||
(input_size < TCR_EL1_IPS_MIN_VAL) )
- return -EFAULT;
+ return false;
}
else
{
}
if ( disabled )
- return -EFAULT;
+ return false;
/*
* The starting level is the number of strides (grainsizes[gran] - 3)
/* Get the IPA output_size. */
ret = get_ipa_output_size(d, tcr, &output_size);
if ( ret )
- return -EFAULT;
+ return false;
/* Make sure the base address does not exceed its configured size. */
ret = check_base_size(output_size, ttbr);
if ( !ret )
- return -EFAULT;
+ return false;
/*
* Compute the base address of the first level translation table that is
/* Access the guest's memory to read only one PTE. */
ret = access_guest_memory_by_ipa(d, paddr, &pte, sizeof(lpae_t), false);
if ( ret )
- return -EFAULT;
+ return false;
/* Make sure the base address does not exceed its configured size. */
ret = check_base_size(output_size, pfn_to_paddr(pte.walk.base));
if ( !ret )
- return -EFAULT;
+ return false;
/*
* If page granularity is 64K, make sure the address is aligned
if ( (output_size < TCR_EL1_IPS_52_BIT_VAL) &&
(gran == GRANULE_SIZE_INDEX_64K) &&
(pte.walk.base & 0xf) )
- return -EFAULT;
+ return false;
/*
* Break if one of the following conditions is true:
* maps a memory block at level 3 (PTE<1:0> == 01).
*/
if ( !lpae_is_valid(pte) || !lpae_is_mapping(pte, level) )
- return -EFAULT;
+ return false;
/* Make sure that the lower bits of the PTE's base address are zero. */
mask = GENMASK_ULL(47, grainsizes[gran]);
if ( !pte.pt.xn && !xn_table )
*perms |= GV2M_EXEC;
- return 0;
+ return true;
}
-int guest_walk_tables(const struct vcpu *v, vaddr_t gva,
- paddr_t *ipa, unsigned int *perms)
+bool guest_walk_tables(const struct vcpu *v, vaddr_t gva,
+ paddr_t *ipa, unsigned int *perms)
{
uint32_t sctlr = READ_SYSREG(SCTLR_EL1);
register_t tcr = READ_SYSREG(TCR_EL1);
/* We assume that the domain is running on the currently active domain. */
if ( v != current )
- return -EFAULT;
+ return false;
/* Allow perms to be NULL. */
perms = perms ?: &_perms;
/* Memory can be accessed without any restrictions. */
*perms = GV2M_READ|GV2M_WRITE|GV2M_EXEC;
- return 0;
+ return true;
}
if ( is_32bit_domain(v->domain) && !(tcr & TTBCR_EAE) )