Use uintptr_t for various op related functions Use uintptr_t instead of void * or unsigned long in several op related functions, env->mem_io_pc and GETPC() macro. Reviewed-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
diff --git a/cpu-defs.h b/cpu-defs.h index 3268968..88d8093 100644 --- a/cpu-defs.h +++ b/cpu-defs.h
@@ -166,8 +166,8 @@ /* in order to avoid passing too many arguments to the MMIO \ helpers, we store some rarely used information in the CPU \ context) */ \ - unsigned long mem_io_pc; /* host pc at which the memory was \ - accessed */ \ + uintptr_t mem_io_pc; /* host pc at which the memory was \ + accessed */ \ target_ulong mem_io_vaddr; /* target virtual addr at which the \ memory was accessed */ \ uint32_t halted; /* Nonzero if the CPU is in suspend state */ \
diff --git a/exec-all.h b/exec-all.h index fa7bdfe..fccce88 100644 --- a/exec-all.h +++ b/exec-all.h
@@ -87,7 +87,7 @@ int cpu_restore_state(struct TranslationBlock *tb, CPUArchState *env, uintptr_t searched_pc); void QEMU_NORETURN cpu_resume_from_signal(CPUArchState *env1, void *puc); -void QEMU_NORETURN cpu_io_recompile(CPUArchState *env, void *retaddr); +void QEMU_NORETURN cpu_io_recompile(CPUArchState *env, uintptr_t retaddr); TranslationBlock *tb_gen_code(CPUArchState *env, target_ulong pc, target_ulong cs_base, int flags, int cflags); @@ -287,13 +287,13 @@ # endif #elif defined(__s390__) && !defined(__s390x__) # define GETPC() \ - ((void *)(((uintptr_t)__builtin_return_address(0) & 0x7fffffffUL) - 1)) + (((uintptr_t)__builtin_return_address(0) & 0x7fffffffUL) - 1) #elif defined(__arm__) /* Thumb return addresses have the low bit set, so we need to subtract two. This is still safe in ARM mode because instructions are 4 bytes. */ -# define GETPC() ((void *)((uintptr_t)__builtin_return_address(0) - 2)) +# define GETPC() ((uintptr_t)__builtin_return_address(0) - 2) #else -# define GETPC() ((void *)((uintptr_t)__builtin_return_address(0) - 1)) +# define GETPC() ((uintptr_t)__builtin_return_address(0) - 1) #endif #if !defined(CONFIG_USER_ONLY) @@ -305,7 +305,7 @@ uint64_t value, unsigned size); void tlb_fill(CPUArchState *env1, target_ulong addr, int is_write, int mmu_idx, - void *retaddr); + uintptr_t retaddr); #include "softmmu_defs.h"
diff --git a/exec.c b/exec.c index 03d3a6b..63a0d2f 100644 --- a/exec.c +++ b/exec.c
@@ -1221,7 +1221,7 @@ #if !defined(CONFIG_SOFTMMU) static void tb_invalidate_phys_page(tb_page_addr_t addr, - unsigned long pc, void *puc) + uintptr_t pc, void *puc) { TranslationBlock *tb; PageDesc *p; @@ -4477,20 +4477,20 @@ /* in deterministic execution mode, instructions doing device I/Os must be at the end of the TB */ -void cpu_io_recompile(CPUArchState *env, void *retaddr) +void cpu_io_recompile(CPUArchState *env, uintptr_t retaddr) { TranslationBlock *tb; uint32_t n, cflags; target_ulong pc, cs_base; uint64_t flags; - tb = tb_find_pc((uintptr_t)retaddr); + tb = tb_find_pc(retaddr); if (!tb) { cpu_abort(env, "cpu_io_recompile: could not find TB for pc=%p", - retaddr); + (void *)retaddr); } n = env->icount_decr.u16.low + tb->icount; - cpu_restore_state(tb, env, (unsigned long)retaddr); + cpu_restore_state(tb, env, retaddr); /* Calculate how many instructions had been executed before the fault occurred. */ n = n - env->icount_decr.u16.low; @@ -4638,7 +4638,7 @@ #define MMUSUFFIX _cmmu #undef GETPC -#define GETPC() NULL +#define GETPC() ((uintptr_t)0) #define env cpu_single_env #define SOFTMMU_CODE_ACCESS
diff --git a/softmmu_template.h b/softmmu_template.h index afcab1e..b285d78 100644 --- a/softmmu_template.h +++ b/softmmu_template.h
@@ -69,17 +69,17 @@ static DATA_TYPE glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(ENV_PARAM target_ulong addr, int mmu_idx, - void *retaddr); + uintptr_t retaddr); static inline DATA_TYPE glue(io_read, SUFFIX)(ENV_PARAM target_phys_addr_t physaddr, target_ulong addr, - void *retaddr) + uintptr_t retaddr) { DATA_TYPE res; MemoryRegion *mr = iotlb_to_region(physaddr); physaddr = (physaddr & TARGET_PAGE_MASK) + addr; - env->mem_io_pc = (unsigned long)retaddr; + env->mem_io_pc = retaddr; if (mr != &io_mem_ram && mr != &io_mem_rom && mr != &io_mem_unassigned && mr != &io_mem_notdirty @@ -113,7 +113,7 @@ target_ulong tlb_addr; target_phys_addr_t ioaddr; unsigned long addend; - void *retaddr; + uintptr_t retaddr; /* test if there is match for unaligned or IO access */ /* XXX: could done more in memory macro in a non portable way */ @@ -166,7 +166,7 @@ glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(ENV_PARAM target_ulong addr, int mmu_idx, - void *retaddr) + uintptr_t retaddr) { DATA_TYPE res, res1, res2; int index, shift; @@ -219,13 +219,13 @@ target_ulong addr, DATA_TYPE val, int mmu_idx, - void *retaddr); + uintptr_t retaddr); static inline void glue(io_write, SUFFIX)(ENV_PARAM target_phys_addr_t physaddr, DATA_TYPE val, target_ulong addr, - void *retaddr) + uintptr_t retaddr) { MemoryRegion *mr = iotlb_to_region(physaddr); @@ -238,7 +238,7 @@ } env->mem_io_vaddr = addr; - env->mem_io_pc = (unsigned long)retaddr; + env->mem_io_pc = retaddr; #if SHIFT <= 2 io_mem_write(mr, physaddr, val, 1 << SHIFT); #else @@ -260,7 +260,7 @@ target_phys_addr_t ioaddr; unsigned long addend; target_ulong tlb_addr; - void *retaddr; + uintptr_t retaddr; int index; index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); @@ -310,7 +310,7 @@ target_ulong addr, DATA_TYPE val, int mmu_idx, - void *retaddr) + uintptr_t retaddr) { target_phys_addr_t ioaddr; unsigned long addend;
diff --git a/target-alpha/cpu.h b/target-alpha/cpu.h index 74bf7f7..fd578ce 100644 --- a/target-alpha/cpu.h +++ b/target-alpha/cpu.h
@@ -433,9 +433,9 @@ int mmu_idx); #define cpu_handle_mmu_fault cpu_alpha_handle_mmu_fault void do_interrupt (CPUAlphaState *env); -void do_restore_state(CPUAlphaState *, void *retaddr); -void QEMU_NORETURN dynamic_excp(CPUAlphaState *, void *, int, int); -void QEMU_NORETURN arith_excp(CPUAlphaState *, void *, int, uint64_t); +void do_restore_state(CPUAlphaState *, uintptr_t retaddr); +void QEMU_NORETURN dynamic_excp(CPUAlphaState *, uintptr_t, int, int); +void QEMU_NORETURN arith_excp(CPUAlphaState *, uintptr_t, int, uint64_t); uint64_t cpu_alpha_load_fpcr (CPUAlphaState *env); void cpu_alpha_store_fpcr (CPUAlphaState *env, uint64_t val);
diff --git a/target-alpha/fpu_helper.c b/target-alpha/fpu_helper.c index dda1103..fe988ec 100644 --- a/target-alpha/fpu_helper.c +++ b/target-alpha/fpu_helper.c
@@ -44,7 +44,7 @@ return get_float_exception_flags(&FP_STATUS); } -static inline void inline_fp_exc_raise(CPUAlphaState *env, void *retaddr, +static inline void inline_fp_exc_raise(CPUAlphaState *env, uintptr_t retaddr, uint32_t exc, uint32_t regno) { if (exc) { @@ -160,7 +160,7 @@ return r; } -static float32 f_to_float32(CPUAlphaState *env, void *retaddr, uint64_t a) +static float32 f_to_float32(CPUAlphaState *env, uintptr_t retaddr, uint64_t a) { uint32_t exp, mant_sig; CPU_FloatU r; @@ -291,7 +291,7 @@ return r; } -static float64 g_to_float64(CPUAlphaState *env, void *retaddr, uint64_t a) +static float64 g_to_float64(CPUAlphaState *env, uintptr_t retaddr, uint64_t a) { uint64_t exp, mant_sig; CPU_DoubleU r;
diff --git a/target-alpha/helper.c b/target-alpha/helper.c index 765e650..81d4763 100644 --- a/target-alpha/helper.c +++ b/target-alpha/helper.c
@@ -494,13 +494,12 @@ cpu_fprintf(f, "\n"); } -void do_restore_state(CPUAlphaState *env, void *retaddr) +void do_restore_state(CPUAlphaState *env, uintptr_t retaddr) { - uintptr_t pc = (uintptr_t)retaddr; - if (pc) { - TranslationBlock *tb = tb_find_pc(pc); + if (retaddr) { + TranslationBlock *tb = tb_find_pc(retaddr); if (tb) { - cpu_restore_state(tb, env, pc); + cpu_restore_state(tb, env, retaddr); } } } @@ -515,7 +514,7 @@ } /* This may be called from any of the helpers to set up EXCEPTION_INDEX. */ -void QEMU_NORETURN dynamic_excp(CPUAlphaState *env, void *retaddr, +void QEMU_NORETURN dynamic_excp(CPUAlphaState *env, uintptr_t retaddr, int excp, int error) { env->exception_index = excp; @@ -524,7 +523,7 @@ cpu_loop_exit(env); } -void QEMU_NORETURN arith_excp(CPUAlphaState *env, void *retaddr, +void QEMU_NORETURN arith_excp(CPUAlphaState *env, uintptr_t retaddr, int exc, uint64_t mask) { env->trap_arg0 = exc;
diff --git a/target-alpha/mem_helper.c b/target-alpha/mem_helper.c index dd5ca49..87cada4 100644 --- a/target-alpha/mem_helper.c +++ b/target-alpha/mem_helper.c
@@ -89,7 +89,7 @@ } static void do_unaligned_access(CPUAlphaState *env, target_ulong addr, - int is_write, int is_user, void *retaddr) + int is_write, int is_user, uintptr_t retaddr) { uint64_t pc; uint32_t insn; @@ -112,7 +112,7 @@ { env->trap_arg0 = addr; env->trap_arg1 = is_write; - dynamic_excp(env, NULL, EXCP_MCHK, 0); + dynamic_excp(env, 0, EXCP_MCHK, 0); } #include "softmmu_exec.h" @@ -137,7 +137,7 @@ from generated code or from helper.c) */ /* XXX: fix it to restore all registers */ void tlb_fill(CPUAlphaState *env, target_ulong addr, int is_write, - int mmu_idx, void *retaddr) + int mmu_idx, uintptr_t retaddr) { int ret;
diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c index c728432..b53369d 100644 --- a/target-arm/op_helper.c +++ b/target-arm/op_helper.c
@@ -76,11 +76,10 @@ from generated code or from helper.c) */ /* XXX: fix it to restore all registers */ void tlb_fill(CPUARMState *env1, target_ulong addr, int is_write, int mmu_idx, - void *retaddr) + uintptr_t retaddr) { TranslationBlock *tb; CPUARMState *saved_env; - unsigned long pc; int ret; saved_env = env; @@ -89,12 +88,11 @@ if (unlikely(ret)) { if (retaddr) { /* now we have a real cpu fault */ - pc = (unsigned long)retaddr; - tb = tb_find_pc(pc); + tb = tb_find_pc(retaddr); if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc); + cpu_restore_state(tb, env, retaddr); } } raise_exception(env->exception_index);
diff --git a/target-cris/op_helper.c b/target-cris/op_helper.c index c568e2b..b92c106 100644 --- a/target-cris/op_helper.c +++ b/target-cris/op_helper.c
@@ -57,28 +57,26 @@ from generated code or from helper.c) */ /* XXX: fix it to restore all registers */ void tlb_fill(CPUCRISState *env1, target_ulong addr, int is_write, int mmu_idx, - void *retaddr) + uintptr_t retaddr) { TranslationBlock *tb; CPUCRISState *saved_env; - unsigned long pc; int ret; saved_env = env; env = env1; - D_LOG("%s pc=%x tpc=%x ra=%x\n", __func__, - env->pc, env->debug1, retaddr); + D_LOG("%s pc=%x tpc=%x ra=%p\n", __func__, + env->pc, env->debug1, (void *)retaddr); ret = cpu_cris_handle_mmu_fault(env, addr, is_write, mmu_idx); if (unlikely(ret)) { if (retaddr) { /* now we have a real cpu fault */ - pc = (unsigned long)retaddr; - tb = tb_find_pc(pc); + tb = tb_find_pc(retaddr); if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc); + cpu_restore_state(tb, env, retaddr); /* Evaluate flags after retranslation. */ helper_top_evaluate_flags();
diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c index c04ae44..bc3b94e 100644 --- a/target-i386/op_helper.c +++ b/target-i386/op_helper.c
@@ -5003,11 +5003,10 @@ from generated code or from helper.c) */ /* XXX: fix it to restore all registers */ void tlb_fill(CPUX86State *env1, target_ulong addr, int is_write, int mmu_idx, - void *retaddr) + uintptr_t retaddr) { TranslationBlock *tb; int ret; - unsigned long pc; CPUX86State *saved_env; saved_env = env; @@ -5017,12 +5016,11 @@ if (ret) { if (retaddr) { /* now we have a real cpu fault */ - pc = (unsigned long)retaddr; - tb = tb_find_pc(pc); + tb = tb_find_pc(retaddr); if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc); + cpu_restore_state(tb, env, retaddr); } } raise_exception_err(env->exception_index, env->error_code);
diff --git a/target-lm32/op_helper.c b/target-lm32/op_helper.c index e9c9638..51edc1a 100644 --- a/target-lm32/op_helper.c +++ b/target-lm32/op_helper.c
@@ -76,11 +76,10 @@ from generated code or from helper.c) */ /* XXX: fix it to restore all registers */ void tlb_fill(CPULM32State *env1, target_ulong addr, int is_write, int mmu_idx, - void *retaddr) + uintptr_t retaddr) { TranslationBlock *tb; CPULM32State *saved_env; - unsigned long pc; int ret; saved_env = env; @@ -90,12 +89,11 @@ if (unlikely(ret)) { if (retaddr) { /* now we have a real cpu fault */ - pc = (unsigned long)retaddr; - tb = tb_find_pc(pc); + tb = tb_find_pc(retaddr); if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc); + cpu_restore_state(tb, env, retaddr); } } cpu_loop_exit(env);
diff --git a/target-m68k/op_helper.c b/target-m68k/op_helper.c index bc8c1f0..1971a57 100644 --- a/target-m68k/op_helper.c +++ b/target-m68k/op_helper.c
@@ -56,11 +56,10 @@ from generated code or from helper.c) */ /* XXX: fix it to restore all registers */ void tlb_fill(CPUM68KState *env1, target_ulong addr, int is_write, int mmu_idx, - void *retaddr) + uintptr_t retaddr) { TranslationBlock *tb; CPUM68KState *saved_env; - unsigned long pc; int ret; saved_env = env; @@ -69,12 +68,11 @@ if (unlikely(ret)) { if (retaddr) { /* now we have a real cpu fault */ - pc = (unsigned long)retaddr; - tb = tb_find_pc(pc); + tb = tb_find_pc(retaddr); if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc); + cpu_restore_state(tb, env, retaddr); } } cpu_loop_exit(env);
diff --git a/target-microblaze/op_helper.c b/target-microblaze/op_helper.c index a83da8d..3b1f072 100644 --- a/target-microblaze/op_helper.c +++ b/target-microblaze/op_helper.c
@@ -44,11 +44,10 @@ from generated code or from helper.c) */ /* XXX: fix it to restore all registers */ void tlb_fill(CPUMBState *env1, target_ulong addr, int is_write, int mmu_idx, - void *retaddr) + uintptr_t retaddr) { TranslationBlock *tb; CPUMBState *saved_env; - unsigned long pc; int ret; saved_env = env; @@ -58,12 +57,11 @@ if (unlikely(ret)) { if (retaddr) { /* now we have a real cpu fault */ - pc = (unsigned long)retaddr; - tb = tb_find_pc(pc); + tb = tb_find_pc(retaddr); if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc); + cpu_restore_state(tb, env, retaddr); } } cpu_loop_exit(env);
diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c index ce01225..bca1d70 100644 --- a/target-mips/op_helper.c +++ b/target-mips/op_helper.c
@@ -101,11 +101,10 @@ } #if !defined(CONFIG_USER_ONLY) -static void do_restore_state (void *pc_ptr) +static void do_restore_state(uintptr_t pc) { TranslationBlock *tb; - unsigned long pc = (unsigned long) pc_ptr; - + tb = tb_find_pc (pc); if (tb) { cpu_restore_state(tb, env, pc); @@ -2293,7 +2292,7 @@ #if !defined(CONFIG_USER_ONLY) static void QEMU_NORETURN do_unaligned_access(target_ulong addr, int is_write, - int is_user, void *retaddr); + int is_user, uintptr_t retaddr); #define MMUSUFFIX _mmu #define ALIGNED_ONLY @@ -2310,7 +2309,8 @@ #define SHIFT 3 #include "softmmu_template.h" -static void do_unaligned_access (target_ulong addr, int is_write, int is_user, void *retaddr) +static void do_unaligned_access(target_ulong addr, int is_write, + int is_user, uintptr_t retaddr) { env->CP0_BadVAddr = addr; do_restore_state (retaddr); @@ -2318,11 +2318,10 @@ } void tlb_fill(CPUMIPSState *env1, target_ulong addr, int is_write, int mmu_idx, - void *retaddr) + uintptr_t retaddr) { TranslationBlock *tb; CPUMIPSState *saved_env; - unsigned long pc; int ret; saved_env = env; @@ -2331,12 +2330,11 @@ if (ret) { if (retaddr) { /* now we have a real cpu fault */ - pc = (unsigned long)retaddr; - tb = tb_find_pc(pc); + tb = tb_find_pc(retaddr); if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc); + cpu_restore_state(tb, env, retaddr); } } helper_raise_exception_err(env->exception_index, env->error_code);
diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c index 40927b6..4ef2332 100644 --- a/target-ppc/op_helper.c +++ b/target-ppc/op_helper.c
@@ -3715,11 +3715,10 @@ from generated code or from helper.c) */ /* XXX: fix it to restore all registers */ void tlb_fill(CPUPPCState *env1, target_ulong addr, int is_write, int mmu_idx, - void *retaddr) + uintptr_t retaddr) { TranslationBlock *tb; CPUPPCState *saved_env; - unsigned long pc; int ret; saved_env = env; @@ -3728,12 +3727,11 @@ if (unlikely(ret != 0)) { if (likely(retaddr)) { /* now we have a real cpu fault */ - pc = (unsigned long)retaddr; - tb = tb_find_pc(pc); + tb = tb_find_pc(retaddr); if (likely(tb)) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc); + cpu_restore_state(tb, env, retaddr); } } helper_raise_exception_err(env->exception_index, env->error_code);
diff --git a/target-s390x/op_helper.c b/target-s390x/op_helper.c index 18fdbb2..7b72473 100644 --- a/target-s390x/op_helper.c +++ b/target-s390x/op_helper.c
@@ -57,11 +57,10 @@ from generated code or from helper.c) */ /* XXX: fix it to restore all registers */ void tlb_fill(CPUS390XState *env1, target_ulong addr, int is_write, int mmu_idx, - void *retaddr) + uintptr_t retaddr) { TranslationBlock *tb; CPUS390XState *saved_env; - unsigned long pc; int ret; saved_env = env; @@ -70,12 +69,11 @@ if (unlikely(ret != 0)) { if (likely(retaddr)) { /* now we have a real cpu fault */ - pc = (unsigned long)retaddr; - tb = tb_find_pc(pc); + tb = tb_find_pc(retaddr); if (likely(tb)) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc); + cpu_restore_state(tb, env, retaddr); } } cpu_loop_exit(env);
diff --git a/target-sh4/op_helper.c b/target-sh4/op_helper.c index 30f762f..4054791 100644 --- a/target-sh4/op_helper.c +++ b/target-sh4/op_helper.c
@@ -22,18 +22,16 @@ #include "dyngen-exec.h" #include "helper.h" -static void cpu_restore_state_from_retaddr(void *retaddr) +static void cpu_restore_state_from_retaddr(uintptr_t retaddr) { TranslationBlock *tb; - unsigned long pc; if (retaddr) { - pc = (unsigned long) retaddr; - tb = tb_find_pc(pc); + tb = tb_find_pc(retaddr); if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc); + cpu_restore_state(tb, env, retaddr); } } } @@ -56,7 +54,7 @@ #include "softmmu_template.h" void tlb_fill(CPUSH4State *env1, target_ulong addr, int is_write, int mmu_idx, - void *retaddr) + uintptr_t retaddr) { CPUSH4State *saved_env; int ret; @@ -84,7 +82,7 @@ #endif } -static inline void raise_exception(int index, void *retaddr) +static inline void raise_exception(int index, uintptr_t retaddr) { env->exception_index = index; cpu_restore_state_from_retaddr(retaddr); @@ -447,7 +445,7 @@ set_flush_to_zero((val & FPSCR_DN) != 0, &env->fp_status); } -static void update_fpscr(void *retaddr) +static void update_fpscr(uintptr_t retaddr) { int xcpt, cause, enable;
diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h index 865288c..29c63c7 100644 --- a/target-sparc/cpu.h +++ b/target-sparc/cpu.h
@@ -702,7 +702,7 @@ #endif void QEMU_NORETURN do_unaligned_access(CPUSPARCState *env, target_ulong addr, int is_write, int is_user, - void *retaddr); + uintptr_t retaddr); #define TB_FLAG_FPU_ENABLED (1 << 4) #define TB_FLAG_AM_ENABLED (1 << 5)
diff --git a/target-sparc/ldst_helper.c b/target-sparc/ldst_helper.c index 1418205..04ffddf 100644 --- a/target-sparc/ldst_helper.c +++ b/target-sparc/ldst_helper.c
@@ -2376,25 +2376,23 @@ #if !defined(CONFIG_USER_ONLY) /* XXX: make it generic ? */ -static void cpu_restore_state2(CPUSPARCState *env, void *retaddr) +static void cpu_restore_state2(CPUSPARCState *env, uintptr_t retaddr) { TranslationBlock *tb; - unsigned long pc; if (retaddr) { /* now we have a real cpu fault */ - pc = (unsigned long)retaddr; - tb = tb_find_pc(pc); + tb = tb_find_pc(retaddr); if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc); + cpu_restore_state(tb, env, retaddr); } } } void do_unaligned_access(CPUSPARCState *env, target_ulong addr, int is_write, - int is_user, void *retaddr) + int is_user, uintptr_t retaddr) { #ifdef DEBUG_UNALIGNED printf("Unaligned access to 0x" TARGET_FMT_lx " from 0x" TARGET_FMT_lx @@ -2409,7 +2407,7 @@ from generated code or from helper.c) */ /* XXX: fix it to restore all registers */ void tlb_fill(CPUSPARCState *env, target_ulong addr, int is_write, int mmu_idx, - void *retaddr) + uintptr_t retaddr) { int ret;
diff --git a/target-xtensa/op_helper.c b/target-xtensa/op_helper.c index 806384f..a6dd72d 100644 --- a/target-xtensa/op_helper.c +++ b/target-xtensa/op_helper.c
@@ -31,7 +31,7 @@ #include "host-utils.h" static void do_unaligned_access(target_ulong addr, int is_write, int is_user, - void *retaddr); + uintptr_t retaddr); #define ALIGNED_ONLY #define MMUSUFFIX _mmu @@ -48,10 +48,9 @@ #define SHIFT 3 #include "softmmu_template.h" -static void do_restore_state(void *pc_ptr) +static void do_restore_state(uintptr_t pc) { TranslationBlock *tb; - uint32_t pc = (uint32_t)(intptr_t)pc_ptr; tb = tb_find_pc(pc); if (tb) { @@ -60,7 +59,7 @@ } static void do_unaligned_access(target_ulong addr, int is_write, int is_user, - void *retaddr) + uintptr_t retaddr) { if (xtensa_option_enabled(env->config, XTENSA_OPTION_UNALIGNED_EXCEPTION) && !xtensa_option_enabled(env->config, XTENSA_OPTION_HW_ALIGNMENT)) { @@ -71,7 +70,7 @@ } void tlb_fill(CPUXtensaState *env1, target_ulong vaddr, int is_write, int mmu_idx, - void *retaddr) + uintptr_t retaddr) { CPUXtensaState *saved_env = env;
diff --git a/user-exec.c b/user-exec.c index cd905ff..be6bc4f 100644 --- a/user-exec.c +++ b/user-exec.c
@@ -82,7 +82,7 @@ the effective address of the memory exception. 'is_write' is 1 if a write caused the exception and otherwise 0'. 'old_set' is the signal set which should be restored */ -static inline int handle_cpu_signal(unsigned long pc, unsigned long address, +static inline int handle_cpu_signal(uintptr_t pc, unsigned long address, int is_write, sigset_t *old_set, void *puc) {