Patchwork [3/5] target-unicore32: avoid using cpu_single_env

login
register
mail settings
Submitter Blue Swirl
Date Oct. 28, 2012, 3:03 p.m.
Message ID <5cd15b325c56b2b7fe0b315c52a9b5094ce73633.1351436501.git.blauwirbel@gmail.com>
Download mbox | patch
Permalink /patch/194707/
State New
Headers show

Comments

Blue Swirl - Oct. 28, 2012, 3:03 p.m.
Pass around CPUState instead of using global cpu_single_env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 target-unicore32/softmmu.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
Guan Xuetao - Oct. 31, 2012, 2:55 a.m.
> Pass around CPUState instead of using global cpu_single_env.
>
> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn>

> ---
>  target-unicore32/softmmu.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/target-unicore32/softmmu.c b/target-unicore32/softmmu.c
> index 9c2c54c..fc27100 100644
> --- a/target-unicore32/softmmu.c
> +++ b/target-unicore32/softmmu.c
> @@ -31,7 +31,7 @@
>
>
>  /* Map CPU modes onto saved register banks.  */
> -static inline int bank_number(int mode)
> +static inline int bank_number(CPUUniCore32State *env, int mode)
>  {
>      switch (mode) {
>      case ASR_MODE_USER:
> @@ -46,7 +46,7 @@ static inline int bank_number(int mode)
>      case ASR_MODE_INTR:
>          return 4;
>      }
> -    cpu_abort(cpu_single_env, "Bad mode %x\n", mode);
> +    cpu_abort(env, "Bad mode %x\n", mode);
>      return -1;
>  }
>
> @@ -60,12 +60,12 @@ void switch_mode(CPUUniCore32State *env, int mode)
>          return;
>      }
>
> -    i = bank_number(old_mode);
> +    i = bank_number(env, old_mode);
>      env->banked_r29[i] = env->regs[29];
>      env->banked_r30[i] = env->regs[30];
>      env->banked_bsr[i] = env->bsr;
>
> -    i = bank_number(mode);
> +    i = bank_number(env, mode);
>      env->regs[29] = env->banked_r29[i];
>      env->regs[30] = env->banked_r30[i];
>      env->bsr = env->banked_bsr[i];
> --
> 1.7.2.5
>
Andreas Färber - Oct. 31, 2012, 3:26 a.m.
Am 28.10.2012 16:03, schrieb Blue Swirl:
> Pass around CPUState instead of using global cpu_single_env.
> 
> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
> ---
>  target-unicore32/softmmu.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Andreas Färber <afaerber@suse.de>

with the usual remark on "CPUState".

Andreas

Patch

diff --git a/target-unicore32/softmmu.c b/target-unicore32/softmmu.c
index 9c2c54c..fc27100 100644
--- a/target-unicore32/softmmu.c
+++ b/target-unicore32/softmmu.c
@@ -31,7 +31,7 @@ 
 
 
 /* Map CPU modes onto saved register banks.  */
-static inline int bank_number(int mode)
+static inline int bank_number(CPUUniCore32State *env, int mode)
 {
     switch (mode) {
     case ASR_MODE_USER:
@@ -46,7 +46,7 @@  static inline int bank_number(int mode)
     case ASR_MODE_INTR:
         return 4;
     }
-    cpu_abort(cpu_single_env, "Bad mode %x\n", mode);
+    cpu_abort(env, "Bad mode %x\n", mode);
     return -1;
 }
 
@@ -60,12 +60,12 @@  void switch_mode(CPUUniCore32State *env, int mode)
         return;
     }
 
-    i = bank_number(old_mode);
+    i = bank_number(env, old_mode);
     env->banked_r29[i] = env->regs[29];
     env->banked_r30[i] = env->regs[30];
     env->banked_bsr[i] = env->bsr;
 
-    i = bank_number(mode);
+    i = bank_number(env, mode);
     env->regs[29] = env->banked_r29[i];
     env->regs[30] = env->banked_r30[i];
     env->bsr = env->banked_bsr[i];