softmmu: make do_unaligned_access a method of CPU
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>
This commit is contained in:
parent
ca0aa40816
commit
93e22326d6
@ -155,7 +155,8 @@ WORD_TYPE helper_le_ld_name(CPUArchState *env, target_ulong addr, int mmu_idx,
|
|||||||
!= (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK))) {
|
!= (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK))) {
|
||||||
#ifdef ALIGNED_ONLY
|
#ifdef ALIGNED_ONLY
|
||||||
if ((addr & (DATA_SIZE - 1)) != 0) {
|
if ((addr & (DATA_SIZE - 1)) != 0) {
|
||||||
do_unaligned_access(env, addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
|
cpu_unaligned_access(ENV_GET_CPU(env), addr, READ_ACCESS_TYPE,
|
||||||
|
mmu_idx, retaddr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
tlb_fill(ENV_GET_CPU(env), addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
|
tlb_fill(ENV_GET_CPU(env), addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
|
||||||
@ -186,7 +187,8 @@ WORD_TYPE helper_le_ld_name(CPUArchState *env, target_ulong addr, int mmu_idx,
|
|||||||
unsigned shift;
|
unsigned shift;
|
||||||
do_unaligned_access:
|
do_unaligned_access:
|
||||||
#ifdef ALIGNED_ONLY
|
#ifdef ALIGNED_ONLY
|
||||||
do_unaligned_access(env, addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
|
cpu_unaligned_access(ENV_GET_CPU(env), addr, READ_ACCESS_TYPE,
|
||||||
|
mmu_idx, retaddr);
|
||||||
#endif
|
#endif
|
||||||
addr1 = addr & ~(DATA_SIZE - 1);
|
addr1 = addr & ~(DATA_SIZE - 1);
|
||||||
addr2 = addr1 + DATA_SIZE;
|
addr2 = addr1 + DATA_SIZE;
|
||||||
@ -204,7 +206,8 @@ WORD_TYPE helper_le_ld_name(CPUArchState *env, target_ulong addr, int mmu_idx,
|
|||||||
/* Handle aligned access or unaligned access in the same page. */
|
/* Handle aligned access or unaligned access in the same page. */
|
||||||
#ifdef ALIGNED_ONLY
|
#ifdef ALIGNED_ONLY
|
||||||
if ((addr & (DATA_SIZE - 1)) != 0) {
|
if ((addr & (DATA_SIZE - 1)) != 0) {
|
||||||
do_unaligned_access(env, addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
|
cpu_unaligned_access(ENV_GET_CPU(env), addr, READ_ACCESS_TYPE,
|
||||||
|
mmu_idx, retaddr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -237,7 +240,8 @@ WORD_TYPE helper_be_ld_name(CPUArchState *env, target_ulong addr, int mmu_idx,
|
|||||||
!= (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK))) {
|
!= (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK))) {
|
||||||
#ifdef ALIGNED_ONLY
|
#ifdef ALIGNED_ONLY
|
||||||
if ((addr & (DATA_SIZE - 1)) != 0) {
|
if ((addr & (DATA_SIZE - 1)) != 0) {
|
||||||
do_unaligned_access(env, addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
|
cpu_unaligned_access(ENV_GET_CPU(env), addr, READ_ACCESS_TYPE,
|
||||||
|
mmu_idx, retaddr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
tlb_fill(ENV_GET_CPU(env), addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
|
tlb_fill(ENV_GET_CPU(env), addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
|
||||||
@ -268,7 +272,8 @@ WORD_TYPE helper_be_ld_name(CPUArchState *env, target_ulong addr, int mmu_idx,
|
|||||||
unsigned shift;
|
unsigned shift;
|
||||||
do_unaligned_access:
|
do_unaligned_access:
|
||||||
#ifdef ALIGNED_ONLY
|
#ifdef ALIGNED_ONLY
|
||||||
do_unaligned_access(env, addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
|
cpu_unaligned_access(ENV_GET_CPU(env), addr, READ_ACCESS_TYPE,
|
||||||
|
mmu_idx, retaddr);
|
||||||
#endif
|
#endif
|
||||||
addr1 = addr & ~(DATA_SIZE - 1);
|
addr1 = addr & ~(DATA_SIZE - 1);
|
||||||
addr2 = addr1 + DATA_SIZE;
|
addr2 = addr1 + DATA_SIZE;
|
||||||
@ -286,7 +291,8 @@ WORD_TYPE helper_be_ld_name(CPUArchState *env, target_ulong addr, int mmu_idx,
|
|||||||
/* Handle aligned access or unaligned access in the same page. */
|
/* Handle aligned access or unaligned access in the same page. */
|
||||||
#ifdef ALIGNED_ONLY
|
#ifdef ALIGNED_ONLY
|
||||||
if ((addr & (DATA_SIZE - 1)) != 0) {
|
if ((addr & (DATA_SIZE - 1)) != 0) {
|
||||||
do_unaligned_access(env, addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
|
cpu_unaligned_access(ENV_GET_CPU(env), addr, READ_ACCESS_TYPE,
|
||||||
|
mmu_idx, retaddr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -357,7 +363,7 @@ void helper_le_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val,
|
|||||||
!= (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK))) {
|
!= (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK))) {
|
||||||
#ifdef ALIGNED_ONLY
|
#ifdef ALIGNED_ONLY
|
||||||
if ((addr & (DATA_SIZE - 1)) != 0) {
|
if ((addr & (DATA_SIZE - 1)) != 0) {
|
||||||
do_unaligned_access(env, addr, 1, mmu_idx, retaddr);
|
cpu_unaligned_access(ENV_GET_CPU(env), addr, 1, mmu_idx, retaddr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
tlb_fill(ENV_GET_CPU(env), addr, 1, mmu_idx, retaddr);
|
tlb_fill(ENV_GET_CPU(env), addr, 1, mmu_idx, retaddr);
|
||||||
@ -386,7 +392,7 @@ void helper_le_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val,
|
|||||||
int i;
|
int i;
|
||||||
do_unaligned_access:
|
do_unaligned_access:
|
||||||
#ifdef ALIGNED_ONLY
|
#ifdef ALIGNED_ONLY
|
||||||
do_unaligned_access(env, addr, 1, mmu_idx, retaddr);
|
cpu_unaligned_access(ENV_GET_CPU(env), addr, 1, mmu_idx, retaddr);
|
||||||
#endif
|
#endif
|
||||||
/* XXX: not efficient, but simple */
|
/* XXX: not efficient, but simple */
|
||||||
/* Note: relies on the fact that tlb_fill() does not remove the
|
/* Note: relies on the fact that tlb_fill() does not remove the
|
||||||
@ -405,7 +411,7 @@ void helper_le_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val,
|
|||||||
/* Handle aligned access or unaligned access in the same page. */
|
/* Handle aligned access or unaligned access in the same page. */
|
||||||
#ifdef ALIGNED_ONLY
|
#ifdef ALIGNED_ONLY
|
||||||
if ((addr & (DATA_SIZE - 1)) != 0) {
|
if ((addr & (DATA_SIZE - 1)) != 0) {
|
||||||
do_unaligned_access(env, addr, 1, mmu_idx, retaddr);
|
cpu_unaligned_access(ENV_GET_CPU(env), addr, 1, mmu_idx, retaddr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -433,7 +439,7 @@ void helper_be_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val,
|
|||||||
!= (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK))) {
|
!= (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK))) {
|
||||||
#ifdef ALIGNED_ONLY
|
#ifdef ALIGNED_ONLY
|
||||||
if ((addr & (DATA_SIZE - 1)) != 0) {
|
if ((addr & (DATA_SIZE - 1)) != 0) {
|
||||||
do_unaligned_access(env, addr, 1, mmu_idx, retaddr);
|
cpu_unaligned_access(ENV_GET_CPU(env), addr, 1, mmu_idx, retaddr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
tlb_fill(ENV_GET_CPU(env), addr, 1, mmu_idx, retaddr);
|
tlb_fill(ENV_GET_CPU(env), addr, 1, mmu_idx, retaddr);
|
||||||
@ -462,7 +468,7 @@ void helper_be_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val,
|
|||||||
int i;
|
int i;
|
||||||
do_unaligned_access:
|
do_unaligned_access:
|
||||||
#ifdef ALIGNED_ONLY
|
#ifdef ALIGNED_ONLY
|
||||||
do_unaligned_access(env, addr, 1, mmu_idx, retaddr);
|
cpu_unaligned_access(ENV_GET_CPU(env), addr, 1, mmu_idx, retaddr);
|
||||||
#endif
|
#endif
|
||||||
/* XXX: not efficient, but simple */
|
/* XXX: not efficient, but simple */
|
||||||
/* Note: relies on the fact that tlb_fill() does not remove the
|
/* Note: relies on the fact that tlb_fill() does not remove the
|
||||||
@ -481,7 +487,7 @@ void helper_be_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val,
|
|||||||
/* Handle aligned access or unaligned access in the same page. */
|
/* Handle aligned access or unaligned access in the same page. */
|
||||||
#ifdef ALIGNED_ONLY
|
#ifdef ALIGNED_ONLY
|
||||||
if ((addr & (DATA_SIZE - 1)) != 0) {
|
if ((addr & (DATA_SIZE - 1)) != 0) {
|
||||||
do_unaligned_access(env, addr, 1, mmu_idx, retaddr);
|
cpu_unaligned_access(ENV_GET_CPU(env), addr, 1, mmu_idx, retaddr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -80,6 +80,8 @@ struct TranslationBlock;
|
|||||||
* @has_work: Callback for checking if there is work to do.
|
* @has_work: Callback for checking if there is work to do.
|
||||||
* @do_interrupt: Callback for interrupt handling.
|
* @do_interrupt: Callback for interrupt handling.
|
||||||
* @do_unassigned_access: Callback for unassigned access handling.
|
* @do_unassigned_access: Callback for unassigned access handling.
|
||||||
|
* @do_unaligned_access: Callback for unaligned access handling, if
|
||||||
|
* the target defines #ALIGNED_ONLY.
|
||||||
* @memory_rw_debug: Callback for GDB memory access.
|
* @memory_rw_debug: Callback for GDB memory access.
|
||||||
* @dump_state: Callback for dumping state.
|
* @dump_state: Callback for dumping state.
|
||||||
* @dump_statistics: Callback for dumping statistics.
|
* @dump_statistics: Callback for dumping statistics.
|
||||||
@ -112,6 +114,8 @@ typedef struct CPUClass {
|
|||||||
bool (*has_work)(CPUState *cpu);
|
bool (*has_work)(CPUState *cpu);
|
||||||
void (*do_interrupt)(CPUState *cpu);
|
void (*do_interrupt)(CPUState *cpu);
|
||||||
CPUUnassignedAccess do_unassigned_access;
|
CPUUnassignedAccess do_unassigned_access;
|
||||||
|
void (*do_unaligned_access)(CPUState *cpu, vaddr addr,
|
||||||
|
int is_write, int is_user, uintptr_t retaddr);
|
||||||
int (*memory_rw_debug)(CPUState *cpu, vaddr addr,
|
int (*memory_rw_debug)(CPUState *cpu, vaddr addr,
|
||||||
uint8_t *buf, int len, bool is_write);
|
uint8_t *buf, int len, bool is_write);
|
||||||
void (*dump_state)(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
|
void (*dump_state)(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
|
||||||
@ -544,8 +548,7 @@ void cpu_interrupt(CPUState *cpu, int mask);
|
|||||||
|
|
||||||
#endif /* USER_ONLY */
|
#endif /* USER_ONLY */
|
||||||
|
|
||||||
#ifndef CONFIG_USER_ONLY
|
#ifdef CONFIG_SOFTMMU
|
||||||
|
|
||||||
static inline void cpu_unassigned_access(CPUState *cpu, hwaddr addr,
|
static inline void cpu_unassigned_access(CPUState *cpu, hwaddr addr,
|
||||||
bool is_write, bool is_exec,
|
bool is_write, bool is_exec,
|
||||||
int opaque, unsigned size)
|
int opaque, unsigned size)
|
||||||
@ -557,6 +560,14 @@ static inline void cpu_unassigned_access(CPUState *cpu, hwaddr addr,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void cpu_unaligned_access(CPUState *cpu, vaddr addr,
|
||||||
|
int is_write, int is_user,
|
||||||
|
uintptr_t retaddr)
|
||||||
|
{
|
||||||
|
CPUClass *cc = CPU_GET_CLASS(cpu);
|
||||||
|
|
||||||
|
return cc->do_unaligned_access(cpu, addr, is_write, is_user, retaddr);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,5 +84,7 @@ void alpha_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
|
|||||||
hwaddr alpha_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
|
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_read_register(CPUState *cpu, uint8_t *buf, int reg);
|
||||||
int alpha_cpu_gdb_write_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);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -292,6 +292,7 @@ static void alpha_cpu_class_init(ObjectClass *oc, void *data)
|
|||||||
cc->handle_mmu_fault = alpha_cpu_handle_mmu_fault;
|
cc->handle_mmu_fault = alpha_cpu_handle_mmu_fault;
|
||||||
#else
|
#else
|
||||||
cc->do_unassigned_access = alpha_cpu_unassigned_access;
|
cc->do_unassigned_access = alpha_cpu_unassigned_access;
|
||||||
|
cc->do_unaligned_access = alpha_cpu_do_unaligned_access;
|
||||||
cc->get_phys_page_debug = alpha_cpu_get_phys_page_debug;
|
cc->get_phys_page_debug = alpha_cpu_get_phys_page_debug;
|
||||||
dc->vmsd = &vmstate_alpha_cpu;
|
dc->vmsd = &vmstate_alpha_cpu;
|
||||||
#endif
|
#endif
|
||||||
|
@ -96,11 +96,11 @@ uint64_t helper_stq_c_phys(CPUAlphaState *env, uint64_t p, uint64_t v)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_unaligned_access(CPUAlphaState *env, target_ulong addr,
|
void alpha_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
|
||||||
int is_write, int is_user, uintptr_t retaddr)
|
int is_write, int is_user, uintptr_t retaddr)
|
||||||
{
|
{
|
||||||
AlphaCPU *cpu = alpha_env_get_cpu(env);
|
AlphaCPU *cpu = ALPHA_CPU(cs);
|
||||||
CPUState *cs = CPU(cpu);
|
CPUAlphaState *env = &cpu->env;
|
||||||
uint64_t pc;
|
uint64_t pc;
|
||||||
uint32_t insn;
|
uint32_t insn;
|
||||||
|
|
||||||
|
@ -80,5 +80,7 @@ void mips_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
|
|||||||
hwaddr mips_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
|
hwaddr mips_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
|
||||||
int mips_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
|
int mips_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
|
||||||
int mips_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
|
int mips_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
|
||||||
|
void mips_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
|
||||||
|
int is_write, int is_user, uintptr_t retaddr);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -137,6 +137,7 @@ static void mips_cpu_class_init(ObjectClass *c, void *data)
|
|||||||
cc->handle_mmu_fault = mips_cpu_handle_mmu_fault;
|
cc->handle_mmu_fault = mips_cpu_handle_mmu_fault;
|
||||||
#else
|
#else
|
||||||
cc->do_unassigned_access = mips_cpu_unassigned_access;
|
cc->do_unassigned_access = mips_cpu_unassigned_access;
|
||||||
|
cc->do_unaligned_access = mips_cpu_do_unaligned_access;
|
||||||
cc->get_phys_page_debug = mips_cpu_get_phys_page_debug;
|
cc->get_phys_page_debug = mips_cpu_get_phys_page_debug;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2128,10 +2128,6 @@ void helper_wait(CPUMIPSState *env)
|
|||||||
|
|
||||||
#if !defined(CONFIG_USER_ONLY)
|
#if !defined(CONFIG_USER_ONLY)
|
||||||
|
|
||||||
static void QEMU_NORETURN do_unaligned_access(CPUMIPSState *env,
|
|
||||||
target_ulong addr, int is_write,
|
|
||||||
int is_user, uintptr_t retaddr);
|
|
||||||
|
|
||||||
#define MMUSUFFIX _mmu
|
#define MMUSUFFIX _mmu
|
||||||
#define ALIGNED_ONLY
|
#define ALIGNED_ONLY
|
||||||
|
|
||||||
@ -2147,9 +2143,12 @@ static void QEMU_NORETURN do_unaligned_access(CPUMIPSState *env,
|
|||||||
#define SHIFT 3
|
#define SHIFT 3
|
||||||
#include "exec/softmmu_template.h"
|
#include "exec/softmmu_template.h"
|
||||||
|
|
||||||
static void do_unaligned_access(CPUMIPSState *env, target_ulong addr,
|
void mips_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
|
||||||
int is_write, int is_user, uintptr_t retaddr)
|
int is_write, int is_user, uintptr_t retaddr)
|
||||||
{
|
{
|
||||||
|
MIPSCPU *cpu = MIPS_CPU(cs);
|
||||||
|
CPUMIPSState *env = &cpu->env;
|
||||||
|
|
||||||
env->CP0_BadVAddr = addr;
|
env->CP0_BadVAddr = addr;
|
||||||
do_raise_exception(env, (is_write == 1) ? EXCP_AdES : EXCP_AdEL, retaddr);
|
do_raise_exception(env, (is_write == 1) ? EXCP_AdES : EXCP_AdEL, retaddr);
|
||||||
}
|
}
|
||||||
|
@ -81,5 +81,8 @@ void sparc_cpu_dump_state(CPUState *cpu, FILE *f,
|
|||||||
hwaddr sparc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
|
hwaddr sparc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
|
||||||
int sparc_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
|
int sparc_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
|
||||||
int sparc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
|
int sparc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
|
||||||
|
void QEMU_NORETURN sparc_cpu_do_unaligned_access(CPUState *cpu,
|
||||||
|
vaddr addr, int is_write,
|
||||||
|
int is_user, uintptr_t retaddr);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -825,6 +825,7 @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data)
|
|||||||
cc->handle_mmu_fault = sparc_cpu_handle_mmu_fault;
|
cc->handle_mmu_fault = sparc_cpu_handle_mmu_fault;
|
||||||
#else
|
#else
|
||||||
cc->do_unassigned_access = sparc_cpu_unassigned_access;
|
cc->do_unassigned_access = sparc_cpu_unassigned_access;
|
||||||
|
cc->do_unaligned_access = sparc_cpu_do_unaligned_access;
|
||||||
cc->get_phys_page_debug = sparc_cpu_get_phys_page_debug;
|
cc->get_phys_page_debug = sparc_cpu_get_phys_page_debug;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -65,9 +65,6 @@
|
|||||||
#define QT1 (env->qt1)
|
#define QT1 (env->qt1)
|
||||||
|
|
||||||
#if !defined(CONFIG_USER_ONLY)
|
#if !defined(CONFIG_USER_ONLY)
|
||||||
static void QEMU_NORETURN do_unaligned_access(CPUSPARCState *env,
|
|
||||||
target_ulong addr, int is_write,
|
|
||||||
int is_user, uintptr_t retaddr);
|
|
||||||
#include "exec/softmmu_exec.h"
|
#include "exec/softmmu_exec.h"
|
||||||
#define MMUSUFFIX _mmu
|
#define MMUSUFFIX _mmu
|
||||||
#define ALIGNED_ONLY
|
#define ALIGNED_ONLY
|
||||||
@ -2425,11 +2422,13 @@ void sparc_cpu_unassigned_access(CPUState *cs, hwaddr addr,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(CONFIG_USER_ONLY)
|
#if !defined(CONFIG_USER_ONLY)
|
||||||
static void QEMU_NORETURN do_unaligned_access(CPUSPARCState *env,
|
void QEMU_NORETURN sparc_cpu_do_unaligned_access(CPUState *cs,
|
||||||
target_ulong addr, int is_write,
|
vaddr addr, int is_write,
|
||||||
int is_user, uintptr_t retaddr)
|
int is_user, uintptr_t retaddr)
|
||||||
{
|
{
|
||||||
SPARCCPU *cpu = sparc_env_get_cpu(env);
|
SPARCCPU *cpu = SPARC_CPU(cs);
|
||||||
|
CPUSPARCState *env = &cpu->env;
|
||||||
|
|
||||||
#ifdef DEBUG_UNALIGNED
|
#ifdef DEBUG_UNALIGNED
|
||||||
printf("Unaligned access to 0x" TARGET_FMT_lx " from 0x" TARGET_FMT_lx
|
printf("Unaligned access to 0x" TARGET_FMT_lx " from 0x" TARGET_FMT_lx
|
||||||
"\n", addr, env->pc);
|
"\n", addr, env->pc);
|
||||||
|
@ -89,5 +89,7 @@ void xtensa_cpu_dump_state(CPUState *cpu, FILE *f,
|
|||||||
hwaddr xtensa_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
|
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_read_register(CPUState *cpu, uint8_t *buf, int reg);
|
||||||
int xtensa_cpu_gdb_write_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
|
#endif
|
||||||
|
@ -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_read_register = xtensa_cpu_gdb_read_register;
|
||||||
cc->gdb_write_register = xtensa_cpu_gdb_write_register;
|
cc->gdb_write_register = xtensa_cpu_gdb_write_register;
|
||||||
#ifndef CONFIG_USER_ONLY
|
#ifndef CONFIG_USER_ONLY
|
||||||
|
cc->do_unaligned_access = xtensa_cpu_do_unaligned_access;
|
||||||
cc->get_phys_page_debug = xtensa_cpu_get_phys_page_debug;
|
cc->get_phys_page_debug = xtensa_cpu_get_phys_page_debug;
|
||||||
#endif
|
#endif
|
||||||
dc->vmsd = &vmstate_xtensa_cpu;
|
dc->vmsd = &vmstate_xtensa_cpu;
|
||||||
|
@ -31,9 +31,6 @@
|
|||||||
#include "exec/softmmu_exec.h"
|
#include "exec/softmmu_exec.h"
|
||||||
#include "exec/address-spaces.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 ALIGNED_ONLY
|
||||||
#define MMUSUFFIX _mmu
|
#define MMUSUFFIX _mmu
|
||||||
|
|
||||||
@ -49,10 +46,11 @@ static void do_unaligned_access(CPUXtensaState *env,
|
|||||||
#define SHIFT 3
|
#define SHIFT 3
|
||||||
#include "exec/softmmu_template.h"
|
#include "exec/softmmu_template.h"
|
||||||
|
|
||||||
static void do_unaligned_access(CPUXtensaState *env,
|
void xtensa_cpu_do_unaligned_access(CPUState *cs,
|
||||||
target_ulong addr, int is_write, int is_user, uintptr_t retaddr)
|
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) &&
|
if (xtensa_option_enabled(env->config, XTENSA_OPTION_UNALIGNED_EXCEPTION) &&
|
||||||
!xtensa_option_enabled(env->config, XTENSA_OPTION_HW_ALIGNMENT)) {
|
!xtensa_option_enabled(env->config, XTENSA_OPTION_HW_ALIGNMENT)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user