aboutsummaryrefslogtreecommitdiff
path: root/target-xtensa/cpu.h
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2014-11-07 21:11:07 +0300
committerMax Filippov <jcmvbkbc@gmail.com>2014-11-10 17:59:13 +0300
commit1b3e71f8ee17ced609213d9b41758110f3c026e9 (patch)
tree122ad4955d5f5b50b8697c676613d1f8b65460b2 /target-xtensa/cpu.h
parent2d9177588bde9881c6602284d1b0b08e4dfe361e (diff)
downloadqemu-1b3e71f8ee17ced609213d9b41758110f3c026e9.zip
qemu-1b3e71f8ee17ced609213d9b41758110f3c026e9.tar.gz
qemu-1b3e71f8ee17ced609213d9b41758110f3c026e9.tar.bz2
target-xtensa: add missing window check for entry
Entry opcode needs to check if moving to new register frame would cause register window overflow. Entry used in function prologue never overflows because preceding windowed call* opcode writes return address to the target register window frame, causing overflow exceptions at the point of call. But when a sequence of entry opcodes is used for register window spilling there may not be a call or other opcode that would cause window check between entries and they would not raise overflow exception themselves resulting in data corruption. Cc: qemu-stable@nongnu.org Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'target-xtensa/cpu.h')
-rw-r--r--target-xtensa/cpu.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/target-xtensa/cpu.h b/target-xtensa/cpu.h
index beb5486..ac463f2 100644
--- a/target-xtensa/cpu.h
+++ b/target-xtensa/cpu.h
@@ -472,6 +472,12 @@ static inline xtensa_tlb_entry *xtensa_tlb_get_entry(CPUXtensaState *env,
env->itlb[wi] + ei;
}
+static inline uint32_t xtensa_replicate_windowstart(CPUXtensaState *env)
+{
+ return env->sregs[WINDOW_START] |
+ (env->sregs[WINDOW_START] << env->config->nareg / 4);
+}
+
/* MMU modes definitions */
#define MMU_MODE0_SUFFIX _ring0
#define MMU_MODE1_SUFFIX _ring1