diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2011-09-06 03:55:41 +0400 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2011-09-10 16:57:38 +0000 |
commit | 40643d7c0fe4dc967ebc2f75e6758a4649776949 (patch) | |
tree | 6fae13c6f2190389f1c0c78288f3037dc0d65d26 /target-xtensa/op_helper.c | |
parent | f0a548b93da07b6546e4f8178a93c47284a27d05 (diff) | |
download | qemu-40643d7c0fe4dc967ebc2f75e6758a4649776949.zip qemu-40643d7c0fe4dc967ebc2f75e6758a4649776949.tar.gz qemu-40643d7c0fe4dc967ebc2f75e6758a4649776949.tar.bz2 |
target-xtensa: implement exceptions
- mark privileged opcodes with ring check;
- make debug exception on exception handler entry.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'target-xtensa/op_helper.c')
-rw-r--r-- | target-xtensa/op_helper.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/target-xtensa/op_helper.c b/target-xtensa/op_helper.c index c1cfd2e..794a834 100644 --- a/target-xtensa/op_helper.c +++ b/target-xtensa/op_helper.c @@ -59,6 +59,35 @@ void HELPER(exception)(uint32_t excp) cpu_loop_exit(env); } +void HELPER(exception_cause)(uint32_t pc, uint32_t cause) +{ + uint32_t vector; + + env->pc = pc; + if (env->sregs[PS] & PS_EXCM) { + if (env->config->ndepc) { + env->sregs[DEPC] = pc; + } else { + env->sregs[EPC1] = pc; + } + vector = EXC_DOUBLE; + } else { + env->sregs[EPC1] = pc; + vector = (env->sregs[PS] & PS_UM) ? EXC_USER : EXC_KERNEL; + } + + env->sregs[EXCCAUSE] = cause; + env->sregs[PS] |= PS_EXCM; + + HELPER(exception)(vector); +} + +void HELPER(exception_cause_vaddr)(uint32_t pc, uint32_t cause, uint32_t vaddr) +{ + env->sregs[EXCVADDR] = vaddr; + HELPER(exception_cause)(pc, cause); +} + uint32_t HELPER(nsa)(uint32_t v) { if (v & 0x80000000) { |