aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-02-15 17:22:50 +0000
committerPeter Maydell <peter.maydell@linaro.org>2016-02-18 18:14:00 +0000
commit44ffdaea06df75c5ba3da08f441bb70642ce56ef (patch)
tree18d7f4c8a8cd5321beb6db16f029ba91ee6537f8
parenta97b8a66da2ea4e0cb9be9a36a20d39b795ba245 (diff)
downloadqemu-arm-44ffdaea06df75c5ba3da08f441bb70642ce56ef.tar.gz
linux-user: Use restrictive mask when calling cpsr_write()
When linux-user code is calling cpsr_write(), use a restrictive mask to ensure we are limiting the set of CPSR bits we update. In particular, don't allow the mode bits to be changed. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Sergey Fedorov <serge.fdrv@gmail.com> Message-id: 1455556977-3644-5-git-send-email-peter.maydell@linaro.org
-rw-r--r--linux-user/main.c3
-rw-r--r--linux-user/signal.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/linux-user/main.c b/linux-user/main.c
index 1269470121..c467fa796c 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -4446,7 +4446,8 @@ int main(int argc, char **argv, char **envp)
#elif defined(TARGET_ARM)
{
int i;
- cpsr_write(env, regs->uregs[16], 0xffffffff, CPSRWriteByInstr);
+ cpsr_write(env, regs->uregs[16], CPSR_USER | CPSR_EXEC,
+ CPSRWriteByInstr);
for(i = 0; i < 16; i++) {
env->regs[i] = regs->uregs[i];
}
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 82f81c79ab..962111cfdf 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -1611,7 +1611,7 @@ setup_return(CPUARMState *env, struct target_sigaction *ka,
env->regs[13] = frame_addr;
env->regs[14] = retcode;
env->regs[15] = handler & (thumb ? ~1 : ~3);
- cpsr_write(env, cpsr, 0xffffffff, CPSRWriteByInstr);
+ cpsr_write(env, cpsr, CPSR_IT | CPSR_T, CPSRWriteByInstr);
}
static abi_ulong *setup_sigframe_v2_vfp(abi_ulong *regspace, CPUARMState *env)