Patchwork [09/10] linux-user: honor low bit of entry PC for MIPS

login
register
mail settings
Submitter Nathan Froyd
Date May 24, 2010, 4:19 p.m.
Message ID <1274717984-25887-10-git-send-email-froydnj@codesourcery.com>
Download mbox | patch
Permalink /patch/53448/
State New
Headers show

Comments

Nathan Froyd - May 24, 2010, 4:19 p.m.
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
---
 linux-user/main.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
Richard Henderson - June 4, 2010, 6:36 p.m.
On 05/24/2010 09:19 AM, Nathan Froyd wrote:
> Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
> ---
>  linux-user/main.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/linux-user/main.c b/linux-user/main.c
> index 18b52c0..76d443b 100644
> --- a/linux-user/main.c
> +++ b/linux-user/main.c
> @@ -3192,7 +3192,9 @@ int main(int argc, char **argv, char **envp)
>          for(i = 0; i < 32; i++) {
>              env->active_tc.gpr[i] = regs->regs[i];
>          }
> -        env->active_tc.PC = regs->cp0_epc;
> +        env->active_tc.PC = regs->cp0_epc & ~(target_ulong)1;
> +        if (regs->cp0_epc & 1)
> +            env->hflags |= MIPS_HFLAG_M16;

Coding style.


r~

Patch

diff --git a/linux-user/main.c b/linux-user/main.c
index 18b52c0..76d443b 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -3192,7 +3192,9 @@  int main(int argc, char **argv, char **envp)
         for(i = 0; i < 32; i++) {
             env->active_tc.gpr[i] = regs->regs[i];
         }
-        env->active_tc.PC = regs->cp0_epc;
+        env->active_tc.PC = regs->cp0_epc & ~(target_ulong)1;
+        if (regs->cp0_epc & 1)
+            env->hflags |= MIPS_HFLAG_M16;
     }
 #elif defined(TARGET_SH4)
     {