From 9bd54a4a6723d6b0ab25bb7a3e751d05a6a80d00 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Sat, 1 Aug 2009 22:57:46 +0200 Subject: [PATCH] More unsigned long -> uintptr_t fixes. --- cpu-exec.c | 64 ++++++++++++++++++++++++------------------------ target-mips/op_helper.c | 2 +- target-sparc/op_helper.c | 2 +- targphys.h | 2 +- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index 9646e70d08..1c9f29169c 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -781,7 +781,7 @@ void cpu_x86_frstor(CPUX86State *s, target_ulong ptr, int data32) 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, uintptr_t address, int is_write, sigset_t *old_set, void *puc) { @@ -831,7 +831,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, } #elif defined(TARGET_ARM) -static inline int handle_cpu_signal(unsigned long pc, unsigned long address, +static inline int handle_cpu_signal(uintptr_t pc, uintptr_t address, int is_write, sigset_t *old_set, void *puc) { @@ -869,7 +869,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, return 1; } #elif defined(TARGET_SPARC) -static inline int handle_cpu_signal(unsigned long pc, unsigned long address, +static inline int handle_cpu_signal(uintptr_t pc, uintptr_t address, int is_write, sigset_t *old_set, void *puc) { @@ -907,7 +907,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, return 1; } #elif defined (TARGET_PPC) -static inline int handle_cpu_signal(unsigned long pc, unsigned long address, +static inline int handle_cpu_signal(uintptr_t pc, uintptr_t address, int is_write, sigset_t *old_set, void *puc) { @@ -957,7 +957,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, } #elif defined(TARGET_M68K) -static inline int handle_cpu_signal(unsigned long pc, unsigned long address, +static inline int handle_cpu_signal(uintptr_t pc, uintptr_t address, int is_write, sigset_t *old_set, void *puc) { @@ -996,7 +996,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, } #elif defined (TARGET_MIPS) -static inline int handle_cpu_signal(unsigned long pc, unsigned long address, +static inline int handle_cpu_signal(uintptr_t pc, uintptr_t address, int is_write, sigset_t *old_set, void *puc) { @@ -1046,7 +1046,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, } #elif defined (TARGET_MICROBLAZE) -static inline int handle_cpu_signal(unsigned long pc, unsigned long address, +static inline int handle_cpu_signal(uintptr_t pc, uintptr_t address, int is_write, sigset_t *old_set, void *puc) { @@ -1096,7 +1096,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, } #elif defined (TARGET_SH4) -static inline int handle_cpu_signal(unsigned long pc, unsigned long address, +static inline int handle_cpu_signal(uintptr_t pc, uintptr_t address, int is_write, sigset_t *old_set, void *puc) { @@ -1141,7 +1141,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, } #elif defined (TARGET_ALPHA) -static inline int handle_cpu_signal(unsigned long pc, unsigned long address, +static inline int handle_cpu_signal(uintptr_t pc, uintptr_t address, int is_write, sigset_t *old_set, void *puc) { @@ -1185,7 +1185,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, return 1; } #elif defined (TARGET_CRIS) -static inline int handle_cpu_signal(unsigned long pc, unsigned long address, +static inline int handle_cpu_signal(uintptr_t pc, uintptr_t address, int is_write, sigset_t *old_set, void *puc) { @@ -1234,7 +1234,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, #if defined(__APPLE__) # include -# define EIP_sig(context) (*((unsigned long*)&(context)->uc_mcontext->ss.eip)) +# define EIP_sig(context) (*((uintptr_t*)&(context)->uc_mcontext->ss.eip)) # define TRAP_sig(context) ((context)->uc_mcontext->es.trapno) # define ERROR_sig(context) ((context)->uc_mcontext->es.err) # define MASK_sig(context) ((context)->uc_sigmask) @@ -1259,7 +1259,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, #else struct ucontext *uc = puc; #endif - unsigned long pc; + uintptr_t pc; int trapno; #ifndef REG_EIP @@ -1270,7 +1270,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, #endif pc = EIP_sig(uc); trapno = TRAP_sig(uc); - return handle_cpu_signal(pc, (unsigned long)info->si_addr, + return handle_cpu_signal(pc, (uintptr_t)info->si_addr, trapno == 0xe ? (ERROR_sig(uc) >> 1) & 1 : 0, &MASK_sig(uc), puc); @@ -1299,7 +1299,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, void *puc) { siginfo_t *info = pinfo; - unsigned long pc; + uintptr_t pc; #ifdef __NetBSD__ ucontext_t *uc = puc; #elif defined(__OpenBSD__) @@ -1309,7 +1309,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, #endif pc = PC_sig(uc); - return handle_cpu_signal(pc, (unsigned long)info->si_addr, + return handle_cpu_signal(pc, (uintptr_t)info->si_addr, TRAP_sig(uc) == 0xe ? (ERROR_sig(uc) >> 1) & 1 : 0, &MASK_sig(uc), puc); @@ -1384,7 +1384,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, if (TRAP_sig(uc) != 0x400 && (DSISR_sig(uc) & 0x02000000)) is_write = 1; #endif - return handle_cpu_signal(pc, (unsigned long)info->si_addr, + return handle_cpu_signal(pc, (uintptr_t)info->si_addr, is_write, &uc->uc_sigmask, puc); } @@ -1415,7 +1415,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, is_write = 1; } - return handle_cpu_signal(pc, (unsigned long)info->si_addr, + return handle_cpu_signal(pc, (uintptr_t)info->si_addr, is_write, &uc->uc_sigmask, puc); } #elif defined(__sparc__) @@ -1430,15 +1430,15 @@ int cpu_signal_handler(int host_signum, void *pinfo, uint32_t *regs = (uint32_t *)(info + 1); void *sigmask = (regs + 20); /* XXX: is there a standard glibc define ? */ - unsigned long pc = regs[1]; + uintptr_t pc = regs[1]; #else #ifdef __linux__ struct sigcontext *sc = puc; - unsigned long pc = sc->sigc_regs.tpc; + uintptr_t pc = sc->sigc_regs.tpc; void *sigmask = (void *)sc->sigc_mask; #elif defined(__OpenBSD__) struct sigcontext *uc = puc; - unsigned long pc = uc->sc_pc; + uintptr_t pc = uc->sc_pc; void *sigmask = (void *)(long)uc->sc_mask; #endif #endif @@ -1471,7 +1471,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, break; } } - return handle_cpu_signal(pc, (unsigned long)info->si_addr, + return handle_cpu_signal(pc, (uintptr_t)info->si_addr, is_write, sigmask, NULL); } @@ -1482,7 +1482,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, { siginfo_t *info = pinfo; struct ucontext *uc = puc; - unsigned long pc; + uintptr_t pc; int is_write; #if (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3)) @@ -1492,7 +1492,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, #endif /* XXX: compute is_write */ is_write = 0; - return handle_cpu_signal(pc, (unsigned long)info->si_addr, + return handle_cpu_signal(pc, (uintptr_t)info->si_addr, is_write, &uc->uc_sigmask, puc); } @@ -1504,13 +1504,13 @@ int cpu_signal_handler(int host_signum, void *pinfo, { siginfo_t *info = pinfo; struct ucontext *uc = puc; - unsigned long pc; + uintptr_t pc; int is_write; pc = uc->uc_mcontext.gregs[16]; /* XXX: compute is_write */ is_write = 0; - return handle_cpu_signal(pc, (unsigned long)info->si_addr, + return handle_cpu_signal(pc, (uintptr_t)info->si_addr, is_write, &uc->uc_sigmask, puc); } @@ -1526,7 +1526,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, void *puc) { siginfo_t *info = pinfo; struct ucontext *uc = puc; - unsigned long ip; + uintptr_t ip; int is_write = 0; ip = uc->uc_mcontext.sc_ip; @@ -1544,7 +1544,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, void *puc) default: break; } - return handle_cpu_signal(ip, (unsigned long)info->si_addr, + return handle_cpu_signal(ip, (uintptr_t)info->si_addr, is_write, &uc->uc_sigmask, puc); } @@ -1556,13 +1556,13 @@ int cpu_signal_handler(int host_signum, void *pinfo, { siginfo_t *info = pinfo; struct ucontext *uc = puc; - unsigned long pc; + uintptr_t pc; int is_write; pc = uc->uc_mcontext.psw.addr; /* XXX: compute is_write */ is_write = 0; - return handle_cpu_signal(pc, (unsigned long)info->si_addr, + return handle_cpu_signal(pc, (uintptr_t)info->si_addr, is_write, &uc->uc_sigmask, puc); } @@ -1578,7 +1578,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, /* XXX: compute is_write */ is_write = 0; - return handle_cpu_signal(pc, (unsigned long)info->si_addr, + return handle_cpu_signal(pc, (uintptr_t)info->si_addr, is_write, &uc->uc_sigmask, puc); } @@ -1589,13 +1589,13 @@ int cpu_signal_handler(int host_signum, void *pinfo, { struct siginfo *info = pinfo; struct ucontext *uc = puc; - unsigned long pc; + uintptr_t pc; int is_write; pc = uc->uc_mcontext.sc_iaoq[0]; /* FIXME: compute is_write */ is_write = 0; - return handle_cpu_signal(pc, (unsigned long)info->si_addr, + return handle_cpu_signal(pc, (uintptr_t)info->si_addr, is_write, &uc->uc_sigmask, puc); } diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c index f99bf24a69..6d7ccf36b1 100644 --- a/target-mips/op_helper.c +++ b/target-mips/op_helper.c @@ -57,7 +57,7 @@ void helper_interrupt_restart (void) static void do_restore_state (void *pc_ptr) { TranslationBlock *tb; - unsigned long pc = (unsigned long) pc_ptr; + uintptr_t pc = (uintptr_t) pc_ptr; tb = tb_find_pc (pc); if (tb) { diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c index 0234e519ec..9a73e925b8 100644 --- a/target-sparc/op_helper.c +++ b/target-sparc/op_helper.c @@ -3612,7 +3612,7 @@ static void cpu_restore_state2(void *retaddr) if (retaddr) { /* now we have a real cpu fault */ - pc = (unsigned long)retaddr; + pc = (uintptr_t)retaddr; tb = tb_find_pc(pc); if (tb) { /* the PC is inside the translated code. It means that we have diff --git a/targphys.h b/targphys.h index 99ab23c7a7..65025c2f83 100644 --- a/targphys.h +++ b/targphys.h @@ -6,7 +6,7 @@ #ifdef TARGET_PHYS_ADDR_BITS /* target_phys_addr_t is the type of a physical address (its size can be different from 'target_ulong'). We have sizeof(target_phys_addr) - = max(sizeof(unsigned long), + = max(sizeof(uintptr_t), sizeof(size_of_target_physical_address)) because we must pass a host pointer to memory operations in some cases */ -- 2.11.4.GIT