Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/detailed_mem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ void MemChannelBase::AddressMap(Address addr, uint32_t& row, uint32_t& col, uint
}

uint32_t chnl = (uint32_t)-1;
if (mParam->interleaveType >= 0 && mParam->interleaveType <= 5) {
if (mParam->interleaveType <= 5) {
// for non-power of 2 channels
chnl = addr % mParam->channelCount;
addr /= mParam->channelCount;
Expand Down
2 changes: 1 addition & 1 deletion src/g_heap/dlmalloc.h.c
Original file line number Diff line number Diff line change
Expand Up @@ -4166,7 +4166,7 @@ static void* sys_alloc(mstate m, size_t nb) {
/* Unmap and unlink any mmapped segments that don't contain used chunks */
static size_t release_unused_segments(mstate m) {
size_t released = 0;
unsigned int nsegs = 0; //dsm: Was signed, and gcc was complaining about signed vs unsigned comparisons
size_t nsegs = 0;
msegmentptr pred = &m->seg;
msegmentptr sp = pred->next;
while (sp != 0) {
Expand Down
7 changes: 6 additions & 1 deletion src/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,12 @@ class PrintExpr {
#define trace(type, args...)
#endif


/* assert() is already defined as of POSIX.1-2001 and C89.
* Since we are overriding it here we need to make sure we don't create a macro
* redefinition, despite not having '#include <assert.h>' in zsim.
* (E.g., some environments might include <assert.h> in their system/startup files.)
*/
#undef assert
#ifndef NASSERT
#define assert(expr) \
if (unlikely(!(expr))) { \
Expand Down
2 changes: 1 addition & 1 deletion src/virt/cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ PostPatchFn PatchGetcpu(PrePatchArgs args) {
uint32_t cpu = cpuenumCpu(procIdx, getCid(args.tid)); // still valid, may become invalid when we leave()
assert(cpu != (uint32_t)-1);
return [cpu](PostPatchArgs args) {
trace(TimeVirt, "[%d] Post-patching SYS_getcpu", tid);
trace(TimeVirt, "[%d] Post-patching SYS_getcpu", args.tid);
ADDRINT arg0 = PIN_GetSyscallArgument(args.ctxt, args.std, 0);
ADDRINT arg1 = PIN_GetSyscallArgument(args.ctxt, args.std, 1);
VirtGetcpu(args.tid, cpu, arg0, arg1);
Expand Down
12 changes: 6 additions & 6 deletions src/virt/time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,24 +180,24 @@ PostPatchFn PatchNanosleep(PrePatchArgs args) {
struct timespec* ts;
uint64_t offsetNsec = 0;
if (isClock) {
trace(TimeVirt, "[%d] Pre-patching SYS_clock_nanosleep", tid);
trace(TimeVirt, "[%d] Pre-patching SYS_clock_nanosleep", args.tid);
int flags = (int) PIN_GetSyscallArgument(ctxt, std, 1);
ts = (struct timespec*) PIN_GetSyscallArgument(ctxt, std, 2);
if (flags == TIMER_ABSTIME) {
trace(TimeVirt, "[%d] SYS_clock_nanosleep requests TIMER_ABSTIME, offsetting", tid);
trace(TimeVirt, "[%d] SYS_clock_nanosleep requests TIMER_ABSTIME, offsetting", args.tid);
uint32_t domain = zinfo->procArray[procIdx]->getClockDomain();
uint64_t simNs = cyclesToNs(zinfo->globPhaseCycles);
offsetNsec = simNs + zinfo->clockDomainInfo[domain].realtimeOffsetNs;
}
} else {
trace(TimeVirt, "[%d] Pre-patching SYS_nanosleep", tid);
trace(TimeVirt, "[%d] Pre-patching SYS_nanosleep", args.tid);
ts = (struct timespec*) PIN_GetSyscallArgument(ctxt, std, 0);
}

// Check preconditions
// FIXME, shouldn't this use safeCopy??
if (!ts) return NullPostPatch; // kernel will return EFAULT
if (ts->tv_sec < 0 || ts->tv_nsec < 0 || ts->tv_nsec > 999999999) return false; // kernel will return EINVAL
if (ts->tv_sec < 0 || ts->tv_nsec < 0 || ts->tv_nsec > 999999999) return NullPostPatch; // kernel will return EINVAL

uint64_t waitNsec = timespecToNs(*ts);
if (waitNsec >= offsetNsec) waitNsec -= offsetNsec;
Expand Down Expand Up @@ -228,9 +228,9 @@ PostPatchFn PatchNanosleep(PrePatchArgs args) {
SYSCALL_STANDARD std = args.std;

if (isClock) {
trace(TimeVirt, "[%d] Post-patching SYS_clock_nanosleep", tid);
trace(TimeVirt, "[%d] Post-patching SYS_clock_nanosleep", args.tid);
} else {
trace(TimeVirt, "[%d] Post-patching SYS_nanosleep", tid);
trace(TimeVirt, "[%d] Post-patching SYS_nanosleep", args.tid);
}

int res = (int)(-PIN_GetSyscallNumber(ctxt, std));
Expand Down