mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
target/arm: Implement MTE tag-checking functions for FEAT_MOPS
The FEAT_MOPS instructions need a couple of helper routines that check for MTE tag failures: * mte_mops_probe() checks whether there is going to be a tag error in the next up-to-a-page worth of data * mte_check_fail() is an existing function to record the fact of a tag failure, which we need to make global so we can call it from helper-a64.c Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20230912140434.1333369-7-peter.maydell@linaro.org
This commit is contained in:
parent
aa03378bcc
commit
8163998920
2 changed files with 80 additions and 2 deletions
|
@ -1272,6 +1272,34 @@ FIELD(MTEDESC, SIZEM1, 12, SIMD_DATA_BITS - 12) /* size - 1 */
|
|||
bool mte_probe(CPUARMState *env, uint32_t desc, uint64_t ptr);
|
||||
uint64_t mte_check(CPUARMState *env, uint32_t desc, uint64_t ptr, uintptr_t ra);
|
||||
|
||||
/**
|
||||
* mte_mops_probe: Check where the next MTE failure is for a FEAT_MOPS operation
|
||||
* @env: CPU env
|
||||
* @ptr: start address of memory region (dirty pointer)
|
||||
* @size: length of region (guaranteed not to cross a page boundary)
|
||||
* @desc: MTEDESC descriptor word (0 means no MTE checks)
|
||||
* Returns: the size of the region that can be copied without hitting
|
||||
* an MTE tag failure
|
||||
*
|
||||
* Note that we assume that the caller has already checked the TBI
|
||||
* and TCMA bits with mte_checks_needed() and an MTE check is definitely
|
||||
* required.
|
||||
*/
|
||||
uint64_t mte_mops_probe(CPUARMState *env, uint64_t ptr, uint64_t size,
|
||||
uint32_t desc);
|
||||
|
||||
/**
|
||||
* mte_check_fail: Record an MTE tag check failure
|
||||
* @env: CPU env
|
||||
* @desc: MTEDESC descriptor word
|
||||
* @dirty_ptr: Failing dirty address
|
||||
* @ra: TCG retaddr
|
||||
*
|
||||
* This may never return (if the MTE tag checks are configured to fault).
|
||||
*/
|
||||
void mte_check_fail(CPUARMState *env, uint32_t desc,
|
||||
uint64_t dirty_ptr, uintptr_t ra);
|
||||
|
||||
static inline int allocation_tag_from_addr(uint64_t ptr)
|
||||
{
|
||||
return extract64(ptr, 56, 4);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue