From: Nicholas Nethercote Date: Thu, 4 Nov 2004 18:03:06 +0000 (+0000) Subject: 64-bit cleanness: lots more replacing of UInt with UWord as necessary. X-Git-Tag: svn/VALGRIND_3_0_0~1391 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6451cc22a24891a03a2a774131085e5b4eb3d4d4;p=thirdparty%2Fvalgrind.git 64-bit cleanness: lots more replacing of UInt with UWord as necessary. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2920 --- diff --git a/coregrind/vg_execontext.c b/coregrind/vg_execontext.c index e9e808798b..286f946ca9 100644 --- a/coregrind/vg_execontext.c +++ b/coregrind/vg_execontext.c @@ -236,7 +236,7 @@ ExeContext* VG_(get_ExeContext2) ( Addr ip, Addr fp, Int i; Addr ips[VG_DEEPEST_BACKTRACE]; Bool same; - UInt hash; + UWord hash; ExeContext* new_ec; ExeContext* list; @@ -254,7 +254,7 @@ ExeContext* VG_(get_ExeContext2) ( Addr ip, Addr fp, hash = 0; for (i = 0; i < VG_(clo_backtrace_size); i++) { - hash ^= (UInt)ips[i]; + hash ^= ips[i]; hash = (hash << 29) | (hash >> 3); } hash = hash % VG_N_EC_LISTS; diff --git a/coregrind/vg_hashtable.c b/coregrind/vg_hashtable.c index 9df208072d..697891a27e 100644 --- a/coregrind/vg_hashtable.c +++ b/coregrind/vg_hashtable.c @@ -38,7 +38,7 @@ #define VG_N_CHAINS 4999 /* a prime number */ -#define VG_CHAIN_NO(aa) (((UInt)(aa)) % VG_N_CHAINS) +#define VG_CHAIN_NO(aa) (((UWord)(aa)) % VG_N_CHAINS) /*--------------------------------------------------------------------*/ /*--- Functions ---*/ diff --git a/coregrind/vg_memory.c b/coregrind/vg_memory.c index fad9c8ab36..8969b4b476 100644 --- a/coregrind/vg_memory.c +++ b/coregrind/vg_memory.c @@ -603,7 +603,7 @@ void VG_(unpad_address_space)(void) while (s && addr <= VG_(valgrind_last)) { if (addr < s->addr) { - ret = VG_(do_syscall)(__NR_munmap, (UInt)addr, s->addr - addr); + ret = VG_(do_syscall)(__NR_munmap, addr, s->addr - addr); } addr = s->addr + s->len; diff --git a/coregrind/vg_mylibc.c b/coregrind/vg_mylibc.c index 69b75111a3..4d698f5893 100644 --- a/coregrind/vg_mylibc.c +++ b/coregrind/vg_mylibc.c @@ -73,7 +73,7 @@ Bool VG_(isfullsigset)( vki_sigset_t* set ) Int i; vg_assert(set != NULL); for (i = 0; i < _VKI_NSIG_WORDS; i++) - if (set->sig[i] != (UInt)(~0x0)) return False; + if (set->sig[i] != (UWord)(~0x0)) return False; return True; } @@ -136,25 +136,22 @@ void VG_(sigdelset_from_set)( vki_sigset_t* dst, vki_sigset_t* src ) /* The functions sigaction, sigprocmask, sigpending and sigsuspend return 0 on success and -1 on error. */ -Int VG_(sigprocmask)( Int how, - const vki_sigset_t* set, - vki_sigset_t* oldset) +Int VG_(sigprocmask)( Int how, const vki_sigset_t* set, vki_sigset_t* oldset) { Int res = VG_(do_syscall)(__NR_rt_sigprocmask, - how, (UInt)set, (UInt)oldset, + how, (UWord)set, (UWord)oldset, _VKI_NSIG_WORDS * sizeof(UWord)); return VG_(is_kerror)(res) ? -1 : 0; } -Int VG_(sigaction) ( Int signum, - const struct vki_sigaction* act, - struct vki_sigaction* oldact) +Int VG_(sigaction) ( Int signum, const struct vki_sigaction* act, + struct vki_sigaction* oldact) { Int res = VG_(do_syscall)(__NR_rt_sigaction, - signum, (UInt)act, (UInt)oldact, + signum, (UWord)act, (UWord)oldact, _VKI_NSIG_WORDS * sizeof(UWord)); /* VG_(printf)("res = %d\n",res); */ return VG_(is_kerror)(res) ? -1 : 0; @@ -185,7 +182,7 @@ Int VG_(signal)(Int signum, void (*sighandler)(Int)) res = VG_(sigemptyset)( &sa.sa_mask ); vg_assert(res == 0); res = VG_(do_syscall)(__NR_rt_sigaction, - signum, (UInt)(&sa), (UInt)NULL, + signum, (UWord)&sa, (UWord)NULL, _VKI_NSIG_WORDS * sizeof(UWord)); return VG_(is_kerror)(res) ? -1 : 0; } @@ -575,7 +572,7 @@ VG_(vprintf) ( void(*send)(Char), const Char *format, va_list vargs ) send('0'); send('x'); ret += myvprintf_int64(send, flags, 16, width, - (ULong)((UInt)va_arg (vargs, void *))); + (ULong)((UWord)va_arg (vargs, void *))); break; case 'x': /* %x */ if (is_long) @@ -1638,7 +1635,7 @@ Int VG_(system) ( Char* cmd ) argv[3] = 0; (void)VG_(do_syscall)(__NR_execve, - (UInt)"/bin/sh", (UInt)argv, (UInt)envp); + (UWord)"/bin/sh", (UWord)argv, (UWord)envp); /* If we're still alive here, execve failed. */ VG_(exit)(1); @@ -1690,7 +1687,7 @@ void* VG_(get_memory_from_mmap) ( SizeT nBytes, Char* who ) if (p != ((void*)(-1))) { vg_assert((void*)VG_(valgrind_base) <= p && p <= (void*)VG_(valgrind_last)); - tot_alloc += (UInt)nBytes; + tot_alloc += nBytes; if (0) VG_(printf)( "get_memory_from_mmap: %llu tot, %llu req = %p .. %p, caller %s\n", diff --git a/coregrind/vg_scheduler.c b/coregrind/vg_scheduler.c index c3ffdac301..4c713db094 100644 --- a/coregrind/vg_scheduler.c +++ b/coregrind/vg_scheduler.c @@ -981,7 +981,7 @@ VgSchedReturnCode do_scheduler ( Int* exitcode, ThreadId* last_run_tid ) } VG_(nuke_all_threads_except) ( tid ); ARCH_INSTR_PTR(VG_(threads)[tid].arch) = - (UInt)__libc_freeres_wrapper; + __libc_freeres_wrapper; vg_assert(VG_(threads)[tid].status == VgTs_Runnable); goto stage1; /* party on, dudes (but not for much longer :) */ @@ -1197,10 +1197,10 @@ void make_thread_jump_to_cancelhdlr ( ThreadId tid ) /* Set an argument and bogus return address. The return address will not be used, but we still need to have it so that the arg is at the correct stack offset. */ - VGA_(set_arg_and_bogus_ret)(tid, (UInt)PTHREAD_CANCELED, 0xBEADDEEF); + VGA_(set_arg_and_bogus_ret)(tid, (UWord)PTHREAD_CANCELED, 0xBEADDEEF); /* .cancel_pend will hold &thread_exit_wrapper */ - ARCH_INSTR_PTR(VG_(threads)[tid].arch) = (UInt)VG_(threads)[tid].cancel_pend; + ARCH_INSTR_PTR(VG_(threads)[tid].arch) = (UWord)VG_(threads)[tid].cancel_pend; VG_(proxy_abort_syscall)(tid); @@ -1843,7 +1843,7 @@ void do__apply_in_new_thread ( ThreadId parent_tid, (Addr)&do__apply_in_new_thread_bogusRA); /* this is where we start */ - ARCH_INSTR_PTR(VG_(threads)[tid].arch) = (UInt)fn; + ARCH_INSTR_PTR(VG_(threads)[tid].arch) = (UWord)fn; if (VG_(clo_trace_sched)) { VG_(sprintf)(msg_buf, "new thread, created by %d", parent_tid ); @@ -2574,7 +2574,7 @@ void do_pthread_getspecific_ptr ( ThreadId tid ) vg_assert(specifics_ptr == NULL || IS_ALIGNED4_ADDR(specifics_ptr)); - SET_PTHREQ_RETVAL(tid, (UInt)specifics_ptr); + SET_PTHREQ_RETVAL(tid, (UWord)specifics_ptr); } @@ -2926,7 +2926,7 @@ void do_client_request ( ThreadId tid, UInt* arg ) case VG_USERREQ__MALLOC: VG_(sk_malloc_called_by_scheduler) = True; SET_PTHREQ_RETVAL( - tid, (UInt)SK_(malloc) ( arg[1] ) + tid, (Addr)SK_(malloc) ( arg[1] ) ); VG_(sk_malloc_called_by_scheduler) = False; break; diff --git a/coregrind/vg_signals.c b/coregrind/vg_signals.c index 209f619a8d..f0b8343f45 100644 --- a/coregrind/vg_signals.c +++ b/coregrind/vg_signals.c @@ -543,8 +543,8 @@ void VG_(do__NR_sigaction) ( ThreadId tid ) if (VG_(clo_trace_signals)) VG_(message)(Vg_DebugExtraMsg, "__NR_sigaction: tid %d, sigNo %d, " - "new 0x%x, old 0x%x, new flags 0x%x", - tid, signo, (UInt)new_act, (UInt)old_act, + "new %p, old %p, new flags 0x%x", + tid, signo, (UWord)new_act, (UWord)old_act, (UInt)(new_act ? new_act->sa_flags : 0) ); /* Rule out various error conditions. The aim is to ensure that if diff --git a/coregrind/vg_syscalls.c b/coregrind/vg_syscalls.c index db96c1f43a..f7ad5b1806 100644 --- a/coregrind/vg_syscalls.c +++ b/coregrind/vg_syscalls.c @@ -1489,7 +1489,7 @@ PRE(sched_setscheduler) /* int sched_setscheduler(pid_t pid, int policy, const struct sched_param *p); */ MAYBE_PRINTF("sched_setscheduler ( %d, %d, %p )\n",arg1,arg2,arg3); - if (arg3 != (UInt)NULL) + if (arg3 != (UWord)NULL) SYSCALL_TRACK( pre_mem_read, tid, "sched_setscheduler(struct sched_param *p)", arg3, sizeof(struct vki_sched_param)); @@ -1572,7 +1572,7 @@ PRE(sendfile) /* ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count) */ MAYBE_PRINTF("sendfile ( %d, %d, %p, %llu )\n",arg1,arg2,arg3,(ULong)arg4); - if (arg3 != (UInt)NULL) + if (arg3 != (UWord)NULL) SYSCALL_TRACK( pre_mem_write, tid, "sendfile(offset)", arg3, sizeof(vki_off_t) ); } @@ -1587,14 +1587,14 @@ PRE(sendfile64) /* ssize_t sendfile64(int out_df, int in_fd, loff_t *offset, size_t count); */ MAYBE_PRINTF("sendfile64 ( %d, %d, %p, %llu )\n",arg1,arg2,arg3,(ULong)arg4); - if (arg3 != (UInt)NULL) + if (arg3 != (UWord)NULL) SYSCALL_TRACK( pre_mem_write, tid, "sendfile64(offset)", arg3, sizeof(vki_loff_t) ); } POST(sendfile64) { - if (arg3 != (UInt)NULL ) { + if (arg3 != (UWord)NULL ) { VG_TRACK( post_mem_write, arg3, sizeof(vki_loff_t) ); } } @@ -1734,9 +1734,9 @@ PRE(execve) MAYBE_PRINTF("execve ( %p(%s), %p, %p )\n", arg1, arg1, arg2, arg3); SYSCALL_TRACK( pre_mem_read_asciiz, tid, "execve(filename)", arg1 ); - if (arg2 != (UInt)NULL) + if (arg2 != (UWord)NULL) pre_argv_envp( arg2, tid, "execve(argv)", "execve(argv[i])" ); - if (arg3 != (UInt)NULL) + if (arg3 != (UWord)NULL) pre_argv_envp( arg3, tid, "execve(envp)", "execve(envp[i])" ); /* Erk. If the exec fails, then the following will have made a @@ -2517,7 +2517,7 @@ PRE(ipc) case 4: /* IPCOP_semtimedop */ SYSCALL_TRACK( pre_mem_read, tid, "semtimedop(sops)", arg5, arg3 * sizeof(struct vki_sembuf) ); - if (arg6 != (UInt)NULL) + if (arg6 != (UWord)NULL) SYSCALL_TRACK( pre_mem_read, tid, "semtimedop(timeout)", arg6, sizeof(struct vki_timespec) ); tst->sys_flags |= MayBlock; @@ -3112,7 +3112,7 @@ PRE(ioctl) // buf pointer only needs to be readable struct vki_ifconf *ifc = (struct vki_ifconf *) arg3; SYSCALL_TRACK( pre_mem_write,tid, "ioctl(SIOCGIFCONF).ifc_buf", - (Addr)(ifc->vki_ifc_buf), (UInt)(ifc->ifc_len) ); + (Addr)(ifc->vki_ifc_buf), ifc->ifc_len ); } break; case VKI_SIOCGSTAMP: @@ -3388,8 +3388,7 @@ PRE(ioctl) /* ToDo: don't do any of the following if the structure is invalid */ struct vki_cdrom_read_audio *cra = (struct vki_cdrom_read_audio *) arg3; SYSCALL_TRACK( pre_mem_write, tid, "ioctl(CDROMREADAUDIO).buf", - (Addr)(cra->buf), - (UInt)(cra->nframes * VKI_CD_FRAMESIZE_RAW)); + (Addr)cra->buf, cra->nframes * VKI_CD_FRAMESIZE_RAW); } break; case VKI_CDROMPLAYMSF: @@ -3730,8 +3729,7 @@ POST(ioctl) if (res == 0 && arg3 ) { struct vki_ifconf *ifc = (struct vki_ifconf *) arg3; if (ifc->vki_ifc_buf != NULL) - VG_TRACK( post_mem_write, (Addr)(ifc->vki_ifc_buf), - (UInt)(ifc->ifc_len) ); + VG_TRACK( post_mem_write, (Addr)(ifc->vki_ifc_buf), ifc->ifc_len ); } break; case VKI_SIOCGSTAMP: @@ -3885,7 +3883,7 @@ POST(ioctl) { struct vki_cdrom_read_audio *cra = (struct vki_cdrom_read_audio *) arg3; VG_TRACK( post_mem_write, (Addr)(cra->buf), - (UInt)(cra->nframes * VKI_CD_FRAMESIZE_RAW)); + cra->nframes * VKI_CD_FRAMESIZE_RAW); break; } @@ -4201,14 +4199,14 @@ PRE(nanosleep) MAYBE_PRINTF("nanosleep ( %p, %p )\n", arg1,arg2); SYSCALL_TRACK( pre_mem_read, tid, "nanosleep(req)", arg1, sizeof(struct vki_timespec) ); - if (arg2 != (UInt)NULL) + if (arg2 != (UWord)NULL) SYSCALL_TRACK( pre_mem_write, tid, "nanosleep(rem)", arg2, sizeof(struct vki_timespec) ); } POST(nanosleep) { - if (arg2 != (UInt)NULL && res == -VKI_EINTR) + if (arg2 != (UWord)NULL && res == -VKI_EINTR) VG_TRACK( post_mem_write, arg2, sizeof(struct vki_timespec) ); } @@ -4990,7 +4988,7 @@ POST(socketcall) case VKI_SYS_RECV: if (res >= 0 - && ((UInt*)arg2)[1] != (UInt)NULL) { + && ((UInt*)arg2)[1] != (UWord)NULL) { VG_TRACK( post_mem_write, ((UInt*)arg2)[1], /* buf */ ((UInt*)arg2)[2] /* len */ ); } @@ -5149,14 +5147,14 @@ PRE(time) { /* time_t time(time_t *t); */ MAYBE_PRINTF("time ( %p )\n",arg1); - if (arg1 != (UInt)NULL) { + if (arg1 != (UWord)NULL) { SYSCALL_TRACK( pre_mem_write, tid, "time", arg1, sizeof(vki_time_t) ); } } POST(time) { - if (arg1 != (UInt)NULL) { + if (arg1 != (UWord)NULL) { VG_TRACK( post_mem_write, arg1, sizeof(vki_time_t) ); } } @@ -5171,7 +5169,7 @@ PRE(times) POST(times) { - if (arg1 != (UInt)NULL) { + if (arg1 != (UWord)NULL) { VG_TRACK( post_mem_write, arg1, sizeof(struct vki_tms) ); } } @@ -5206,7 +5204,7 @@ PRE(uname) POST(uname) { - if (arg1 != (UInt)NULL) { + if (arg1 != (UWord)NULL) { VG_TRACK( post_mem_write, arg1, sizeof(struct vki_new_utsname) ); } } @@ -5216,7 +5214,7 @@ PRE(utime) /* int utime(const char *filename, struct utimbuf *buf); */ MAYBE_PRINTF("utime ( %p, %p )\n", arg1,arg2); SYSCALL_TRACK( pre_mem_read_asciiz, tid, "utime(filename)", arg1 ); - if (arg2 != (UInt)NULL) + if (arg2 != (UWord)NULL) SYSCALL_TRACK( pre_mem_read, tid, "utime(buf)", arg2, sizeof(struct vki_utimbuf) ); } @@ -5322,7 +5320,7 @@ PRE(utimes) /* int utimes(const char *filename, struct timeval *tvp); */ MAYBE_PRINTF("utimes ( %p, %p )\n", arg1,arg2); SYSCALL_TRACK( pre_mem_read_asciiz, tid, "utimes(filename)", arg1 ); - if (arg2 != (UInt)NULL) + if (arg2 != (UWord)NULL) SYSCALL_TRACK( pre_mem_read, tid, "utimes(tvp)", arg2, sizeof(struct vki_timeval) ); } @@ -5332,7 +5330,7 @@ PRE(futex) /* int futex(void *futex, int op, int val, const struct timespec *timeout); */ MAYBE_PRINTF("futex ( %p, %d, %d, %p, %p )\n", arg1,arg2,arg3,arg4,arg5); SYSCALL_TRACK( pre_mem_read, tid, "futex(futex)", arg1, sizeof(int) ); - if (arg2 == VKI_FUTEX_WAIT && arg4 != (UInt)NULL) + if (arg2 == VKI_FUTEX_WAIT && arg4 != (UWord)NULL) SYSCALL_TRACK( pre_mem_read, tid, "futex(timeout)", arg4, sizeof(struct vki_timespec) ); if (arg2 == VKI_FUTEX_REQUEUE) @@ -5405,17 +5403,17 @@ PRE(rt_sigtimedwait) /* int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec timeout); */ MAYBE_PRINTF("sigtimedwait ( %p, %p, timeout )\n", arg1, arg2); - if (arg1 != (UInt)NULL) + if (arg1 != (UWord)NULL) SYSCALL_TRACK( pre_mem_read, tid, "sigtimedwait(set)", arg1, sizeof(vki_sigset_t)); - if (arg2 != (UInt)NULL) + if (arg2 != (UWord)NULL) SYSCALL_TRACK( pre_mem_write, tid, "sigtimedwait(info)", arg2, sizeof(vki_siginfo_t) ); } POST(rt_sigtimedwait) { - if (arg2 != (UInt)NULL) + if (arg2 != (UWord)NULL) VG_TRACK( post_mem_write, arg2, sizeof(vki_siginfo_t) ); } @@ -5423,7 +5421,7 @@ PRE(rt_sigqueueinfo) { /* long sys_rt_sigqueueinfo(int pid, int sig, siginfo_t *uinfo) */ MAYBE_PRINTF("rt_sigqueueinfo(%d, %d, %p)\n", arg1, arg2, arg3); - if (arg2 != (UInt)NULL) + if (arg2 != (UWord)NULL) SYSCALL_TRACK( pre_mem_read, tid, "sigqueueinfo(uinfo)", arg3, sizeof(vki_siginfo_t) ); } @@ -5443,11 +5441,11 @@ PRE(sigaltstack) { /* int sigaltstack(const stack_t *ss, stack_t *oss); */ MAYBE_PRINTF("sigaltstack ( %p, %p )\n",arg1,arg2); - if (arg1 != (UInt)NULL) { + if (arg1 != (UWord)NULL) { SYSCALL_TRACK( pre_mem_read, tid, "sigaltstack(ss)", arg1, sizeof(vki_stack_t) ); } - if (arg2 != (UInt)NULL) { + if (arg2 != (UWord)NULL) { SYSCALL_TRACK( pre_mem_write, tid, "sigaltstack(oss)", arg2, sizeof(vki_stack_t) ); } @@ -5458,7 +5456,7 @@ PRE(sigaltstack) POST(sigaltstack) { - if (res == 0 && arg2 != (UInt)NULL) + if (res == 0 && arg2 != (UWord)NULL) VG_TRACK( post_mem_write, arg2, sizeof(vki_stack_t)); } @@ -5467,10 +5465,10 @@ PRE(sigaction) /* int sigaction(int signum, struct k_sigaction *act, struct k_sigaction *oldact); */ MAYBE_PRINTF("sigaction ( %d, %p, %p )\n",arg1,arg2,arg3); - if (arg2 != (UInt)NULL) + if (arg2 != (UWord)NULL) SYSCALL_TRACK( pre_mem_read, tid, "sigaction(act)", arg2, sizeof(struct vki_sigaction)); - if (arg3 != (UInt)NULL) + if (arg3 != (UWord)NULL) SYSCALL_TRACK( pre_mem_write, tid, "sigaction(oldact)", arg3, sizeof(struct vki_sigaction)); @@ -5480,7 +5478,7 @@ PRE(sigaction) POST(sigaction) { - if (res == 0 && arg3 != (UInt)NULL) + if (res == 0 && arg3 != (UWord)NULL) VG_TRACK( post_mem_write, arg3, sizeof(struct vki_sigaction)); } @@ -5492,10 +5490,10 @@ PRE(sigprocmask) /* int sigprocmask(int how, k_sigset_t *set, k_sigset_t *oldset); */ MAYBE_PRINTF("sigprocmask ( %d, %p, %p )\n",arg1,arg2,arg3); - if (arg2 != (UInt)NULL) + if (arg2 != (UWord)NULL) SYSCALL_TRACK( pre_mem_read, tid, "sigprocmask(set)", arg2, sizeof(vki_sigset_t)); - if (arg3 != (UInt)NULL) + if (arg3 != (UWord)NULL) SYSCALL_TRACK( pre_mem_write, tid, "sigprocmask(oldset)", arg3, sizeof(vki_sigset_t)); @@ -5508,7 +5506,7 @@ PRE(sigprocmask) POST(sigprocmask) { - if (res == 0 && arg3 != (UInt)NULL) + if (res == 0 && arg3 != (UWord)NULL) VG_TRACK( post_mem_write, arg3, sizeof(vki_sigset_t)); } @@ -5588,7 +5586,7 @@ PRE(io_getevents) if (arg3 > 0) SYSCALL_TRACK( pre_mem_write, tid, "io_getevents(events)", arg4, sizeof(struct vki_io_event)*arg3 ); - if (arg5 != (UInt)NULL) + if (arg5 != (UWord)NULL) SYSCALL_TRACK( pre_mem_read, tid, "io_getevents(timeout)", arg5, sizeof(struct vki_timespec)); } @@ -5601,7 +5599,7 @@ POST(io_getevents) VG_TRACK( post_mem_write, arg4, sizeof(struct vki_io_event)*res ); for (i = 0; i < res; i++) { const struct vki_io_event *vev = ((struct vki_io_event *)arg4) + i; - const struct vki_iocb *cb = (struct vki_iocb *)(UInt)vev->obj; + const struct vki_iocb *cb = (struct vki_iocb *)(Addr)vev->obj; switch (cb->aio_lio_opcode) { case VKI_IOCB_CMD_PREAD: diff --git a/coregrind/vg_transtab.c b/coregrind/vg_transtab.c index 132f0db8de..eaca9729b0 100644 --- a/coregrind/vg_transtab.c +++ b/coregrind/vg_transtab.c @@ -238,7 +238,7 @@ void add_tt_entry ( TCEntry* tce ) UInt i; /* VG_(printf)("add_TT_entry orig_addr %p\n", tce->orig_addr); */ /* Hash to get initial probe point. */ - i = ((UInt)(tce->orig_addr)) % VG_TT_SIZE; + i = tce->orig_addr % VG_TT_SIZE; while (True) { if (vg_tt[i].orig_addr == tce->orig_addr) VG_(core_panic)("add_TT_entry: duplicate"); @@ -266,7 +266,7 @@ TTEntry* search_tt ( Addr orig_addr ) { Int i; /* Hash to get initial probe point. */ - i = ((UInt)orig_addr) % VG_TT_SIZE; + i = orig_addr % VG_TT_SIZE; while (True) { if (vg_tt[i].orig_addr == orig_addr) return &vg_tt[i]; diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c index 8200f5ed13..6e75bdb350 100644 --- a/helgrind/hg_main.c +++ b/helgrind/hg_main.c @@ -240,8 +240,8 @@ typedef struct EC_IP { static inline UInt packEC(ExeContext *ec) { - SK_ASSERT(((UInt)ec & ((1 << STATE_BITS)-1)) == 0); - return ((UInt)ec) >> STATE_BITS; + SK_ASSERT(((UWord)ec & ((1 << STATE_BITS)-1)) == 0); + return ((UWord)ec) >> STATE_BITS; } static inline ExeContext *unpackEC(UInt i) @@ -252,7 +252,7 @@ static inline ExeContext *unpackEC(UInt i) /* Lose 2 LSB of IP */ static inline UInt packIP(Addr ip) { - return ((UInt)ip) >> STATE_BITS; + return ip >> STATE_BITS; } static inline Addr unpackIP(UInt i) @@ -445,8 +445,8 @@ static Bool tlsIsDisjoint(const ThreadLifeSeg *tls, static inline UInt packTLS(ThreadLifeSeg *tls) { - SK_ASSERT(((UInt)tls & ((1 << STATE_BITS)-1)) == 0); - return ((UInt)tls) >> STATE_BITS; + SK_ASSERT(((UWord)tls & ((1 << STATE_BITS)-1)) == 0); + return ((UWord)tls) >> STATE_BITS; } static inline ThreadLifeSeg *unpackTLS(UInt i) @@ -656,8 +656,8 @@ static inline UInt packLockSet(const LockSet *p) { UInt id; - SK_ASSERT(((UInt)p & ((1 << STATE_BITS)-1)) == 0); - id = ((UInt)p) >> STATE_BITS; + SK_ASSERT(((UWord)p & ((1 << STATE_BITS)-1)) == 0); + id = ((UWord)p) >> STATE_BITS; return id; } @@ -710,7 +710,7 @@ static UInt hash_LockSet_w_wo(const LockSet *ls, } hash = ROTL(hash, 17); - hash ^= (UInt)mx->mutexp; + hash ^= mx->mutexp; } return hash % LOCKSET_HASH_SZ; @@ -1348,7 +1348,7 @@ static void pp_all_mutexes() /* find or create a Mutex for a program's mutex use */ static Mutex *get_mutex(Addr mutexp) { - UInt bucket = ((UInt)mutexp) % M_MUTEX_HASHSZ; + UInt bucket = mutexp % M_MUTEX_HASHSZ; Mutex *mp; for(mp = mutex_hash[bucket]; mp != NULL; mp = mp->next) @@ -2593,10 +2593,10 @@ static void pp_AddrInfo ( Addr a, AddrInfo* ai ) break; case Mallocd: case Freed: { - UInt delta; + SizeT delta; UChar* relative; if (ai->rwoffset < 0) { - delta = (UInt)(- ai->rwoffset); + delta = (SizeT)(- ai->rwoffset); relative = "before"; } else if (ai->rwoffset >= ai->blksize) { delta = ai->rwoffset - ai->blksize; @@ -2606,8 +2606,8 @@ static void pp_AddrInfo ( Addr a, AddrInfo* ai ) relative = "inside"; } VG_(message)(Vg_UserMsg, - " Address %p is %d bytes %s a block of size %d %s by thread %d", - a, delta, relative, + " Address %p is %llu bytes %s a block of size %d %s by thread %d", + a, (ULong)delta, relative, ai->blksize, ai->akind == Mallocd ? "alloc'd" : "freed", ai->lasttid); diff --git a/memcheck/mac_needs.c b/memcheck/mac_needs.c index 87b58263bd..e6231a0355 100644 --- a/memcheck/mac_needs.c +++ b/memcheck/mac_needs.c @@ -227,7 +227,7 @@ void MAC_(pp_AddrInfo) ( Addr a, AddrInfo* ai ) } break; case Freed: case Mallocd: case UserG: case Mempool: { - UInt delta; + SizeT delta; UChar* relative; UChar* kind; if (ai->akind == Mempool) { @@ -236,7 +236,7 @@ void MAC_(pp_AddrInfo) ( Addr a, AddrInfo* ai ) kind = "block"; } if (ai->rwoffset < 0) { - delta = (UInt)(- ai->rwoffset); + delta = (SizeT)(- ai->rwoffset); relative = "before"; } else if (ai->rwoffset >= ai->blksize) { delta = ai->rwoffset - ai->blksize; @@ -246,8 +246,8 @@ void MAC_(pp_AddrInfo) ( Addr a, AddrInfo* ai ) relative = "inside"; } VG_(message)(Vg_UserMsg, - " Address 0x%x is %d bytes %s a %s of size %d %s", - a, delta, relative, kind, + " Address 0x%x is %llu bytes %s a %s of size %d %s", + a, (ULong)delta, relative, kind, ai->blksize, ai->akind==Mallocd ? "alloc'd" : ai->akind==Freed ? "free'd" @@ -412,8 +412,7 @@ static void describe_addr ( Addr a, AddrInfo* ai ) for the --workaround-gcc296-bugs kludge. */ static Bool is_just_below_ESP( Addr esp, Addr aa ) { - if ((UInt)esp > (UInt)aa - && ((UInt)esp - (UInt)aa) <= VG_GCC296_BUG_STACK_SLOP) + if (esp > aa && (esp - aa) <= VG_GCC296_BUG_STACK_SLOP) return True; else return False; diff --git a/memcheck/mc_clientreqs.c b/memcheck/mc_clientreqs.c index 5f6df2e281..d27541dcb7 100644 --- a/memcheck/mc_clientreqs.c +++ b/memcheck/mc_clientreqs.c @@ -146,7 +146,7 @@ Bool MC_(client_perm_maybe_describe)( Addr a, AddrInfo* ai ) /* OK - maybe it's a mempool, too? */ mp = (MAC_Mempool*)VG_(HT_get_node)(MAC_(mempool_list), - (UInt)vg_cgbs[i].start, + (UWord)vg_cgbs[i].start, (void*)&d); if(mp != NULL) { if(mp->chunks != NULL) { @@ -197,14 +197,14 @@ Bool SK_(handle_client_request) ( ThreadId tid, UInt* arg, UInt* ret ) ok = MC_(check_writable) ( arg[1], arg[2], &bad_addr ); if (!ok) MC_(record_user_error) ( tid, bad_addr, True ); - *ret = ok ? (UInt)NULL : bad_addr; + *ret = ok ? (UWord)NULL : bad_addr; break; case VG_USERREQ__CHECK_READABLE: /* check readable */ ok = MC_(check_readable) ( arg[1], arg[2], &bad_addr ); if (!ok) MC_(record_user_error) ( tid, bad_addr, False ); - *ret = ok ? (UInt)NULL : bad_addr; + *ret = ok ? (UWord)NULL : bad_addr; break; case VG_USERREQ__DO_LEAK_CHECK: