From 93e22326d62d903b301e90bea71f0dbd0de858d3 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini <pbonzini@redhat.com> Date: Fri, 28 Mar 2014 18:14:58 +0100 Subject: softmmu: make do_unaligned_access a method of CPU MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We will reference it from more files in the next patch. To avoid ruining the small steps we're making towards multi-target, make it a method of CPU rather than just a global. Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- target-xtensa/cpu-qom.h | 2 ++ target-xtensa/cpu.c | 1 + target-xtensa/op_helper.c | 10 ++++------ 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'target-xtensa') diff --git a/target-xtensa/cpu-qom.h b/target-xtensa/cpu-qom.h index c6cc2d9..f320486 100644 --- a/target-xtensa/cpu-qom.h +++ b/target-xtensa/cpu-qom.h @@ -89,5 +89,7 @@ void xtensa_cpu_dump_state(CPUState *cpu, FILE *f, hwaddr xtensa_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); int xtensa_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); int xtensa_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); +void xtensa_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, + int is_write, int is_user, uintptr_t retaddr); #endif diff --git a/target-xtensa/cpu.c b/target-xtensa/cpu.c index 6251f1c..9d8801b 100644 --- a/target-xtensa/cpu.c +++ b/target-xtensa/cpu.c @@ -148,6 +148,7 @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_read_register = xtensa_cpu_gdb_read_register; cc->gdb_write_register = xtensa_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY + cc->do_unaligned_access = xtensa_cpu_do_unaligned_access; cc->get_phys_page_debug = xtensa_cpu_get_phys_page_debug; #endif dc->vmsd = &vmstate_xtensa_cpu; diff --git a/target-xtensa/op_helper.c b/target-xtensa/op_helper.c index 01edab4..fd514fc 100644 --- a/target-xtensa/op_helper.c +++ b/target-xtensa/op_helper.c @@ -31,9 +31,6 @@ #include "exec/softmmu_exec.h" #include "exec/address-spaces.h" -static void do_unaligned_access(CPUXtensaState *env, - target_ulong addr, int is_write, int is_user, uintptr_t retaddr); - #define ALIGNED_ONLY #define MMUSUFFIX _mmu @@ -49,10 +46,11 @@ static void do_unaligned_access(CPUXtensaState *env, #define SHIFT 3 #include "exec/softmmu_template.h" -static void do_unaligned_access(CPUXtensaState *env, - target_ulong addr, int is_write, int is_user, uintptr_t retaddr) +void xtensa_cpu_do_unaligned_access(CPUState *cs, + vaddr addr, int is_write, int is_user, uintptr_t retaddr) { - XtensaCPU *cpu = xtensa_env_get_cpu(env); + XtensaCPU *cpu = XTENSA_CPU(cs); + CPUXtensaState *env = &cpu->env; if (xtensa_option_enabled(env->config, XTENSA_OPTION_UNALIGNED_EXCEPTION) && !xtensa_option_enabled(env->config, XTENSA_OPTION_HW_ALIGNMENT)) { -- cgit v1.1 From d94f0a8ecb256fcfcd9eb12bd4700711eca3e937 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini <pbonzini@redhat.com> Date: Fri, 28 Mar 2014 17:48:12 +0100 Subject: softmmu: move ALIGNED_ONLY to cpu.h Prepare for moving softmmu_header.h inclusion out of .c files Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- target-xtensa/cpu.h | 1 + target-xtensa/op_helper.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'target-xtensa') diff --git a/target-xtensa/cpu.h b/target-xtensa/cpu.h index e210bac..d797d26 100644 --- a/target-xtensa/cpu.h +++ b/target-xtensa/cpu.h @@ -28,6 +28,7 @@ #ifndef CPU_XTENSA_H #define CPU_XTENSA_H +#define ALIGNED_ONLY #define TARGET_LONG_BITS 32 #define ELF_MACHINE EM_XTENSA diff --git a/target-xtensa/op_helper.c b/target-xtensa/op_helper.c index fd514fc..9ce81e2 100644 --- a/target-xtensa/op_helper.c +++ b/target-xtensa/op_helper.c @@ -31,7 +31,6 @@ #include "exec/softmmu_exec.h" #include "exec/address-spaces.h" -#define ALIGNED_ONLY #define MMUSUFFIX _mmu #define SHIFT 0 -- cgit v1.1 From 0f590e749f7c838bfd40b79242fc5aeb91e81747 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini <pbonzini@redhat.com> Date: Fri, 28 Mar 2014 17:55:24 +0100 Subject: softmmu: commonize helper definitions They do not need to be in op_helper.c. Because cputlb.c now includes softmmu_template.h twice for each size, io_readX must be elided the second time through. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- target-xtensa/op_helper.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'target-xtensa') diff --git a/target-xtensa/op_helper.c b/target-xtensa/op_helper.c index 9ce81e2..a772295 100644 --- a/target-xtensa/op_helper.c +++ b/target-xtensa/op_helper.c @@ -30,20 +30,7 @@ #include "qemu/host-utils.h" #include "exec/softmmu_exec.h" #include "exec/address-spaces.h" - -#define MMUSUFFIX _mmu - -#define SHIFT 0 -#include "exec/softmmu_template.h" - -#define SHIFT 1 -#include "exec/softmmu_template.h" - -#define SHIFT 2 -#include "exec/softmmu_template.h" - -#define SHIFT 3 -#include "exec/softmmu_template.h" +#include "qemu/timer.h" void xtensa_cpu_do_unaligned_access(CPUState *cs, vaddr addr, int is_write, int is_user, uintptr_t retaddr) -- cgit v1.1 From f08b617018e424134a0a012b08253d567c62f7ee Mon Sep 17 00:00:00 2001 From: Paolo Bonzini <pbonzini@redhat.com> Date: Fri, 28 Mar 2014 19:42:10 +0100 Subject: softmmu: introduce cpu_ldst.h This will collect all load and store helpers soon. For now it is just a replacement for softmmu_exec.h, which this patch stops including directly, but we also include it where this will be necessary in order to simplify the next patch. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- target-xtensa/op_helper.c | 2 +- target-xtensa/translate.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'target-xtensa') diff --git a/target-xtensa/op_helper.c b/target-xtensa/op_helper.c index a772295..dae1386 100644 --- a/target-xtensa/op_helper.c +++ b/target-xtensa/op_helper.c @@ -28,7 +28,7 @@ #include "cpu.h" #include "exec/helper-proto.h" #include "qemu/host-utils.h" -#include "exec/softmmu_exec.h" +#include "exec/cpu_ldst.h" #include "exec/address-spaces.h" #include "qemu/timer.h" diff --git a/target-xtensa/translate.c b/target-xtensa/translate.c index 57e56bd..2f22cce 100644 --- a/target-xtensa/translate.c +++ b/target-xtensa/translate.c @@ -36,6 +36,7 @@ #include "tcg-op.h" #include "qemu/log.h" #include "sysemu/sysemu.h" +#include "exec/cpu_ldst.h" #include "exec/helper-proto.h" #include "exec/helper-gen.h" -- cgit v1.1