On 18/7/26 01:22, Richard Henderson wrote:
Return not just the tag memory, but the data memory, flags,
and attributes.  Make sure probe of NoTagAccess looks like
any other page permission failure.

Signed-off-by: Richard Henderson <[email protected]>
---
  target/arm/tcg/mte_helper.c | 102 +++++++++++++++++++++---------------
  1 file changed, 60 insertions(+), 42 deletions(-)


-static uint8_t *
+typedef struct AllocationTagMem {
+    uint8_t *tag_mem;
+    void *ptr_mem;
+    int flags;
+    MemTxAttrs attrs;
+} AllocationTagMem;
+
+static AllocationTagMem
  allocation_tag_mem_internal(CPUARMState *env, int ptr_mmu_idx,
-                            uint64_t ptr, MMUAccessType ptr_access,
+                            vaddr ptr, MMUAccessType ptr_access,
                              int ptr_size, MMUAccessType tag_access,
                              bool probe, uintptr_t ra)
  {
-#ifdef CONFIG_USER_ONLY
-    const size_t page_data_size = TARGET_PAGE_SIZE >> (LOG2_TAG_GRANULE + 1);
-    uint64_t clean_ptr = useronly_clean_ptr(ptr);
-    int flags = page_get_flags(clean_ptr);
-    uint8_t *tags;
-    uintptr_t index;
+    AllocationTagMem ret = { };

I'd feel safer starting with:

     AllocationTagMem ret = {
         .flags = TLB_INVALID_MASK,
         .attrs = MEMTXATTRS_UNSPECIFIED,
     };

anyway:
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>


Reply via email to