diff options
author | SeokYeon Hwang <syeon.hwang@samsung.com> | 2016-11-30 14:11:48 +0900 |
---|---|---|
committer | SeokYeon Hwang <syeon.hwang@samsung.com> | 2016-11-30 14:11:58 +0900 |
commit | 2371603ef207b015cc29728296b21cb1722d8ae6 (patch) | |
tree | 25cbb62daf29066fa874b9a4b8f754bc18187806 /target-cris | |
parent | d5df306aedcc13cf5a2463ddf858c8d718a788d5 (diff) | |
parent | d4dcb59384ab4433702f015fdddda1eff8e3927f (diff) | |
download | qemu-2371603ef207b015cc29728296b21cb1722d8ae6.tar.gz qemu-2371603ef207b015cc29728296b21cb1722d8ae6.tar.bz2 qemu-2371603ef207b015cc29728296b21cb1722d8ae6.zip |
Merge branch 'develop_qemu_2.7' into develop
Change-Id: Ibae70e3c0d1d88632903f98be114f47af9ca7502
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
Diffstat (limited to 'target-cris')
-rw-r--r-- | target-cris/cpu-qom.h | 40 | ||||
-rw-r--r-- | target-cris/cpu.c | 1 | ||||
-rw-r--r-- | target-cris/cpu.h | 52 | ||||
-rw-r--r-- | target-cris/crisv32-decode.h | 3 | ||||
-rw-r--r-- | target-cris/gdbstub.c | 1 | ||||
-rw-r--r-- | target-cris/helper.c | 1 | ||||
-rw-r--r-- | target-cris/machine.c | 3 | ||||
-rw-r--r-- | target-cris/mmu.c | 1 | ||||
-rw-r--r-- | target-cris/op_helper.c | 7 | ||||
-rw-r--r-- | target-cris/translate.c | 25 | ||||
-rw-r--r-- | target-cris/translate_v10.c | 3 |
11 files changed, 78 insertions, 59 deletions
diff --git a/target-cris/cpu-qom.h b/target-cris/cpu-qom.h index df4c0b50a3..7556e9f97e 100644 --- a/target-cris/cpu-qom.h +++ b/target-cris/cpu-qom.h @@ -50,44 +50,6 @@ typedef struct CRISCPUClass { uint32_t vr; } CRISCPUClass; -/** - * CRISCPU: - * @env: #CPUCRISState - * - * A CRIS CPU. - */ -typedef struct CRISCPU { - /*< private >*/ - CPUState parent_obj; - /*< public >*/ - - CPUCRISState env; -} CRISCPU; - -static inline CRISCPU *cris_env_get_cpu(CPUCRISState *env) -{ - return container_of(env, CRISCPU, env); -} - -#define ENV_GET_CPU(e) CPU(cris_env_get_cpu(e)) - -#define ENV_OFFSET offsetof(CRISCPU, env) - -#ifndef CONFIG_USER_ONLY -extern const struct VMStateDescription vmstate_cris_cpu; -#endif - -void cris_cpu_do_interrupt(CPUState *cpu); -void crisv10_cpu_do_interrupt(CPUState *cpu); -bool cris_cpu_exec_interrupt(CPUState *cpu, int int_req); - -void cris_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, - int flags); - -hwaddr cris_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); - -int crisv10_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); -int cris_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); -int cris_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); +typedef struct CRISCPU CRISCPU; #endif diff --git a/target-cris/cpu.c b/target-cris/cpu.c index 1cb79dd977..c5a656bb62 100644 --- a/target-cris/cpu.c +++ b/target-cris/cpu.c @@ -26,6 +26,7 @@ #include "cpu.h" #include "qemu-common.h" #include "mmu.h" +#include "exec/exec-all.h" static void cris_cpu_set_pc(CPUState *cs, vaddr value) diff --git a/target-cris/cpu.h b/target-cris/cpu.h index 415cf91436..7d7fe6eb1c 100644 --- a/target-cris/cpu.h +++ b/target-cris/cpu.h @@ -17,10 +17,12 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#ifndef CPU_CRIS_H -#define CPU_CRIS_H + +#ifndef CRIS_CPU_H +#define CRIS_CPU_H #include "qemu-common.h" +#include "cpu-qom.h" #define TARGET_LONG_BITS 32 @@ -171,10 +173,47 @@ typedef struct CPUCRISState { void *load_info; } CPUCRISState; -#include "cpu-qom.h" +/** + * CRISCPU: + * @env: #CPUCRISState + * + * A CRIS CPU. + */ +struct CRISCPU { + /*< private >*/ + CPUState parent_obj; + /*< public >*/ + + CPUCRISState env; +}; + +static inline CRISCPU *cris_env_get_cpu(CPUCRISState *env) +{ + return container_of(env, CRISCPU, env); +} + +#define ENV_GET_CPU(e) CPU(cris_env_get_cpu(e)) + +#define ENV_OFFSET offsetof(CRISCPU, env) + +#ifndef CONFIG_USER_ONLY +extern const struct VMStateDescription vmstate_cris_cpu; +#endif + +void cris_cpu_do_interrupt(CPUState *cpu); +void crisv10_cpu_do_interrupt(CPUState *cpu); +bool cris_cpu_exec_interrupt(CPUState *cpu, int int_req); + +void cris_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, + int flags); + +hwaddr cris_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); + +int crisv10_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); +int cris_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); +int cris_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); CRISCPU *cpu_cris_init(const char *cpu_model); -int cpu_cris_exec(CPUState *cpu); /* you can call this signal handler from your SIGBUS and SIGSEGV signal handlers to inform the virtual CPU of exceptions. non zero is returned if the signal was handled by the virtual CPU. */ @@ -221,7 +260,6 @@ enum { #define cpu_init(cpu_model) CPU(cpu_cris_init(cpu_model)) -#define cpu_exec cpu_cris_exec #define cpu_signal_handler cpu_cris_signal_handler /* MMU modes definitions */ @@ -249,7 +287,7 @@ int cris_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int rw, #include "exec/cpu-all.h" static inline void cpu_get_tb_cpu_state(CPUCRISState *env, target_ulong *pc, - target_ulong *cs_base, int *flags) + target_ulong *cs_base, uint32_t *flags) { *pc = env->pc; *cs_base = 0; @@ -261,6 +299,4 @@ static inline void cpu_get_tb_cpu_state(CPUCRISState *env, target_ulong *pc, #define cpu_list cris_cpu_list void cris_cpu_list(FILE *f, fprintf_function cpu_fprintf); -#include "exec/exec-all.h" - #endif diff --git a/target-cris/crisv32-decode.h b/target-cris/crisv32-decode.h index cdba377817..cdc2f8cbe6 100644 --- a/target-cris/crisv32-decode.h +++ b/target-cris/crisv32-decode.h @@ -17,8 +17,9 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ + #ifndef CRISV32_DECODE_H -#define CRISV32_DECODE_H 1 +#define CRISV32_DECODE_H /* Convenient binary macros. */ #define HEX__(n) 0x##n##LU diff --git a/target-cris/gdbstub.c b/target-cris/gdbstub.c index 1bbf17b04a..3a72ee2a98 100644 --- a/target-cris/gdbstub.c +++ b/target-cris/gdbstub.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" #include "qemu-common.h" +#include "cpu.h" #include "exec/gdbstub.h" int crisv10_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n) diff --git a/target-cris/helper.c b/target-cris/helper.c index 1eb9fd9184..af78cca8b9 100644 --- a/target-cris/helper.c +++ b/target-cris/helper.c @@ -22,6 +22,7 @@ #include "cpu.h" #include "mmu.h" #include "qemu/host-utils.h" +#include "exec/exec-all.h" #include "exec/cpu_ldst.h" diff --git a/target-cris/machine.c b/target-cris/machine.c index 9cc2820e85..6b797e8c1d 100644 --- a/target-cris/machine.c +++ b/target-cris/machine.c @@ -19,7 +19,10 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" +#include "migration/cpu.h" static const VMStateDescription vmstate_tlbset = { .name = "cpu/tlbset", diff --git a/target-cris/mmu.c b/target-cris/mmu.c index 4278d2dce4..b8db908823 100644 --- a/target-cris/mmu.c +++ b/target-cris/mmu.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "cpu.h" +#include "exec/exec-all.h" #include "mmu.h" #ifdef DEBUG diff --git a/target-cris/op_helper.c b/target-cris/op_helper.c index 320f2b80d2..504303913c 100644 --- a/target-cris/op_helper.c +++ b/target-cris/op_helper.c @@ -23,6 +23,7 @@ #include "mmu.h" #include "exec/helper-proto.h" #include "qemu/host-utils.h" +#include "exec/exec-all.h" #include "exec/cpu_ldst.h" //#define CRIS_OP_HELPER_DEBUG @@ -40,8 +41,8 @@ /* Try to fill the TLB and return an exception if error. If retaddr is NULL, it means that the function was called in C code (i.e. not from generated code or from helper.c) */ -void tlb_fill(CPUState *cs, target_ulong addr, int is_write, int mmu_idx, - uintptr_t retaddr) +void tlb_fill(CPUState *cs, target_ulong addr, MMUAccessType access_type, + int mmu_idx, uintptr_t retaddr) { CRISCPU *cpu = CRIS_CPU(cs); CPUCRISState *env = &cpu->env; @@ -49,7 +50,7 @@ void tlb_fill(CPUState *cs, target_ulong addr, int is_write, int mmu_idx, D_LOG("%s pc=%x tpc=%x ra=%p\n", __func__, env->pc, env->pregs[PR_EDA], (void *)retaddr); - ret = cris_cpu_handle_mmu_fault(cs, addr, is_write, mmu_idx); + ret = cris_cpu_handle_mmu_fault(cs, addr, access_type, mmu_idx); if (unlikely(ret)) { if (retaddr) { /* now we have a real cpu fault */ diff --git a/target-cris/translate.c b/target-cris/translate.c index a73176c118..f4a8d7d000 100644 --- a/target-cris/translate.c +++ b/target-cris/translate.c @@ -26,6 +26,7 @@ #include "qemu/osdep.h" #include "cpu.h" #include "disas/disas.h" +#include "exec/exec-all.h" #include "tcg-op.h" #include "exec/helper-proto.h" #include "mmu.h" @@ -520,14 +521,22 @@ static void t_gen_cc_jmp(TCGv pc_true, TCGv pc_false) gen_set_label(l1); } +static inline bool use_goto_tb(DisasContext *dc, target_ulong dest) +{ +#ifndef CONFIG_USER_ONLY + return (dc->tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK) || + (dc->ppc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK); +#else + return true; +#endif +} + static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest) { - TranslationBlock *tb; - tb = dc->tb; - if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) { + if (use_goto_tb(dc, dest)) { tcg_gen_goto_tb(n); tcg_gen_movi_tl(env_pc, dest); - tcg_gen_exit_tb((uintptr_t)tb + n); + tcg_gen_exit_tb((uintptr_t)dc->tb + n); } else { tcg_gen_movi_tl(env_pc, dest); tcg_gen_exit_tb(0); @@ -3049,7 +3058,7 @@ static unsigned int crisv32_decoder(CPUCRISState *env, DisasContext *dc) * * When the software returns from an exception, the branch will re-execute. * On QEMU care needs to be taken when a branch+delayslot sequence is broken - * and the branch and delayslot dont share pages. + * and the branch and delayslot don't share pages. * * The TB contaning the branch insn will set up env->btarget and evaluate * env->btaken. When the translation loop exits we will note that the branch @@ -3238,7 +3247,7 @@ void gen_intermediate_code(CPUCRISState *env, struct TranslationBlock *tb) } /* If we are rexecuting a branch due to exceptions on - delay slots dont break. */ + delay slots don't break. */ if (!(tb->pc & 1) && cs->singlestep_enabled) { break; } @@ -3302,7 +3311,8 @@ void gen_intermediate_code(CPUCRISState *env, struct TranslationBlock *tb) #ifdef DEBUG_DISAS #if !DISAS_CRIS - if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { + if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM) + && qemu_log_in_addr_range(pc_start)) { log_target_disas(cs, pc_start, dc->pc - pc_start, env->pregs[PR_VR]); qemu_log("\nisize=%d osize=%d\n", @@ -3364,6 +3374,7 @@ void cris_initialize_tcg(void) int i; cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, "env"); + tcg_ctx.tcg_env = cpu_env; cc_x = tcg_global_mem_new(cpu_env, offsetof(CPUCRISState, cc_x), "cc_x"); cc_src = tcg_global_mem_new(cpu_env, diff --git a/target-cris/translate_v10.c b/target-cris/translate_v10.c index 7607eadfb7..4707a18e77 100644 --- a/target-cris/translate_v10.c +++ b/target-cris/translate_v10.c @@ -130,7 +130,7 @@ static void cris_set_prefix(DisasContext *dc) dc->tb_flags |= PFIX_FLAG; tcg_gen_ori_tl(cpu_PR[PR_CCS], cpu_PR[PR_CCS], PFIX_FLAG); - /* prefix insns dont clear the x flag. */ + /* prefix insns don't clear the x flag. */ dc->clear_x = 0; cris_lock_irq(dc); } @@ -1250,6 +1250,7 @@ void cris_initialize_crisv10_tcg(void) int i; cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, "env"); + tcg_ctx.tcg_env = cpu_env; cc_x = tcg_global_mem_new(cpu_env, offsetof(CPUCRISState, cc_x), "cc_x"); cc_src = tcg_global_mem_new(cpu_env, |