diff options
Diffstat (limited to 'target-alpha')
-rw-r--r-- | target-alpha/cpu-qom.h | 41 | ||||
-rw-r--r-- | target-alpha/cpu.c | 1 | ||||
-rw-r--r-- | target-alpha/cpu.h | 55 | ||||
-rw-r--r-- | target-alpha/fpu_helper.c | 1 | ||||
-rw-r--r-- | target-alpha/gdbstub.c | 1 | ||||
-rw-r--r-- | target-alpha/helper.c | 1 | ||||
-rw-r--r-- | target-alpha/int_helper.c | 1 | ||||
-rw-r--r-- | target-alpha/machine.c | 3 | ||||
-rw-r--r-- | target-alpha/mem_helper.c | 8 | ||||
-rw-r--r-- | target-alpha/sys_helper.c | 1 | ||||
-rw-r--r-- | target-alpha/translate.c | 18 | ||||
-rw-r--r-- | target-alpha/vax_helper.c | 1 |
12 files changed, 76 insertions, 56 deletions
diff --git a/target-alpha/cpu-qom.h b/target-alpha/cpu-qom.h index b01c6c82eb..bae4945344 100644 --- a/target-alpha/cpu-qom.h +++ b/target-alpha/cpu-qom.h @@ -21,7 +21,6 @@ #define QEMU_ALPHA_CPU_QOM_H #include "qom/cpu.h" -#include "cpu.h" #define TYPE_ALPHA_CPU "alpha-cpu" @@ -48,44 +47,6 @@ typedef struct AlphaCPUClass { void (*parent_reset)(CPUState *cpu); } AlphaCPUClass; -/** - * AlphaCPU: - * @env: #CPUAlphaState - * - * An Alpha CPU. - */ -typedef struct AlphaCPU { - /*< private >*/ - CPUState parent_obj; - /*< public >*/ - - CPUAlphaState env; - - /* This alarm doesn't exist in real hardware; we wish it did. */ - QEMUTimer *alarm_timer; -} AlphaCPU; - -static inline AlphaCPU *alpha_env_get_cpu(CPUAlphaState *env) -{ - return container_of(env, AlphaCPU, env); -} - -#define ENV_GET_CPU(e) CPU(alpha_env_get_cpu(e)) - -#define ENV_OFFSET offsetof(AlphaCPU, env) - -#ifndef CONFIG_USER_ONLY -extern const struct VMStateDescription vmstate_alpha_cpu; -#endif - -void alpha_cpu_do_interrupt(CPUState *cpu); -bool alpha_cpu_exec_interrupt(CPUState *cpu, int int_req); -void alpha_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, - int flags); -hwaddr alpha_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); -int alpha_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); -int alpha_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); -void alpha_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, - int is_write, int is_user, uintptr_t retaddr); +typedef struct AlphaCPU AlphaCPU; #endif diff --git a/target-alpha/cpu.c b/target-alpha/cpu.c index 8a155cae90..6d01d7f75e 100644 --- a/target-alpha/cpu.c +++ b/target-alpha/cpu.c @@ -24,6 +24,7 @@ #include "cpu.h" #include "qemu-common.h" #include "migration/vmstate.h" +#include "exec/exec-all.h" static void alpha_cpu_set_pc(CPUState *cs, vaddr value) diff --git a/target-alpha/cpu.h b/target-alpha/cpu.h index 420f2a53fe..ac5e801fb4 100644 --- a/target-alpha/cpu.h +++ b/target-alpha/cpu.h @@ -17,10 +17,11 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#if !defined (__CPU_ALPHA_H__) -#define __CPU_ALPHA_H__ +#ifndef ALPHA_CPU_H +#define ALPHA_CPU_H #include "qemu-common.h" +#include "cpu-qom.h" #define TARGET_LONG_BITS 64 #define ALIGNED_ONLY @@ -284,12 +285,51 @@ struct CPUAlphaState { int implver; }; +/** + * AlphaCPU: + * @env: #CPUAlphaState + * + * An Alpha CPU. + */ +struct AlphaCPU { + /*< private >*/ + CPUState parent_obj; + /*< public >*/ + + CPUAlphaState env; + + /* This alarm doesn't exist in real hardware; we wish it did. */ + QEMUTimer *alarm_timer; +}; + +static inline AlphaCPU *alpha_env_get_cpu(CPUAlphaState *env) +{ + return container_of(env, AlphaCPU, env); +} + +#define ENV_GET_CPU(e) CPU(alpha_env_get_cpu(e)) + +#define ENV_OFFSET offsetof(AlphaCPU, env) + +#ifndef CONFIG_USER_ONLY +extern const struct VMStateDescription vmstate_alpha_cpu; +#endif + +void alpha_cpu_do_interrupt(CPUState *cpu); +bool alpha_cpu_exec_interrupt(CPUState *cpu, int int_req); +void alpha_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, + int flags); +hwaddr alpha_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +int alpha_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); +int alpha_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); +void alpha_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, + MMUAccessType access_type, + int mmu_idx, uintptr_t retaddr); + #define cpu_list alpha_cpu_list -#define cpu_exec cpu_alpha_exec #define cpu_signal_handler cpu_alpha_signal_handler #include "exec/cpu-all.h" -#include "cpu-qom.h" enum { FEATURE_ASN = 0x00000001, @@ -427,7 +467,6 @@ AlphaCPU *cpu_alpha_init(const char *cpu_model); #define cpu_init(cpu_model) CPU(cpu_alpha_init(cpu_model)) void alpha_cpu_list(FILE *f, fprintf_function cpu_fprintf); -int cpu_alpha_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. */ @@ -465,7 +504,7 @@ enum { }; static inline void cpu_get_tb_cpu_state(CPUAlphaState *env, target_ulong *pc, - target_ulong *cs_base, int *pflags) + target_ulong *cs_base, uint32_t *pflags) { int flags = 0; @@ -485,6 +524,4 @@ static inline void cpu_get_tb_cpu_state(CPUAlphaState *env, target_ulong *pc, *pflags = flags; } -#include "exec/exec-all.h" - -#endif /* !defined (__CPU_ALPHA_H__) */ +#endif /* ALPHA_CPU_H */ diff --git a/target-alpha/fpu_helper.c b/target-alpha/fpu_helper.c index 5ab7d5e64d..9645978aaa 100644 --- a/target-alpha/fpu_helper.c +++ b/target-alpha/fpu_helper.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "cpu.h" +#include "exec/exec-all.h" #include "exec/helper-proto.h" #include "fpu/softfloat.h" diff --git a/target-alpha/gdbstub.c b/target-alpha/gdbstub.c index 199f028425..d64bcccfa0 100644 --- a/target-alpha/gdbstub.c +++ b/target-alpha/gdbstub.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" #include "qemu-common.h" +#include "cpu.h" #include "exec/gdbstub.h" int alpha_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n) diff --git a/target-alpha/helper.c b/target-alpha/helper.c index 6dec2639b1..85168b7ed1 100644 --- a/target-alpha/helper.c +++ b/target-alpha/helper.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "cpu.h" +#include "exec/exec-all.h" #include "fpu/softfloat.h" #include "exec/helper-proto.h" diff --git a/target-alpha/int_helper.c b/target-alpha/int_helper.c index 777e48d084..19bebfe742 100644 --- a/target-alpha/int_helper.c +++ b/target-alpha/int_helper.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "cpu.h" +#include "exec/exec-all.h" #include "exec/helper-proto.h" #include "qemu/host-utils.h" diff --git a/target-alpha/machine.c b/target-alpha/machine.c index 9ab092852a..710b7835b4 100644 --- a/target-alpha/machine.c +++ b/target-alpha/machine.c @@ -1,6 +1,9 @@ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/boards.h" +#include "migration/cpu.h" static int get_fpcr(QEMUFile *f, void *opaque, size_t size) { diff --git a/target-alpha/mem_helper.c b/target-alpha/mem_helper.c index 7fee9a6e2b..1b2be50be7 100644 --- a/target-alpha/mem_helper.c +++ b/target-alpha/mem_helper.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "cpu.h" #include "exec/helper-proto.h" +#include "exec/exec-all.h" #include "exec/cpu_ldst.h" /* Softmmu support */ @@ -98,7 +99,8 @@ uint64_t helper_stq_c_phys(CPUAlphaState *env, uint64_t p, uint64_t v) } void alpha_cpu_do_unaligned_access(CPUState *cs, vaddr addr, - int is_write, int is_user, uintptr_t retaddr) + MMUAccessType access_type, + int mmu_idx, uintptr_t retaddr) { AlphaCPU *cpu = ALPHA_CPU(cs); CPUAlphaState *env = &cpu->env; @@ -143,12 +145,12 @@ void alpha_cpu_unassigned_access(CPUState *cs, hwaddr addr, NULL, it means that the function was called in C code (i.e. not from generated code or from helper.c) */ /* XXX: fix it to restore all registers */ -void tlb_fill(CPUState *cs, target_ulong addr, int is_write, +void tlb_fill(CPUState *cs, target_ulong addr, MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) { int ret; - ret = alpha_cpu_handle_mmu_fault(cs, addr, is_write, mmu_idx); + ret = alpha_cpu_handle_mmu_fault(cs, addr, access_type, mmu_idx); if (unlikely(ret != 0)) { if (retaddr) { cpu_restore_state(cs, retaddr); diff --git a/target-alpha/sys_helper.c b/target-alpha/sys_helper.c index e2dec15b60..bec1e178be 100644 --- a/target-alpha/sys_helper.c +++ b/target-alpha/sys_helper.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "cpu.h" +#include "exec/exec-all.h" #include "exec/helper-proto.h" #include "sysemu/sysemu.h" #include "qemu/timer.h" diff --git a/target-alpha/translate.c b/target-alpha/translate.c index 5b86992dd3..0ea0e6e146 100644 --- a/target-alpha/translate.c +++ b/target-alpha/translate.c @@ -21,6 +21,7 @@ #include "cpu.h" #include "disas/disas.h" #include "qemu/host-utils.h" +#include "exec/exec-all.h" #include "tcg-op.h" #include "exec/cpu_ldst.h" @@ -150,6 +151,7 @@ void alpha_translate_init(void) done_init = 1; cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, "env"); + tcg_ctx.tcg_env = cpu_env; for (i = 0; i < 31; i++) { cpu_std_ir[i] = tcg_global_mem_new_i64(cpu_env, @@ -447,10 +449,13 @@ static ExitStatus gen_store_conditional(DisasContext *ctx, int ra, int rb, static bool in_superpage(DisasContext *ctx, int64_t addr) { +#ifndef CONFIG_USER_ONLY return ((ctx->tb->flags & TB_FLAGS_USER_MODE) == 0 - && addr < 0 - && ((addr >> 41) & 3) == 2 - && addr >> TARGET_VIRT_ADDR_SPACE_BITS == addr >> 63); + && addr >> TARGET_VIRT_ADDR_SPACE_BITS == -1 + && ((addr >> 41) & 3) == 2); +#else + return false; +#endif } static bool use_goto_tb(DisasContext *ctx, uint64_t dest) @@ -460,12 +465,16 @@ static bool use_goto_tb(DisasContext *ctx, uint64_t dest) || ctx->singlestep_enabled || singlestep) { return false; } +#ifndef CONFIG_USER_ONLY /* If the destination is in the superpage, the page perms can't change. */ if (in_superpage(ctx, dest)) { return true; } /* Check for the dest on the same page as the start of the TB. */ return ((ctx->tb->pc ^ dest) & TARGET_PAGE_MASK) == 0; +#else + return true; +#endif } static ExitStatus gen_bdirect(DisasContext *ctx, int ra, int32_t disp) @@ -2989,7 +2998,8 @@ void gen_intermediate_code(CPUAlphaState *env, struct TranslationBlock *tb) tb->icount = num_insns; #ifdef DEBUG_DISAS - 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)) { qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(cs, pc_start, ctx.pc - pc_start, 1); qemu_log("\n"); diff --git a/target-alpha/vax_helper.c b/target-alpha/vax_helper.c index e74ac3e042..2b0c178274 100644 --- a/target-alpha/vax_helper.c +++ b/target-alpha/vax_helper.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "cpu.h" +#include "exec/exec-all.h" #include "exec/helper-proto.h" #include "fpu/softfloat.h" |