diff mbox series

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

Message ID 20210127234119.3537399-3-f4bug@amsat.org
State New
Headers show
Series target/nios2: Pass MMUAccessType to mmu_translate() | expand

Commit Message

Philippe Mathieu-Daudé Jan. 27, 2021, 11:41 p.m. UTC
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(-)

Comments

Richard Henderson Feb. 4, 2021, 2:45 a.m. UTC | #1
On 1/27/21 1:41 PM, Philippe Mathieu-Daudé wrote:
> 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(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
diff mbox series

Patch

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;