diff mbox

[1/2] target-arm : make parameter of feature/status checking function const

Message ID 1409853677-10966-2-git-send-email-cmchao@gmail.com
State New
Headers show

Commit Message

cmchao Sept. 4, 2014, 6:01 p.m. UTC
CPUARMState is one of parameter used by
        is_a64
        arm_feature
        arm_el_is_aa64
    They only read it without any side effect and shold be changed to
    const parameter

Signed-off-by: Chih-Min Chao <cmchao@gmail.com>
---
 target-arm/cpu.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

cmchao Sept. 4, 2014, 6:15 p.m. UTC | #1
Just change what I have used and looked  into.
There are no other special reasons.


On Fri, Sep 5, 2014 at 2:05 AM, Peter Maydell <peter.maydell@linaro.org>
wrote:

> On 4 September 2014 19:01, Chih-Min Chao <cmchao@gmail.com> wrote:
> >     CPUARMState is one of parameter used by
> >         is_a64
> >         arm_feature
> >         arm_el_is_aa64
> >     They only read it without any side effect and shold be changed to
> >     const parameter
>
> I guess, but we have lots of functions that just pass
> around CPUARMState without it being const even if they
> don't actually modify it; why change these ones in
> particular?
>
> thanks
> -- PMM
>
diff mbox

Patch

diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index 51bedc8..d7f1776 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -340,7 +340,7 @@  ARMCPU *cpu_arm_init(const char *cpu_model);
 int cpu_arm_exec(CPUARMState *s);
 uint32_t do_arm_semihosting(CPUARMState *env);
 
-static inline bool is_a64(CPUARMState *env)
+static inline bool is_a64(const CPUARMState *env)
 {
     return env->aarch64;
 }
@@ -677,13 +677,13 @@  enum arm_features {
     ARM_FEATURE_V8_PMULL, /* implements PMULL part of v8 Crypto Extensions */
 };
 
-static inline int arm_feature(CPUARMState *env, int feature)
+static inline int arm_feature(const CPUARMState *env, int feature)
 {
     return (env->features & (1ULL << feature)) != 0;
 }
 
 /* Return true if the specified exception level is running in AArch64 state. */
-static inline bool arm_el_is_aa64(CPUARMState *env, int el)
+static inline bool arm_el_is_aa64(const CPUARMState *env, int el)
 {
     /* We don't currently support EL2 or EL3, and this isn't valid for EL0
      * (if we're in EL0, is_a64() is what you want, and if we're not in EL0