From: Jia Liu <proljc@gmail.com>
To: qemu-devel@nongnu.org
Cc: blauwirbel@gmail.com, sebastian@macke.de, aliguori@amazon.com
Subject: [Qemu-devel] [PULL 4/7] target-openrisc: Correct wrong epcr register in interrupt handler
Date: Wed, 20 Nov 2013 22:38:35 +0800 [thread overview]
Message-ID: <1384958318-9145-5-git-send-email-proljc@gmail.com> (raw)
In-Reply-To: <1384958318-9145-1-git-send-email-proljc@gmail.com>
From: Sebastian Macke <sebastian@macke.de>
This patch corrects several misbehaviors during an interrupt process.
Most of the time the pc is already correct and therefore no special treatment
of the exceptions is necessary.
Tested by checking crashing programs which otherwise work in or1ksim.
Signed-off-by: Sebastian Macke <sebastian@macke.de>
Reviewed-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Jia Liu <proljc@gmail.com>
---
target-openrisc/interrupt.c | 25 +++++++------------------
1 file changed, 7 insertions(+), 18 deletions(-)
diff --git a/target-openrisc/interrupt.c b/target-openrisc/interrupt.c
index 16ef4b3..2153e7e 100644
--- a/target-openrisc/interrupt.c
+++ b/target-openrisc/interrupt.c
@@ -30,26 +30,15 @@ void openrisc_cpu_do_interrupt(CPUState *cs)
OpenRISCCPU *cpu = OPENRISC_CPU(cs);
CPUOpenRISCState *env = &cpu->env;
#ifndef CONFIG_USER_ONLY
- if (env->flags & D_FLAG) { /* Delay Slot insn */
+
+ env->epcr = env->pc;
+ if (env->flags & D_FLAG) {
env->flags &= ~D_FLAG;
env->sr |= SR_DSX;
- if (env->exception_index == EXCP_TICK ||
- env->exception_index == EXCP_INT ||
- env->exception_index == EXCP_SYSCALL ||
- env->exception_index == EXCP_FPE) {
- env->epcr = env->jmp_pc;
- } else {
- env->epcr = env->pc - 4;
- }
- } else {
- if (env->exception_index == EXCP_TICK ||
- env->exception_index == EXCP_INT ||
- env->exception_index == EXCP_SYSCALL ||
- env->exception_index == EXCP_FPE) {
- env->epcr = env->npc;
- } else {
- env->epcr = env->pc;
- }
+ env->epcr -= 4;
+ }
+ if (env->exception_index == EXCP_SYSCALL) {
+ env->epcr += 4;
}
/* For machine-state changed between user-mode and supervisor mode,
--
1.8.3.4 (Apple Git-47)
next prev parent reply other threads:[~2013-11-20 14:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-20 14:38 [Qemu-devel] [PULL 0/7] OpenRISC patch queue for 1.7 Jia Liu
2013-11-20 14:38 ` [Qemu-devel] [PULL 1/7] target-openrisc: Speed up move instruction Jia Liu
2013-11-20 14:38 ` [Qemu-devel] [PULL 2/7] target-openrisc: Remove unnecessary code generated by jump instructions Jia Liu
2013-11-20 14:38 ` [Qemu-devel] [PULL 3/7] target-openrisc: Remove executable flag for every page Jia Liu
2013-11-20 14:38 ` Jia Liu [this message]
2013-11-20 14:38 ` [Qemu-devel] [PULL 5/7] openrisc-timer: Reduce overhead, Separate clock update functions Jia Liu
2013-11-20 14:38 ` [Qemu-devel] [PULL 6/7] target-openrisc: Correct memory bounds checking for the tlb buffers Jia Liu
2013-11-20 14:38 ` [Qemu-devel] [PULL 7/7] target-openrisc: Correct carry flag check of l.addc and l.addic test cases Jia Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1384958318-9145-5-git-send-email-proljc@gmail.com \
--to=proljc@gmail.com \
--cc=aliguori@amazon.com \
--cc=blauwirbel@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=sebastian@macke.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).