diff mbox

[12/14] target-arm: Add user-mode transaction attribute

Message ID 1428437400-8474-13-git-send-email-peter.maydell@linaro.org
State Superseded
Headers show

Commit Message

Peter Maydell April 7, 2015, 8:09 p.m. UTC
Add a transaction attribute indicating that a memory access is being
done from user-mode (unprivileged). This corresponds to an equivalent
signal in ARM AMBA buses.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 include/exec/memattrs.h | 3 +++
 target-arm/helper.c     | 4 ++++
 2 files changed, 7 insertions(+)
diff mbox

Patch

diff --git a/include/exec/memattrs.h b/include/exec/memattrs.h
index 5df180e..458c0ea 100644
--- a/include/exec/memattrs.h
+++ b/include/exec/memattrs.h
@@ -27,6 +27,9 @@  typedef uint64_t MemTxAttrs;
 /* ARM/AMBA TrustZone Secure access */
 #define MEMTXATTRS_SECURE (1ULL << 0)
 
+/* Memory access is usermode (unprivileged) */
+#define MEMTXATTRS_USER (1ULL << 1)
+
 /* Bus masters which don't specify any attributes will get this,
  * which has all attribute bits clear except the topmost one
  * (so that we can distinguish "all attributes deliberately clear"
diff --git a/target-arm/helper.c b/target-arm/helper.c
index fdeb2b7..6fca8f8 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -5752,6 +5752,10 @@  static inline int get_phys_addr(CPUARMState *env, target_ulong address,
         *attrs = 0;
     }
 
+    if (regime_is_user(env, mmu_idx)) {
+        *attrs |= MEMTXATTRS_USER;
+    }
+
     /* Fast Context Switch Extension. This doesn't exist at all in v8.
      * In v7 and earlier it affects all stage 1 translations.
      */