Modified OpenRisc fpu exception
PATCH 1/1 Modified OpenRisc fpu exception
Add OpenRisc fpu excepiton.
When an exception raised, CPU can save right PC.
--- target-openrisc/exception.c | 31 +++++++++++++++++++++-- target-openrisc/exception.h | 8 ++++-- target-openrisc/exception_helper.c | 2 +- target-openrisc/fpu_helper.c | 48 +++++++++++++++++++----------------- target-openrisc/int_helper.c | 2 +- target-openrisc/mmu_helper.c | 17 +++---------- 6 files changed, 66 insertions(+), 42 deletions(-)
target-openrisc/exception.c +29 -2
@@ -20,8 +20,35 @@#include "cpu.h" #include "exception.h" -void QEMU_NORETURN raise_exception(OpenRISCCPU *cpu, uint32_t excp) +void QEMU_NORETURN do_raise_exception_err(OpenRISCCPU *cpu, +uint32_t exception, +uintptr_t pc) { - cpu->env.exception_index = excp; +TranslationBlock *tb; + +/* openrisc cpu has fifteen exceptions */ +if (exception <0xe ) +qemu_log ("%s: %d\n" , __func__, exception); + + cpu->env.exception_index = exception; + +if (pc) { +/* now we have a real cpu fault */ + tb =tb_find_pc (pc); +if (tb) { +/* the PC is inside the translated code. It means that we have +a virtual CPU fault */ +cpu_restore_state (tb, &cpu->env, pc); + } + } +cpu_loop_exit (&cpu->env); } + +void QEMU_NORETURN do_raise_exception(OpenRISCCPU *cpu, +uint32_t exception, +uintptr_t pc) +{ +do_raise_exception_err (cpu, exception, pc); +} +
target-openrisc/exception.h +6 -2
@@ -23,6 +23,10 @@#include "cpu.h" #include "qemu-common.h" -void QEMU_NORETURN raise_exception(OpenRISCCPU *cpu, uint32_t excp); - +void QEMU_NORETURN do_raise_exception_err(OpenRISCCPU *cpu, +uint32_t exception, +uintptr_t pc); +void QEMU_NORETURN do_raise_exception(OpenRISCCPU *cpu, +uint32_t exception, +uintptr_t pc);#endif /* QEMU_OPENRISC_EXCP_H */
target-openrisc/exception_helper.c +1 -1
@@ -25,5 +25,5 @@ void HELPER(exception)(CPUOpenRISCState *env, uint32_t excp) {OpenRISCCPU *cpu =OPENRISC_CPU (ENV_GET_CPU (env)); -raise_exception (cpu, excp); +do_raise_exception (cpu, excp,0 ); }
target-openrisc/fpu_helper.c +26 -22
155 lines not on this page · raw message
target-openrisc/int_helper.c +1 -1
@@ -72,7 +72,7 @@ uint32_t HELPER(mul32)(CPUOpenRISCState *env, cpu->env.sr |= (SR_OV |SR_CY );if (cpu->env.sr &SR_OVE ) { -raise_exception (cpu,EXCP_RANGE ); +do_raise_exception (cpu,EXCP_RANGE ,GETPC ()); }return result;
target-openrisc/mmu_helper.c +3 -14
@@ -19,6 +19,7 @@*/ #include "cpu.h" +#include "exception.h" #ifndef CONFIG_USER_ONLY #include "softmmu_exec.h"
@@ -39,25 +40,13 @@void tlb_fill (CPUOpenRISCState *env,target_ulong addr,int is_write,int mmu_idx,uintptr_t retaddr) { -TranslationBlock *tb; -unsigned long pc;int ret; +OpenRISCCPU *cpu =OPENRISC_CPU (ENV_GET_CPU (env)); ret =cpu_openrisc_handle_mmu_fault (env, addr, is_write, mmu_idx);if (ret) { -if (retaddr) { -/* now we have a real cpu fault. */ - pc = (unsigned long )retaddr; - tb =tb_find_pc (pc); -if (tb) { -/* the PC is inside the translated code. It means that we -have a virtual CPU fault. */ -cpu_restore_state (tb, env, pc); - } - } -/* Raise Exception. */ -cpu_loop_exit (env); +do_raise_exception_err (cpu, env->exception_index, retaddr); } }#endif
Signature · 1 line
1.7.10.4
Quoted 23 lines
target-openrisc/exception.c +20
-2-void QEMU_NORETURN raise_exception(OpenRISCCPU *cpu, uint32_t excp) +void QEMU_NORETURN do_raise_exception_err(OpenRISCCPU *cpu, +uint32_t exception, +uintptr_t pc) { - cpu->env.exception_index = excp; +TranslationBlock *tb; + +/* openrisc cpu has fifteen exceptions */ +if (exception <0xe ) +qemu_log ("%s: %d\n" , __func__, exception); + + cpu->env.exception_index = exception; + +if (pc) { +/* now we have a real cpu fault */ + tb =tb_find_pc (pc); +if (tb) { +/* the PC is inside the translated code. It means that we have +a virtual CPU fault */ +cpu_restore_state (tb, &cpu->env, pc); + } + }
target-openrisc/exception.c line 53
Quoted 10 lines
target-openrisc/exception.c +8
-0+cpu_loop_exit (&cpu->env); } + +void QEMU_NORETURN do_raise_exception(OpenRISCCPU *cpu, +uint32_t exception, +uintptr_t pc) +{ +do_raise_exception_err (cpu, exception, pc); +}
Please change your subject into "[PATCH v2] ..." so that others will
notice this is a new version patch. See [1] for more detail. Also, you still doesn't address v1's comment. Why you put both do_raise_exception_err and do_raise_exception here? It's unnecessary to me.
Regards,
chenwj
[1] http://wiki.qemu.org/Contribute/SubmitAPatch
Signature · 5 lines
Wei-Ren Chen (陳韋任) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667 Homepage: http://people.cs.nctu.edu.tw/~chenwj
Quoted 2 lines · Feng Gao
Add OpenRisc fpu excepiton.
When an exception raised, CPU can save right PC.
This commit message is very short and quite hard to understand. It would be nice to see more detail here on what the patch is trying to do.
thanks
-- PMM
Am 30.11.2012 16:03, schrieb Peter Maydell:
Quoted 7 lines · Feng Gao
Quoted 2 lines
Add OpenRisc fpu excepiton.
When an exception raised, CPU can save right PC.This commit message is very short and quite hard to understand. It would be nice to see more detail here on what the patch is trying to do.
Also please use a "target-openrisc: " prefix for the subject to conform to our scheme. This makes it easier to spot relevant patches on the mailing list and later in the commit history.
Thanks,
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Thank you .I will modify the patch and give more infomation about the patch
Quoted 20 lines · 在 2012年12月1日星期六,Andreas Färber <[email protected]> 写道:
Am 30.11.2012 16:03, schrieb Peter Maydell:
Quoted 7 lines · Feng Gao
Quoted 2 lines
Add OpenRisc fpu excepiton.
When an exception raised, CPU can save right PC.This commit message is very short and quite hard to understand. It would be nice to see more detail here on what the patch is trying to do.
Also please use a "target-openrisc: " prefix for the subject to conform to our scheme. This makes it easier to spot relevant patches on the mailing list and later in the commit history.
Thanks,
Andreas--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg