aboutsummaryrefslogtreecommitdiff
path: root/target/ppc/internal.h
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2021-05-18 15:11:23 -0500
committerDavid Gibson <david@gibson.dropbear.id.au>2021-05-19 12:50:47 +1000
commit182357dbb6989a175d2a653c9edcd5422c651922 (patch)
tree628d85d547a16218f4e3fab03db7fb3be9f8a949 /target/ppc/internal.h
parent861f10fd528263a507476b8c4dda93a9588dfa5c (diff)
downloadqemu-182357dbb6989a175d2a653c9edcd5422c651922.zip
qemu-182357dbb6989a175d2a653c9edcd5422c651922.tar.gz
qemu-182357dbb6989a175d2a653c9edcd5422c651922.tar.bz2
target/ppc: Introduce prot_for_access_type
Use this in the three places we currently have a local array indexed by rwx (which happens to have the same values). The types will match up correctly with additional changes. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210518201146.794854-2-richard.henderson@linaro.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'target/ppc/internal.h')
-rw-r--r--target/ppc/internal.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/target/ppc/internal.h b/target/ppc/internal.h
index 184ba6d..2b4b06e 100644
--- a/target/ppc/internal.h
+++ b/target/ppc/internal.h
@@ -228,4 +228,23 @@ void destroy_ppc_opcodes(PowerPCCPU *cpu);
void ppc_gdb_init(CPUState *cs, PowerPCCPUClass *ppc);
gchar *ppc_gdb_arch_name(CPUState *cs);
+/**
+ * prot_for_access_type:
+ * @access_type: Access type
+ *
+ * Return the protection bit required for the given access type.
+ */
+static inline int prot_for_access_type(MMUAccessType access_type)
+{
+ switch (access_type) {
+ case MMU_INST_FETCH:
+ return PAGE_EXEC;
+ case MMU_DATA_LOAD:
+ return PAGE_READ;
+ case MMU_DATA_STORE:
+ return PAGE_WRITE;
+ }
+ g_assert_not_reached();
+}
+
#endif /* PPC_INTERNAL_H */