qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] target/nios2: Use MMUAccessType enum type when possible


From: Philippe Mathieu-Daudé
Subject: [PATCH 2/2] target/nios2: Use MMUAccessType enum type when possible
Date: Thu, 28 Jan 2021 00:41:19 +0100

All callers of mmu_translate() provide it a MMUAccessType
type. Let the prototype use it as argument, as it is stricter
than an integer. We can remove the documentation as enum
names are self explicit.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 target/nios2/mmu.h | 3 ++-
 target/nios2/mmu.c | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/target/nios2/mmu.h b/target/nios2/mmu.h
index 4f46fbb82e2..2f4e325a81e 100644
--- a/target/nios2/mmu.h
+++ b/target/nios2/mmu.h
@@ -43,7 +43,8 @@ typedef struct Nios2MMULookup {
 void mmu_flip_um(CPUNios2State *env, unsigned int um);
 unsigned int mmu_translate(CPUNios2State *env,
                            Nios2MMULookup *lu,
-                           target_ulong vaddr, int rw, int mmu_idx);
+                           target_ulong vaddr,
+                           MMUAccessType access_type, int mmu_idx);
 void mmu_read_debug(CPUNios2State *env, uint32_t rn);
 void mmu_write(CPUNios2State *env, uint32_t rn, uint32_t v);
 void mmu_init(CPUNios2State *env);
diff --git a/target/nios2/mmu.c b/target/nios2/mmu.c
index 2545c06761f..ebe13b89f68 100644
--- a/target/nios2/mmu.c
+++ b/target/nios2/mmu.c
@@ -55,10 +55,10 @@ void mmu_read_debug(CPUNios2State *env, uint32_t rn)
     }
 }
 
-/* rw - 0 = read, 1 = write, 2 = fetch.  */
 unsigned int mmu_translate(CPUNios2State *env,
                            Nios2MMULookup *lu,
-                           target_ulong vaddr, int rw, int mmu_idx)
+                           target_ulong vaddr,
+                           MMUAccessType access_type, int mmu_idx)
 {
     Nios2CPU *cpu = env_archcpu(env);
     int pid = (env->mmu.tlbmisc_wr & CR_TLBMISC_PID_MASK) >> 4;
-- 
2.26.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]